From 5e3a7383bde79b460fec5420a093e1e71df389ad Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 8 Sep 2005 14:40:16 +0000 Subject: [PATCH] more reverting --- example/fusexmp_fh.c | 38 -------------------------------------- include/fuse.h | 17 ----------------- lib/fuse.c | 11 +++++------ 3 files changed, 5 insertions(+), 61 deletions(-) diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c index 17bd77e..432ff6f 100644 --- a/example/fusexmp_fh.c +++ b/example/fusexmp_fh.c @@ -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, diff --git a/include/fuse.h b/include/fuse.h index 39982dc..8175718 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -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 diff --git a/lib/fuse.c b/lib/fuse.c index 2209212..b52febb 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -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) -- 2.30.2