mirror of https://gitee.com/openkylin/gvfs.git
Revert "fuse: Adapt gvfsd-fuse to use fuse 3.x"
This reverts commit 7a0a06186b6fef07b8fce2360c04fd075fc84ed1. In Ubuntu we have fuse 2 in main and fuse 3 in universe. We'll need to work out a transition plan to switch. Forwarded: not-needed Gbp-Pq: Name Revert-fuse-Adapt-gvfsd-fuse-to-use-fuse-3.x.patch
This commit is contained in:
parent
2a61cefd9f
commit
59b26e2966
|
@ -43,8 +43,7 @@
|
|||
#include <gvfsdbus.h>
|
||||
#include <gvfsutils.h>
|
||||
|
||||
#define FUSE_USE_VERSION 30
|
||||
|
||||
#define FUSE_USE_VERSION 26
|
||||
#include <fuse.h>
|
||||
#include <fuse_lowlevel.h>
|
||||
|
||||
|
@ -860,7 +859,7 @@ getattr_for_file_handle (FileHandle *fh, struct stat *sbuf)
|
|||
}
|
||||
|
||||
static gint
|
||||
vfs_getattr (const gchar *path, struct stat *sbuf, struct fuse_file_info *fi)
|
||||
vfs_getattr (const gchar *path, struct stat *sbuf)
|
||||
{
|
||||
GFile *file;
|
||||
gint result = 0;
|
||||
|
@ -1582,12 +1581,12 @@ readdir_for_file (GFile *base_file, gpointer buf, fuse_fill_dir_t filler)
|
|||
return result;
|
||||
}
|
||||
|
||||
filler (buf, ".", NULL, 0, 0);
|
||||
filler (buf, "..", NULL, 0, 0);
|
||||
filler (buf, ".", NULL, 0);
|
||||
filler (buf, "..", NULL, 0);
|
||||
|
||||
while ((file_info = g_file_enumerator_next_file (enumerator, NULL, &error)) != NULL)
|
||||
{
|
||||
filler (buf, g_file_info_get_name (file_info), NULL, 0, 0);
|
||||
filler (buf, g_file_info_get_name (file_info), NULL, 0);
|
||||
g_object_unref (file_info);
|
||||
}
|
||||
|
||||
|
@ -1598,7 +1597,7 @@ readdir_for_file (GFile *base_file, gpointer buf, fuse_fill_dir_t filler)
|
|||
|
||||
static gint
|
||||
vfs_readdir (const gchar *path, gpointer buf, fuse_fill_dir_t filler, off_t offset,
|
||||
struct fuse_file_info *fi, enum fuse_readdir_flags fl)
|
||||
struct fuse_file_info *fi)
|
||||
{
|
||||
GFile *base_file;
|
||||
gint result = 0;
|
||||
|
@ -1611,8 +1610,8 @@ vfs_readdir (const gchar *path, gpointer buf, fuse_fill_dir_t filler, off_t offs
|
|||
|
||||
/* Mount list */
|
||||
|
||||
filler (buf, ".", NULL, 0, 0);
|
||||
filler (buf, "..", NULL, 0, 0);
|
||||
filler (buf, ".", NULL, 0);
|
||||
filler (buf, "..", NULL, 0);
|
||||
|
||||
mount_list_lock ();
|
||||
|
||||
|
@ -1620,7 +1619,7 @@ vfs_readdir (const gchar *path, gpointer buf, fuse_fill_dir_t filler, off_t offs
|
|||
{
|
||||
MountRecord *mount_record = l->data;
|
||||
|
||||
filler (buf, mount_record->name, NULL, 0, 0);
|
||||
filler (buf, mount_record->name, NULL, 0);
|
||||
}
|
||||
|
||||
mount_list_unlock ();
|
||||
|
@ -1644,21 +1643,13 @@ vfs_readdir (const gchar *path, gpointer buf, fuse_fill_dir_t filler, off_t offs
|
|||
}
|
||||
|
||||
static gint
|
||||
vfs_rename (const gchar *old_path, const gchar *new_path, unsigned int vfs_flags)
|
||||
vfs_rename (const gchar *old_path, const gchar *new_path)
|
||||
{
|
||||
GFile *old_file;
|
||||
GFile *new_file;
|
||||
GFileCopyFlags flags = G_FILE_COPY_OVERWRITE;
|
||||
GError *error = NULL;
|
||||
gint result = 0;
|
||||
|
||||
/* Can not implement this flag because limitation of GFile. */
|
||||
if (vfs_flags & RENAME_EXCHANGE)
|
||||
return -EINVAL;
|
||||
|
||||
if (vfs_flags & RENAME_NOREPLACE)
|
||||
flags = G_FILE_COPY_NONE;
|
||||
|
||||
g_debug ("vfs_rename: %s -> %s\n", old_path, new_path);
|
||||
|
||||
old_file = file_from_full_path (old_path);
|
||||
|
@ -1674,7 +1665,7 @@ vfs_rename (const gchar *old_path, const gchar *new_path, unsigned int vfs_flags
|
|||
file_handle_close_stream (fh);
|
||||
}
|
||||
|
||||
g_file_move (old_file, new_file, flags, NULL, NULL, NULL, &error);
|
||||
g_file_move (old_file, new_file, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
@ -2081,15 +2072,6 @@ vfs_truncate (const gchar *path, off_t size)
|
|||
return result;
|
||||
}
|
||||
|
||||
static gint
|
||||
vfs_truncate_dispatch (const gchar *path, off_t size, struct fuse_file_info *fi)
|
||||
{
|
||||
if (fi)
|
||||
return vfs_ftruncate (path, size, fi);
|
||||
|
||||
return vfs_truncate (path, size);
|
||||
}
|
||||
|
||||
static gint
|
||||
vfs_symlink (const gchar *path_old, const gchar *path_new)
|
||||
{
|
||||
|
@ -2196,7 +2178,7 @@ vfs_access (const gchar *path, gint mode)
|
|||
}
|
||||
|
||||
static gint
|
||||
vfs_utimens (const gchar *path, const struct timespec tv [2], struct fuse_file_info *fi)
|
||||
vfs_utimens (const gchar *path, const struct timespec tv [2])
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
|
@ -2271,7 +2253,7 @@ vfs_utimens (const gchar *path, const struct timespec tv [2], struct fuse_file_i
|
|||
}
|
||||
|
||||
static gint
|
||||
vfs_chmod (const gchar *path, mode_t mode, struct fuse_file_info *fi)
|
||||
vfs_chmod (const gchar *path, mode_t mode)
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
|
@ -2394,7 +2376,7 @@ register_fuse_cb (GVfsDBusMountTracker *proxy,
|
|||
}
|
||||
|
||||
static gpointer
|
||||
vfs_init (struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
vfs_init (struct fuse_conn_info *conn)
|
||||
{
|
||||
GVfsDBusMountTracker *proxy;
|
||||
GError *error;
|
||||
|
@ -2470,7 +2452,7 @@ vfs_init (struct fuse_conn_info *conn, struct fuse_config *cfg)
|
|||
conn->want |= FUSE_CAP_ATOMIC_O_TRUNC;
|
||||
|
||||
/* Prevent out-of-order readahead */
|
||||
conn->want &= ~FUSE_CAP_ASYNC_READ;
|
||||
conn->async_read = 0;
|
||||
|
||||
/* Use up to a 64KiB write block size. Only has an effect if -o big_writes
|
||||
* is given on the command-line. */
|
||||
|
@ -2521,7 +2503,8 @@ static struct fuse_operations vfs_oper =
|
|||
.unlink = vfs_unlink,
|
||||
.mkdir = vfs_mkdir,
|
||||
.rmdir = vfs_rmdir,
|
||||
.truncate = vfs_truncate_dispatch,
|
||||
.ftruncate = vfs_ftruncate,
|
||||
.truncate = vfs_truncate,
|
||||
.symlink = vfs_symlink,
|
||||
.access = vfs_access,
|
||||
.utimens = vfs_utimens,
|
||||
|
@ -2533,7 +2516,6 @@ static struct fuse_operations vfs_oper =
|
|||
.getxattr = vfs_getxattr,
|
||||
.listxattr = vfs_listxattr,
|
||||
.removexattr = vfs_removexattr,
|
||||
.ftruncate = vfs_ftruncate,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -2555,65 +2537,35 @@ gint
|
|||
main (gint argc, gchar *argv [])
|
||||
{
|
||||
struct fuse *fuse;
|
||||
struct fuse_chan *ch;
|
||||
struct fuse_session *se;
|
||||
char *mountpoint;
|
||||
int multithreaded;
|
||||
int res;
|
||||
struct fuse_cmdline_opts opts;
|
||||
struct fuse_args args = FUSE_ARGS_INIT (argc, argv);
|
||||
|
||||
if (fuse_opt_parse (&args, NULL, NULL, NULL) == -1)
|
||||
return 1;
|
||||
|
||||
if (fuse_parse_cmdline (&args, &opts) != 0)
|
||||
return 1;
|
||||
|
||||
if (opts.show_version)
|
||||
{
|
||||
printf ("%s\n", PACKAGE_STRING);
|
||||
fuse_lowlevel_version ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (opts.show_help)
|
||||
{
|
||||
printf ("usage: %s [options] <mountpoint>\n\n", argv[0]);
|
||||
printf ("FUSE options:\n");
|
||||
fuse_cmdline_help ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!opts.mountpoint)
|
||||
{
|
||||
fprintf (stderr, "error: no mountpoint specified\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fuse = fuse_new (&args, &vfs_oper, sizeof (vfs_oper), NULL /* user data */);
|
||||
fuse = fuse_setup (argc, argv, &vfs_oper, sizeof (vfs_oper), &mountpoint,
|
||||
&multithreaded, NULL /* user data */);
|
||||
if (fuse == NULL)
|
||||
return 1;
|
||||
|
||||
if (fuse_mount (fuse, opts.mountpoint) != 0)
|
||||
return 1;
|
||||
|
||||
if (fuse_daemonize (opts.foreground) != 0)
|
||||
return 1;
|
||||
if (multithreaded)
|
||||
res = fuse_loop_mt (fuse);
|
||||
else
|
||||
res = fuse_loop (fuse);
|
||||
|
||||
se = fuse_get_session (fuse);
|
||||
if (fuse_set_signal_handlers (se) != 0)
|
||||
return 1;
|
||||
|
||||
if (opts.singlethread)
|
||||
res = fuse_loop (fuse);
|
||||
else
|
||||
res = fuse_loop_mt (fuse, opts.clone_fd);
|
||||
ch = fuse_session_next_chan (se, NULL);
|
||||
|
||||
/* Ignore new signals during exit procedure in order to terminate properly */
|
||||
set_custom_signal_handlers (SIG_IGN);
|
||||
fuse_remove_signal_handlers (se);
|
||||
|
||||
fuse_unmount (fuse);
|
||||
fuse_unmount (mountpoint, ch);
|
||||
fuse_destroy (fuse);
|
||||
free (opts.mountpoint);
|
||||
fuse_opt_free_args (&args);
|
||||
free (mountpoint);
|
||||
|
||||
return res;
|
||||
if (res == -1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,9 @@ on_name_acquired (GDBusConnection *connection,
|
|||
argv2[0] = LIBEXEC_DIR "/gvfsd-fuse";
|
||||
argv2[1] = fuse_path;
|
||||
argv2[2] = "-f";
|
||||
argv2[3] = NULL;
|
||||
argv2[3] = "-o";
|
||||
argv2[4] = "big_writes";
|
||||
argv2[5] = NULL;
|
||||
|
||||
g_spawn_async (NULL,
|
||||
argv2,
|
||||
|
|
|
@ -330,7 +330,7 @@ config_h.set('HAVE_GUDEV', enable_gudev)
|
|||
# *** Check for FUSE ***
|
||||
enable_fuse = get_option('fuse')
|
||||
if enable_fuse
|
||||
fuse_dep = dependency('fuse3', version: '>= 3.0.0')
|
||||
fuse_dep = dependency('fuse', version: '>= 2.8.0')
|
||||
endif
|
||||
config_h.set('HAVE_FUSE', enable_fuse)
|
||||
|
||||
|
|
Loading…
Reference in New Issue