more reverting
authorMiklos Szeredi <miklos@szeredi.hu>
Thu, 8 Sep 2005 14:40:16 +0000 (14:40 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Thu, 8 Sep 2005 14:40:16 +0000 (14:40 +0000)
example/fusexmp_fh.c
include/fuse.h
lib/fuse.c

index 17bd77e61c90ee5e383c9de81d3152810ab5f2e1..432ff6f06c0b43c07d67bea796d6acde940e09da 100644 (file)
@@ -193,20 +193,6 @@ static int xmp_truncate(const char *path, off_t size)
     return 0;
 }
 
-static int xmp_ftruncate(const char *path, off_t size,
-                         struct fuse_file_info *fi)
-{
-    int res;
-
-    (void) path;
-
-    res = ftruncate(fi->fh, size);
-    if(res == -1)
-        return -errno;
-
-    return 0;
-}
-
 static int xmp_utime(const char *path, struct utimbuf *buf)
 {
     int res;
@@ -231,28 +217,6 @@ static int xmp_open(const char *path, struct fuse_file_info *fi)
     return 0;
 }
 
-static int xmp_create(const char *path, mode_t mode, struct fuse_file_info *fi)
-{
-    int fd;
-    struct stat stbuf;
-
-    fd = open(path, fi->flags | O_NOFOLLOW, mode);
-    if(fd == -1)
-        return -errno;
-
-    if (fstat(fd, &stbuf) == -1) {
-        close(fd);
-        return -EIO;
-    }
-    if (!S_ISREG(stbuf.st_mode)) {
-        close(fd);
-        return -EISDIR;
-    }
-
-    fi->fh = fd;
-    return 0;
-}
-
 static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
                     struct fuse_file_info *fi)
 {
@@ -367,7 +331,6 @@ static struct fuse_operations xmp_oper = {
     .chmod     = xmp_chmod,
     .chown     = xmp_chown,
     .truncate  = xmp_truncate,
-    .ftruncate = xmp_ftruncate,
     .utime     = xmp_utime,
     .open      = xmp_open,
     .read      = xmp_read,
@@ -375,7 +338,6 @@ static struct fuse_operations xmp_oper = {
     .statfs    = xmp_statfs,
     .release   = xmp_release,
     .fsync     = xmp_fsync,
-    .create    = xmp_create,
 #ifdef HAVE_SETXATTR
     .setxattr  = xmp_setxattr,
     .getxattr  = xmp_getxattr,
index 39982dc2d071b5c90fda99ffed6b19ea0f85e301..8175718bf569963bf089c66e457c36b2e5822c69 100644 (file)
@@ -298,23 +298,6 @@ struct fuse_operations {
      * Introduced in version 2.3
      */
     void (*destroy) (void *);
-
-    /**
-     * Check file access permissions
-     *
-     * Need not be implemented.  Will only be called for the access()
-     * system call, and for the open() system call, unless a new file
-     * is created (file didn't exist and O_CREAT was given).  If the
-     * 'default_permissions' mount option is given, this method is
-     * never called.
-     *
-     * Introduced in version 2.4
-     */
-    int (*access) (const char *, int);
-
-    int (*create) (const char *, mode_t, struct fuse_file_info *);
-
-    int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
 };
 
 /** Extra context that may be needed by some filesystems
index 22092121681ff2a241e7e1c1aca70d2294253ebf..b52febbb5f77a632abcb42063378cad7964ed785 100644 (file)
@@ -664,15 +664,12 @@ static int do_chown(struct fuse *f, const char *path, struct stat *attr,
     return err;
 }
 
-static int do_truncate(struct fuse *f, const char *path, struct stat *attr,
-                       struct fuse_file_info *fi)
+static int do_truncate(struct fuse *f, const char *path, struct stat *attr)
 {
     int err;
 
     err = -ENOSYS;
-    if (fi && f->op.ftruncate)
-        err = f->op.ftruncate(path, attr->st_size, fi);
-    else if (f->op.truncate)
+    if (f->op.truncate)
         err = f->op.truncate(path, attr->st_size);
 
     return err;
@@ -699,6 +696,8 @@ static void fuse_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
     char *path;
     int err;
 
+    (void) fi;
+
     err = -ENOENT;
     pthread_rwlock_rdlock(&f->tree_lock);
     path = get_path(f, ino);
@@ -711,7 +710,7 @@ static void fuse_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
             if (!err && (valid & (FUSE_SET_ATTR_UID | FUSE_SET_ATTR_GID)))
                 err = do_chown(f, path, attr, valid);
             if (!err && (valid & FUSE_SET_ATTR_SIZE))
-                err = do_truncate(f, path, attr, fi);
+                err = do_truncate(f, path, attr);
             if (!err && (valid & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) == (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME))
                 err = do_utime(f, path, attr);
             if (!err)