[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to libfuse/netfs.c
From: |
Thomas Schwinge |
Subject: |
Changes to libfuse/netfs.c |
Date: |
Fri, 02 Dec 2005 17:45:23 -0500 |
Index: libfuse/netfs.c
diff -u libfuse/netfs.c:1.30 libfuse/netfs.c:1.31
--- libfuse/netfs.c:1.30 Tue Nov 15 23:43:05 2005
+++ libfuse/netfs.c Fri Dec 2 22:45:23 2005
@@ -610,47 +610,6 @@
}
-/* callback-helper of netfs_attempt_lookup, check whether the name of
- * file (of this callback) is equal to the one we're looking for, in case
- * set 'found' from fuse_dirh_t handle to TRUE.
- *
- * version for new fuse API (since 2.1)
- */
-static int
-fuse_lookup_helper(fuse_dirh_t handle, const char *name, int type, ino_t ino)
-{
- (void) type; /* we want to know whether the file exists at all,
- * the type is not of any interest */
- (void) ino; /* we don't care for inodes here, netfs_validate_stat does it */
-
- if(! strcmp(name, handle->filename))
- {
- handle->found = 1;
- return ENOMEM; /* send ENOMEM to stop being called, TODO make sure that
- * all programs, depending on libfuse, can live with that.
- */
- }
-
- return 0;
-}
-
-
-/* callback-helper of netfs_attempt_lookup, check whether the name of
- * file (of this callback) is equal to the one we're looking for, in case
- * set 'found' from fuse_dirh_t handle to TRUE.
- *
- * version for old API
- */
-static int
-fuse_lookup_helper_compat(fuse_dirh_t handle, const char *name, int type)
-{
- assert(fuse_use_ino == 0);
- return fuse_lookup_helper(handle, name, type, 0); /* set ino to 0, it will
- * be ignored anyways,
- * since fuse_use_ino
- * is off. */
-}
-
/* Lookup NAME in DIR for USER; set *NODE to the found name upon return. If
the name was not found, then return ENOENT. On any error, clear *NODE.
(*NODE, if found, should be locked, this call should unlock DIR no matter
@@ -662,7 +621,6 @@
name, dir->nn->path);
error_t err;
- fuse_dirh_t handle = NULL;
if((err = netfs_validate_stat(dir, user))
|| (err = fshelp_access(&dir->nn_stat, S_IREAD, user))
@@ -692,56 +650,26 @@
err = EAGAIN;
}
- else if(FUSE_OP_HAVE(getdir))
+ else if(FUSE_OP_HAVE(getattr))
{
/* lookup for common file */
struct netnode *nn;
char *path;
+ struct stat stbuf;
- if(! (handle = malloc(sizeof(struct fuse_dirhandle))))
- {
- err = ENOMEM; /* sorry, translator not available ... */
- goto out;
- }
-
- handle->found = 0;
- handle->filename = name;
-
- if(fuse_ops)
- fuse_ops->getdir(dir->nn->path, handle, fuse_lookup_helper);
- else
- fuse_ops_compat->getdir(dir->nn->path, handle,
- fuse_lookup_helper_compat);
-
- /* we cannot rely on exit status of ->getdir() func, since we
- * return an error from the helper to abort write out
- */
-
- if(! handle->found)
- {
- err = ENOENT;
- goto out;
- }
-
- /* well, file exists - create a handle ... */
- if(! (path = malloc(strlen(dir->nn->path) + strlen(name) + 2)))
+ if(asprintf(&path, "%s/%s",
+ dir->nn->parent ? dir->nn->path : "", name) < 0)
{
err = ENOMEM;
goto out;
}
- sprintf(path, "%s/%s", dir->nn->parent ? dir->nn->path : "", name);
- nn = fuse_make_netnode(dir->nn, path);
- free(path); /* fuse_make_netnode strdup()s the pathname */
-
- if(! path)
- {
+ if(! (err = -FUSE_OP_CALL(getattr, path, &stbuf)))
+ if(! (nn = fuse_make_netnode(dir->nn, path)) ||
+ ! (*node = fuse_make_node(nn)))
err = ENOMEM;
- goto out;
- }
- if((*node = fuse_make_node(nn)))
- err = 0;
+ free(path); /* fuse_make_netnode strdup()s the pathname */
}
out:
@@ -752,7 +680,6 @@
else
mutex_lock(&(*node)->lock);
- free(handle);
FUNC_EPILOGUE(err);
}
- Changes to libfuse/netfs.c,
Thomas Schwinge <=
- Changes to libfuse/netfs.c, Thomas Schwinge, 2005/12/02
- Changes to libfuse/netfs.c, Thomas Schwinge, 2005/12/02
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/03
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/03
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/03
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/04
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/09
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/09
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/09
- Changes to libfuse/netfs.c, Stefan Siegl, 2005/12/09