From b948c235b83e43441faeed257cfdffa2008326d9 Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Tue, 6 Apr 2021 13:48:48 -0700 Subject: fs,extension: Make truncate work on cached file content. We now remember the path of each cached file, so when someone truncates that path, we can truncate all open instances of it in cache. Important when someone pipes to stomp a file / opens with O_TRUNC (which FUSE disaggregates into an open() and then a truncate() call). Gets rid of the need for FUSE_CAP_ATOMIC_O_TRUNC, which never worked on macOS anyway. Fixes #40. --- fs/tabfs.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'fs') diff --git a/fs/tabfs.c b/fs/tabfs.c index a7936eb..c74becf 100644 --- a/fs/tabfs.c +++ b/fs/tabfs.c @@ -423,20 +423,6 @@ static int tabfs_mknod(const char *path, mode_t mode, dev_t rdev) { 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, @@ -455,8 +441,6 @@ static const struct fuse_operations tabfs_oper = { .mkdir = tabfs_mkdir, .mknod = tabfs_mknod, - - .init = tabfs_init, }; int main(int argc, char **argv) { -- cgit v1.2.3