aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-10-26 16:04:04 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-10-26 16:04:04 +0000
commit11509ce3fc6a36b6e3c094bf8aa11820f17d0ede (patch)
tree7b7584927fab4174852d5c650834326e3f7a8a37 /include
parentd9079a75b14b73e7953adf4958709b1e5ab3804c (diff)
add ftruncate() method
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h20
-rw-r--r--include/fuse_lowlevel.h12
2 files changed, 28 insertions, 4 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 290e9d3..6d7e54b 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -63,9 +63,9 @@ typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
*
* All methods are optional, but some are essential for a useful
* filesystem (e.g. getattr). Open, flush, release, fsync, opendir,
- * releasedir, fsyncdir, access, create, init and destroy are special
- * purpose methods, without which a full featured filesystem can still
- * be implemented.
+ * releasedir, fsyncdir, access, create, ftruncate, init and destroy
+ * are special purpose methods, without which a full featured
+ * filesystem can still be implemented.
*/
struct fuse_operations {
/** Get file attributes.
@@ -324,6 +324,20 @@ struct fuse_operations {
* Introduced in version 2.5
*/
int (*create) (const char *, mode_t, struct fuse_file_info *);
+
+ /**
+ * Change the size of an open file
+ *
+ * This method is called instead of the truncate() method if the
+ * truncation was invoked from an ftruncate() system call.
+ *
+ * If this method is not implemented or under Linux kernel
+ * versions earlier than 2.6.15, the truncate() method will be
+ * called instead.
+ *
+ * Introduced in version 2.5
+ */
+ int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
};
/** Extra context that may be needed by some filesystems
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index e9c64ce..a027163 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -198,6 +198,13 @@ struct fuse_lowlevel_ops {
* bitmask contain valid values. Other members contain undefined
* values.
*
+ * If the setattr was invoked from the ftruncate() system call
+ * under Linux kernel versions 2.6.15 or later, the fi->fh will
+ * contain the value set by the open method or will be undefined
+ * if the open method didn't set any value. Otherwise (not
+ * ftruncate call, or kernel version earlier than 2.6.15) the fi
+ * parameter will be NULL.
+ *
* Valid replies:
* fuse_reply_attr()
* fuse_reply_err()
@@ -206,7 +213,10 @@ struct fuse_lowlevel_ops {
* @param ino the inode number
* @param attr the attributes
* @param to_set bit mask of attributes which should be set
- * @param fi for future use, currently always NULL
+ * @param fi file information, or NULL
+ *
+ * Changed in version 2.5:
+ * file information filled in for ftruncate
*/
void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
int to_set, struct fuse_file_info *fi);