Control: tags -1 patch
Please find a patch attached.
From: Bastian Germann <[email protected]> Subject: Port to fuse3 --- diff --git a/configure.ac b/configure.ac index 1a89d69..7ca9c8c 100644 --- a/configure.ac +++ b/configure.ac @@ -17,14 +17,8 @@ AC_SUBST([regular_CFLAGS]) AC_CHECK_HEADERS([attr/xattr.h sys/xattr.h]) -# FUSE >= 2.7.0 got subtype name support. -# 2.6.5 does not, but has a similar thing. -PKG_CHECK_MODULES([libfuse], [fuse >= 2.7.0], [], [ - PKG_CHECK_MODULES([libfuse], [fuse >= 2.6.5], [ - AC_DEFINE([HAVE_JUST_FUSE_2_6_5], [1], - [Define if you have a FUSE version >= 2.6.5 but < 2.7.0]) - ]) -]) +# FUSE >= 3.0 +PKG_CHECK_MODULES([libfuse], [fuse3 >= 3.0]) # Minium requirements for utimensat(): Linux 2.6.22-rc1 and Glibc 2.6 AC_MSG_CHECKING([for utimensat()]) diff --git a/posixovl.c b/posixovl.c index a119ce4..90d9527 100644 --- a/posixovl.c +++ b/posixovl.c @@ -11,7 +11,7 @@ */ #define _ATFILE_SOURCE 1 #define _GNU_SOURCE 1 -#define FUSE_USE_VERSION 26 +#define FUSE_USE_VERSION 31 #include "config.h" #include <sys/fsuid.h> #include <sys/stat.h> @@ -876,7 +876,8 @@ static char *xfrm_from_disk(const char *read_ptr) return out; } -static int posixovl_chmod(const char *path, mode_t mode) +static int posixovl_chmod(const char *path, mode_t mode, + struct fuse_file_info *filp) { struct hcb info; int ret; @@ -899,15 +900,17 @@ static int posixovl_chmod(const char *path, mode_t mode) return hcb_update(&info); } -static int posixovl1_chmod(const char *path, mode_t mode) +static int posixovl1_chmod(const char *path, mode_t mode, + struct fuse_file_info *filp) { char *xpath = xfrm_to_disk(path); - int ret = posixovl_chmod(xpath, mode); + int ret = posixovl_chmod(xpath, mode, filp); free(xpath); return ret; } -static int posixovl_chown(const char *path, uid_t uid, gid_t gid) +static int posixovl_chown(const char *path, uid_t uid, gid_t gid, + struct fuse_file_info *filp) { struct hcb info; int ret; @@ -933,10 +936,11 @@ static int posixovl_chown(const char *path, uid_t uid, gid_t gid) return hcb_update(&info); } -static int posixovl1_chown(const char *path, uid_t uid, gid_t gid) +static int posixovl1_chown(const char *path, uid_t uid, gid_t gid, + struct fuse_file_info *filp) { char *xpath = xfrm_to_disk(path); - int ret = posixovl_chown(xpath, uid, gid); + int ret = posixovl_chown(xpath, uid, gid, filp); free(xpath); return ret; } @@ -1026,12 +1030,6 @@ static int posixovl1_create(const char *path, mode_t mode, return ret; } -static int posixovl_ftruncate(const char *path, off_t length, - struct fuse_file_info *filp) -{ - return retcode_int(ftruncate(filp->fh, length)); -} - /** * hl_demote - collapse S_IFHARDLNK into normal file * @l0_file: @@ -1101,7 +1099,8 @@ static int hl_try_demote(const char *path) return hl_demote(path, info_l0.path, info_l0.ll.target, info_l1.path); } -static int posixovl_getattr(const char *path, struct stat *sb) +static int posixovl_getattr(const char *path, struct stat *sb, + struct fuse_file_info *filp) { struct hcb info; int ret; @@ -1115,10 +1114,11 @@ static int posixovl_getattr(const char *path, struct stat *sb) return 0; } -static int posixovl1_getattr(const char *path, struct stat *sb) +static int posixovl1_getattr(const char *path, struct stat *sb, + struct fuse_file_info *filp) { char *xpath = xfrm_to_disk(path); - int ret = posixovl_getattr(xpath, sb); + int ret = posixovl_getattr(xpath, sb, filp); free(xpath); return ret; } @@ -1129,18 +1129,14 @@ static int posixovl_getxattr(const char *path, const char *name, return retcode_int(lgetxattr(at(path), name, value, size)); } -static int posixovl1_fgetattr(const char *path, struct stat *sb, - struct fuse_file_info *filp) +static void *posixovl_init(struct fuse_conn_info *conn, + struct fuse_config *cfg) { /* - * Need to use the normal getattr because we need to check for the - * HCB too, not just @filp->fh. + * Honor the inode numbers provided by getattr()/fill_dir(), + * like the old "-o use_ino" mount option did with FUSE 2. */ - return posixovl1_getattr(path, sb); -} - -static void *posixovl_init(struct fuse_conn_info *conn) -{ + cfg->use_ino = 1; /* * There is no fopendirat(), we need to use fchdir() and * opendir(relative_path) instead. @@ -1574,7 +1570,8 @@ static int posixovl_read(const char *path, char *buffer, size_t size, } static int posixovl_readdir(const char *path, void *buffer, - fuse_fill_dir_t filldir, off_t offset, struct fuse_file_info *filp) + fuse_fill_dir_t filldir, off_t offset, struct fuse_file_info *filp, + enum fuse_readdir_flags flags) { const struct dirent *dentry; struct hcb info; @@ -1599,7 +1596,7 @@ static int posixovl_readdir(const char *path, void *buffer, break; ret = 0; x = xfrm_from_disk((char *)dentry->d_name); - if ((*filldir)(buffer, x, &info.sb, 0) > 0) + if ((*filldir)(buffer, x, &info.sb, 0, 0) > 0) break; free(x); } @@ -1609,10 +1606,12 @@ static int posixovl_readdir(const char *path, void *buffer, } static int posixovl1_readdir(const char *path, void *buffer, - fuse_fill_dir_t filldir, off_t offset, struct fuse_file_info *filp) + fuse_fill_dir_t filldir, off_t offset, struct fuse_file_info *filp, + enum fuse_readdir_flags flags) { char *xpath = xfrm_to_disk(path); - int ret = posixovl_readdir(xpath, buffer, filldir, offset, filp); + int ret = posixovl_readdir(xpath, buffer, filldir, offset, filp, + flags); free(xpath); return ret; } @@ -1659,7 +1658,8 @@ static int posixovl_removexattr(const char *path, const char *name) return retcode_int(lremovexattr(path, name)); } -static int posixovl_rename(const char *oldpath, const char *newpath) +static int posixovl_rename(const char *oldpath, const char *newpath, + unsigned int flags) { char new_hcbpath[PATH_MAX]; struct hcb old_info; @@ -1671,6 +1671,8 @@ static int posixovl_rename(const char *oldpath, const char *newpath) return -EPERM; if (could_be_too_long(newpath)) return -ENAMETOOLONG; + if (flags != 0) + return -ENOSYS; ret = hcb_lookup(oldpath, &old_info); if (ret == -ENOENT_HCB || S_ISDIR(old_info.sb.st_mode)) @@ -1707,11 +1709,12 @@ static int posixovl_rename(const char *oldpath, const char *newpath) return 0; } -static int posixovl1_rename(const char *oldpath, const char *newpath) +static int posixovl1_rename(const char *oldpath, const char *newpath, + unsigned int flags) { char *xoldpath = xfrm_to_disk(oldpath); char *xnewpath = xfrm_to_disk(newpath); - int ret = posixovl_rename(xoldpath, xnewpath); + int ret = posixovl_rename(xoldpath, xnewpath, flags); free(xoldpath); free(xnewpath); return ret; @@ -1803,7 +1806,8 @@ static int posixovl1_symlink(const char *oldpath, const char *newpath) return ret; } -static int posixovl_truncate(const char *path, off_t length) +static int posixovl_truncate(const char *path, off_t length, + struct fuse_file_info *filp) { struct hcb info; int fd, ret; @@ -1845,10 +1849,11 @@ static int posixovl_truncate(const char *path, off_t length) return ret; } -static int posixovl1_truncate(const char *path, off_t len) +static int posixovl1_truncate(const char *path, off_t len, + struct fuse_file_info *filp) { char *xpath = xfrm_to_disk(path); - int ret = posixovl_truncate(xpath, len); + int ret = posixovl_truncate(xpath, len, filp); free(xpath); return ret; } @@ -1891,7 +1896,8 @@ static int posixovl1_unlink(const char *path) return ret; } -static int posixovl_utimens(const char *path, const struct timespec *ts) +static int posixovl_utimens(const char *path, const struct timespec *ts, + struct fuse_file_info *filp) { struct hcb info; int ret; @@ -1935,10 +1941,11 @@ static int posixovl_utimens(const char *path, const struct timespec *ts) return retcode_int(ret); } -static int posixovl1_utimens(const char *path, const struct timespec *ts) +static int posixovl1_utimens(const char *path, const struct timespec *ts, + struct fuse_file_info *filp) { char *xpath = xfrm_to_disk(path); - int ret = posixovl_utimens(xpath, ts); + int ret = posixovl_utimens(xpath, ts, filp); free(xpath); return ret; } @@ -1973,8 +1980,6 @@ static const struct fuse_operations posixovl_ops = { .chmod = posixovl1_chmod, .chown = posixovl1_chown, .create = posixovl1_create, - .fgetattr = posixovl1_fgetattr, - .ftruncate = posixovl_ftruncate, .getattr = posixovl1_getattr, .getxattr = posixovl_getxattr, .init = posixovl_init, @@ -2057,15 +2062,9 @@ int main(int argc, char **argv) new_argv = malloc(sizeof(char *) * (argc + 7 - optind)); new_argv[new_argc++] = argv[0]; -#ifdef HAVE_JUST_FUSE_2_6_5 snprintf(xargs, sizeof(xargs), - "-oattr_timeout=0,default_permissions,use_ino,nonempty,dev," - "fsname=posix-overlay(%s)", root_dir); -#else - snprintf(xargs, sizeof(xargs), - "-oattr_timeout=0,default_permissions,use_ino,nonempty,dev," + "-oattr_timeout=0,default_permissions,dev," "fsname=posix-overlay(%s),subtype=posixovl", root_dir); -#endif new_argv[new_argc++] = xargs; if (user_allow_other())

