diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-10-26 16:04:04 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2005-10-26 16:04:04 +0000 |
commit | 11509ce3fc6a36b6e3c094bf8aa11820f17d0ede (patch) | |
tree | 7b7584927fab4174852d5c650834326e3f7a8a37 /kernel | |
parent | d9079a75b14b73e7953adf4958709b1e5ab3804c (diff) | |
download | libfuse-11509ce3fc6a36b6e3c094bf8aa11820f17d0ede.tar.gz |
add ftruncate() method
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/dir.c | 34 | ||||
-rw-r--r-- | kernel/fuse_kernel.h | 18 |
2 files changed, 34 insertions, 18 deletions
diff --git a/kernel/dir.c b/kernel/dir.c index bc792cb..48df469 100644 --- a/kernel/dir.c +++ b/kernel/dir.c @@ -838,34 +838,36 @@ static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync) return file ? fuse_fsync_common(file, de, datasync, 1) : 0; } -static unsigned iattr_to_fattr(struct iattr *iattr, struct fuse_attr *fattr) +static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg) { unsigned ivalid = iattr->ia_valid; - unsigned fvalid = 0; - - memset(fattr, 0, sizeof(*fattr)); if (ivalid & ATTR_MODE) - fvalid |= FATTR_MODE, fattr->mode = iattr->ia_mode; + arg->valid |= FATTR_MODE, arg->mode = iattr->ia_mode; if (ivalid & ATTR_UID) - fvalid |= FATTR_UID, fattr->uid = iattr->ia_uid; + arg->valid |= FATTR_UID, arg->uid = iattr->ia_uid; if (ivalid & ATTR_GID) - fvalid |= FATTR_GID, fattr->gid = iattr->ia_gid; + arg->valid |= FATTR_GID, arg->gid = iattr->ia_gid; if (ivalid & ATTR_SIZE) - fvalid |= FATTR_SIZE, fattr->size = iattr->ia_size; + arg->valid |= FATTR_SIZE, arg->size = iattr->ia_size; /* You can only _set_ these together (they may change by themselves) */ if ((ivalid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) { - fvalid |= FATTR_ATIME | FATTR_MTIME; + arg->valid |= FATTR_ATIME | FATTR_MTIME; #ifdef KERNEL_2_6 - fattr->atime = iattr->ia_atime.tv_sec; - fattr->mtime = iattr->ia_mtime.tv_sec; + arg->atime = iattr->ia_atime.tv_sec; + arg->mtime = iattr->ia_mtime.tv_sec; #else - fattr->atime = iattr->ia_atime; - fattr->mtime = iattr->ia_mtime; + arg->atime = iattr->ia_atime; + arg->mtime = iattr->ia_mtime; #endif } - - return fvalid; +#ifdef ATTR_FILE + if (ivalid & ATTR_FILE) { + struct fuse_file *ff = iattr->ia_file->private_data; + arg->valid |= FATTR_FH; + arg->fh = ff->fh; + } +#endif } static int fuse_setattr(struct dentry *entry, struct iattr *attr) @@ -904,7 +906,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) return -EINTR; memset(&inarg, 0, sizeof(inarg)); - inarg.valid = iattr_to_fattr(attr, &inarg.attr); + iattr_to_fattr(attr, &inarg); req->in.h.opcode = FUSE_SETATTR; req->in.h.nodeid = get_node_id(inode); req->inode = inode; diff --git a/kernel/fuse_kernel.h b/kernel/fuse_kernel.h index 23f8315..48b60fc 100644 --- a/kernel/fuse_kernel.h +++ b/kernel/fuse_kernel.h @@ -42,7 +42,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 2 +#define FUSE_KERNEL_MINOR_VERSION 3 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -89,6 +89,7 @@ struct fuse_kstatfs { #define FATTR_SIZE (1 << 3) #define FATTR_ATIME (1 << 4) #define FATTR_MTIME (1 << 5) +#define FATTR_FH (1 << 6) /** * Flags returned by the OPEN request @@ -182,7 +183,20 @@ struct fuse_link_in { struct fuse_setattr_in { __u32 valid; __u32 padding; - struct fuse_attr attr; + __u64 fh; + __u64 size; + __u64 unused1; + __u64 atime; + __u64 mtime; + __u64 unused2; + __u32 atimensec; + __u32 mtimensec; + __u32 unused3; + __u32 mode; + __u32 unused4; + __u32 uid; + __u32 gid; + __u32 unused5; }; struct fuse_open_in { |