summaryrefslogtreecommitdiff
path: root/src/netfs.c
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2013-03-22 16:25:10 +0100
committerPino Toscano <toscano.pino@tiscali.it>2013-03-22 16:25:10 +0100
commit70bf9589f3718ee6162eb7f0320f44a743b80b6d (patch)
treee0d32cededd86db23f169af466b2efd51be8754f /src/netfs.c
parentdefdeff585f61dbc7cff2ea6cfa5cfc66288b6a5 (diff)
Remove support for FUSE compatibility < 25
While the default FUSE_USE_VERSION is 21, compatibility versions below 25 are rarely (if at all) used; keeping support for them is not worth, especially than they require a number of special casings all around (different fuse_operations and fuse_file_info). * src/fuse_i.h (fuse_ops_compat22, fuse_ops_compat2): Remove. (FUSE_OP_HAVE, FUSE_OP_CALL): Use only fuse_ops25. (FUSE_OP_HAVE22, FUSE_OP_CALL22): Remove. (NN_INFO, NN_INFO_APPLY): Use only info25. (struct netnode): Remove field 'compat22' in field union 'info'. * src/main.c (fuse_ops_compat22, fuse_ops_compat2, fuse_main_compat2) (fuse_main_compat2, fuse_main_real_compat22, fuse_new_compat2) (fuse_new_compat22, fuse_mount_compat22): Remove. * src/netfs.c (netfs_attempt_statfs, netfs_attempt_sync, netfs_attempt_write) (netfs_attempt_read, fuse_get_inode, get_dirents_getdir, get_dirents_readdir) (netfs_get_dirents): Use only FUSE_OP_CALL and FUSE_OP_HAVE. (get_dirents_getdir_helper_compat): Remove. * src/netnode.c (fuse_sync_filesystem): Use only FUSE_OP_CALL and NN_INFO.
Diffstat (limited to 'src/netfs.c')
-rw-r--r--src/netfs.c146
1 files changed, 29 insertions, 117 deletions
diff --git a/src/netfs.c b/src/netfs.c
index 88ae22742..f8d0d3973 100644
--- a/src/netfs.c
+++ b/src/netfs.c
@@ -315,13 +315,13 @@ netfs_attempt_statfs (struct iouser *cred, struct node *node,
else if(FUSE_OP_HAVE(statfs))
{
+ struct statvfs stvfs;
+
refresh_context_struct(cred);
+ err = -FUSE_OP_CALL(statfs, node->nn->path, &stvfs);
- if(fuse_ops25)
+ if(! err)
{
- struct statvfs stvfs;
- err = -fuse_ops25->statfs(node->nn->path, &stvfs);
-
st->f_type = stvfs.__f_type;
st->f_bsize = stvfs.f_bsize;
st->f_blocks = stvfs.f_blocks;
@@ -335,15 +335,6 @@ netfs_attempt_statfs (struct iouser *cred, struct node *node,
st->f_frsize = stvfs.f_frsize;
st->f_flag = stvfs.f_flag;
}
-
- else if(fuse_ops_compat22)
- err = -fuse_ops_compat22->statfs(node->nn->path, st);
-
- else if(fuse_ops_compat2)
- err = -fuse_ops_compat2->statfs(node->nn->path, st);
-
- else
- assert(0);
}
else
@@ -590,15 +581,8 @@ netfs_attempt_sync (struct iouser *cred, struct node *node, int wait)
goto out;
}
- if(FUSE_OP_HAVE22(fsync))
- err = -FUSE_OP_CALL22(fsync, node->nn->path, 0, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- err = -fuse_ops_compat2->fsync(node->nn->path, 0);
+ err = -FUSE_OP_CALL(fsync, node->nn->path, 0, NN_INFO(node));
- else
- assert(0);
-
if(! err)
node->nn->may_need_sync = 0;
@@ -1097,29 +1081,13 @@ error_t netfs_attempt_write (struct iouser *cred, struct node *node,
if(FUSE_OP_HAVE(open))
{
- if(FUSE_OP_HAVE22(open))
- err = FUSE_OP_CALL22(open, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- err = fuse_ops_compat2->open(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
+ err = FUSE_OP_CALL(open, node->nn->path, NN_INFO(node));
if(err) goto out;
}
- int sz;
- if(FUSE_OP_HAVE22(write))
- sz = FUSE_OP_CALL22(write, node->nn->path, data, *len, offset,
+ int sz = FUSE_OP_CALL(write, node->nn->path, data, *len, offset,
NN_INFO(node));
-
- else if(fuse_ops_compat2)
- sz = fuse_ops_compat2->write(node->nn->path, data, *len, offset);
-
- else
- assert(0);
/* FIXME: open, flush and release handling probably should be changed
* completely, I mean, we probably should do fuse_ops->open in
@@ -1128,21 +1096,11 @@ error_t netfs_attempt_write (struct iouser *cred, struct node *node,
*
* This way we wouldn't be able to report any errors back.
*/
- if(sz >= 0 && FUSE_OP_HAVE22(flush))
- err = FUSE_OP_CALL22(flush, node->nn->path, NN_INFO(node));
+ if(sz >= 0 && FUSE_OP_HAVE(flush))
+ err = FUSE_OP_CALL(flush, node->nn->path, NN_INFO(node));
if(FUSE_OP_HAVE(open) && FUSE_OP_HAVE(release))
- {
- if(FUSE_OP_HAVE22(release))
- FUSE_OP_CALL22(release, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- fuse_ops_compat2->release(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
- }
+ FUSE_OP_CALL(release, node->nn->path, NN_INFO(node));
if(sz < 0)
err = -sz;
@@ -1222,30 +1180,14 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *node,
if(FUSE_OP_HAVE(open))
{
- if(FUSE_OP_HAVE22(open))
- err = FUSE_OP_CALL22(open, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- err = fuse_ops_compat2->open(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
+ err = FUSE_OP_CALL(open, node->nn->path, NN_INFO(node));
if(err) goto out;
}
- int sz;
- if(FUSE_OP_HAVE22(read))
- sz = FUSE_OP_CALL22(read, node->nn->path, data, *len, offset,
+ int sz = FUSE_OP_CALL(read, node->nn->path, data, *len, offset,
NN_INFO(node));
- else if(fuse_ops_compat2)
- sz = fuse_ops_compat2->read(node->nn->path, data, *len, offset);
-
- else
- assert(0);
-
/* FIXME: open, flush and release handling probably should be changed
* completely, I mean, we probably should do fuse_ops->open in
* the netfs_check_open_permissions function and leave it open
@@ -1253,21 +1195,11 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *node,
*
* This way we wouldn't be able to report any errors back.
*/
- if(sz >= 0 && FUSE_OP_HAVE22(flush))
- err = FUSE_OP_CALL22(flush, node->nn->path, NN_INFO(node));
+ if(sz >= 0 && FUSE_OP_HAVE(flush))
+ err = FUSE_OP_CALL(flush, node->nn->path, NN_INFO(node));
if(FUSE_OP_HAVE(open) && FUSE_OP_HAVE(release))
- {
- if(FUSE_OP_HAVE22(release))
- FUSE_OP_CALL22(release, node->nn->path, NN_INFO(node));
-
- else if(fuse_ops_compat2)
- fuse_ops_compat2->release(node->nn->path,
- node->nn->info.compat22.flags);
-
- else
- assert(0);
- }
+ FUSE_OP_CALL(release, node->nn->path, NN_INFO(node));
if(sz < 0)
err = -sz;
@@ -1304,8 +1236,8 @@ fuse_get_inode(const char *name)
{
struct stat stat;
- assert(FUSE_OP_HAVE22(getattr));
- FUSE_OP_CALL22(getattr, name, &stat);
+ assert(FUSE_OP_HAVE(getattr));
+ FUSE_OP_CALL(getattr, name, &stat);
return stat.st_ino;
}
@@ -1406,18 +1338,6 @@ get_dirents_getdir_helper(fuse_dirh_t handle, const char *name,
}
-/* callback handler used by netfs_get_dirents to write our dirents
- * to the mmaped memory
- *
- * version for old api
- */
-static int
-get_dirents_getdir_helper_compat(fuse_dirh_t hdl, const char *name, int type)
-{
- return get_dirents_getdir_helper(hdl, name, type, 0);
-}
-
-
static error_t
get_dirents_getdir(struct node *dir, int first_entry, int num_entries,
char **data, mach_msg_type_number_t *data_len,
@@ -1455,15 +1375,7 @@ get_dirents_getdir(struct node *dir, int first_entry, int num_entries,
handle->parent = dir->nn;
handle->hdrpos = (struct dirent*) *data;
- if(FUSE_OP_HAVE22(getdir))
- FUSE_OP_CALL22(getdir, dir->nn->path, handle, get_dirents_getdir_helper);
-
- else if(fuse_ops_compat2)
- fuse_ops_compat2->getdir(dir->nn->path, handle,
- get_dirents_getdir_helper_compat);
-
- else
- assert(0);
+ FUSE_OP_CALL(getdir, dir->nn->path, handle, get_dirents_getdir_helper);
*data_len -= handle->size; /* subtract number of bytes left in the
* buffer from the length of the buffer we
@@ -1591,7 +1503,7 @@ get_dirents_readdir(struct node *dir, int first_entry, int num_entries,
error_t err;
FUNC_PROLOGUE_NODE("get_dirents_readdir", dir);
- assert(FUSE_OP_HAVE22(readdir));
+ assert(FUSE_OP_HAVE(readdir));
fuse_dirh_t handle;
if(! (handle = malloc(sizeof(struct fuse_dirhandle))))
@@ -1620,21 +1532,21 @@ get_dirents_readdir(struct node *dir, int first_entry, int num_entries,
handle->parent = dir->nn;
handle->hdrpos = (struct dirent*) *data;
- if(FUSE_OP_HAVE22(opendir)
- && (err = FUSE_OP_CALL22(opendir, dir->nn->path, NN_INFO(dir))))
+ if(FUSE_OP_HAVE(opendir)
+ && (err = FUSE_OP_CALL(opendir, dir->nn->path, NN_INFO(dir))))
goto out;
- if((err = FUSE_OP_CALL22(readdir, dir->nn->path, handle,
- get_dirents_readdir_helper,
- first_entry, NN_INFO(dir))))
+ if((err = FUSE_OP_CALL(readdir, dir->nn->path, handle,
+ get_dirents_readdir_helper,
+ first_entry, NN_INFO(dir))))
{
- if(FUSE_OP_HAVE22(releasedir))
- FUSE_OP_CALL22(releasedir, dir->nn->path, NN_INFO(dir));
+ if(FUSE_OP_HAVE(releasedir))
+ FUSE_OP_CALL(releasedir, dir->nn->path, NN_INFO(dir));
goto out;
}
- if(FUSE_OP_HAVE22(releasedir)
- && (err = FUSE_OP_CALL22(releasedir, dir->nn->path, NN_INFO(dir))))
+ if(FUSE_OP_HAVE(releasedir)
+ && (err = FUSE_OP_CALL(releasedir, dir->nn->path, NN_INFO(dir))))
goto out;
*data_len -= handle->size; /* subtract number of bytes left in the
@@ -1668,7 +1580,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir,
goto out;
- if(FUSE_OP_HAVE22(readdir))
+ if(FUSE_OP_HAVE(readdir))
err = get_dirents_readdir(dir, first_entry, num_entries, data, data_len,
data_entries);