diff options
Diffstat (limited to 'fs/tabfs.c')
-rw-r--r-- | fs/tabfs.c | 34 |
1 files changed, 26 insertions, 8 deletions
@@ -261,7 +261,7 @@ static int tabfs_open(const char *path, struct fuse_file_info *fi) { "open", path, fi->flags); parse_and_free_response(data, size, - "fh: %d", + "fh: %llu", &fi->fh); return 0; @@ -275,7 +275,7 @@ static int tabfs_read(const char *path, char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, size: %d, offset: %d, fh: %d, flags: %d", + "op: %Q, path: %Q, size: %d, offset: %lld, fh: %llu, flags: %d", "read", path, size, offset, fi->fh, fi->flags); char *scan_buf; int scan_len; @@ -298,7 +298,7 @@ static int tabfs_write(const char *path, char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, buf: %V, offset: %d, fh: %d, flags: %d", + "op: %Q, path: %Q, buf: %V, offset: %lld, fh: %llu, flags: %d", "write", path, data, size, offset, fi->fh, fi->flags); int ret; @@ -313,7 +313,7 @@ static int tabfs_release(const char *path, struct fuse_file_info *fi) { char *data; size_t size; exchange_json(&data, &size, - "op: %Q, path: %Q, fh: %d", + "op: %Q, path: %Q, fh: %llu", "release", path, fi->fh); parse_and_free_response(data, size, ""); @@ -329,7 +329,7 @@ static int tabfs_opendir(const char *path, struct fuse_file_info *fi) { "opendir", path, fi->flags); parse_and_free_response(rdata, rsize, - "fh: %d", + "fh: %llu", &fi->fh); return 0; @@ -345,7 +345,7 @@ static int tabfs_readdir(const char *path, char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, offset: %d", + "op: %Q, path: %Q, offset: %lld", "readdir", path, offset); struct json_token t; @@ -365,7 +365,7 @@ static int tabfs_releasedir(const char *path, struct fuse_file_info *fi) { char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, fh: %d", + "op: %Q, path: %Q, fh: %llu", "releasedir", path, fi->fh); parse_and_free_response(rdata, rsize, ""); @@ -377,7 +377,7 @@ static int tabfs_truncate(const char *path, off_t size) { char *rdata; size_t rsize; exchange_json(&rdata, &rsize, - "op: %Q, path: %Q, size: %d", + "op: %Q, path: %Q, size: %lld", "truncate", path, size); parse_and_free_response(rdata, rsize, ""); @@ -423,6 +423,20 @@ static int tabfs_create(const char *path, mode_t mode, struct fuse_file_info *fi return 0; } +#define want_capability(conn, flag) \ + do { \ + if (conn->capable & flag) { \ + conn->want |= flag; \ + } else { \ + eprintln("warning: " #flag " not supported"); \ + } \ + } while (0) + +static void *tabfs_init(struct fuse_conn_info *conn) { + want_capability(conn, FUSE_CAP_ATOMIC_O_TRUNC); + return NULL; +} + static const struct fuse_operations tabfs_oper = { .getattr = tabfs_getattr, .readlink = tabfs_readlink, @@ -441,6 +455,8 @@ static const struct fuse_operations tabfs_oper = { .mkdir = tabfs_mkdir, .create = tabfs_create, + + .init = tabfs_init, }; int main(int argc, char **argv) { @@ -479,8 +495,10 @@ int main(int argc, char **argv) { argv[0], "-f", #if !defined(__APPLE__) +#if !defined(__FreeBSD__) "-oauto_unmount", #endif +#endif "-odirect_io", getenv("TABFS_MOUNT_DIR"), NULL, |