diff options
-rw-r--r-- | lib/libfuse/fuse.c | 4 | ||||
-rw-r--r-- | lib/libfuse/fuse_ops.c | 38 | ||||
-rw-r--r-- | lib/libfuse/fuse_private.h | 3 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_lookup.c | 4 |
4 files changed, 28 insertions, 21 deletions
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c index 065c38c0cb7..d0551a84f0d 100644 --- a/lib/libfuse/fuse.c +++ b/lib/libfuse/fuse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse.c,v 1.44 2018/05/15 11:57:32 helg Exp $ */ +/* $OpenBSD: fuse.c,v 1.45 2018/05/22 12:52:14 helg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -86,7 +86,7 @@ static struct fuse_opt fuse_lib_opts[] = { FUSE_OPT_KEY("subtype=", KEY_STUB), FUSE_LIB_OPT("uid=", set_uid), FUSE_LIB_OPT("uid=%u", uid), - FUSE_OPT_KEY("use_ino", KEY_STUB), + FUSE_LIB_OPT("use_ino", use_ino), FUSE_OPT_KEY("dmask=%o", KEY_STUB), FUSE_OPT_KEY("fmask=%o", KEY_STUB), FUSE_LIB_OPT("umask=", set_mode), diff --git a/lib/libfuse/fuse_ops.c b/lib/libfuse/fuse_ops.c index 55097112291..609ef7569c8 100644 --- a/lib/libfuse/fuse_ops.c +++ b/lib/libfuse/fuse_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_ops.c,v 1.32 2018/05/21 11:47:46 helg Exp $ */ +/* $OpenBSD: fuse_ops.c,v 1.33 2018/05/22 12:52:14 helg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -44,7 +44,8 @@ update_attr(struct fuse *f, struct stat *attr, const char *realname, if (attr->st_blocks == 0) attr->st_blocks = 4; - attr->st_ino = vn->ino; + if (!f->conf.use_ino) + attr->st_ino = vn->ino; if (f->conf.set_mode) attr->st_mode = (attr->st_mode & S_IFMT) | (0777 & ~f->conf.umask); @@ -248,20 +249,24 @@ ifuse_fill_readdir(void *dh, const char *name, const struct stat *stbuf, dir = (struct dirent *) &fbuf->fb_dat[fbuf->fb_len]; - /* - * This always behaves as if readdir_ino option is set so getcwd(3) - * works. - */ - v = get_vn_by_name_and_parent(f, (uint8_t *)name, fbuf->fb_ino); - if (v == NULL) { - if (strcmp(name, ".") == 0) - dir->d_fileno = fbuf->fb_ino; - else - dir->d_fileno = 0xffffffff; - } else - dir->d_fileno = v->ino; + if (stbuf != NULL && f->conf.use_ino) + dir->d_fileno = stbuf->st_ino; + else { + /* + * This always behaves as if readdir_ino option is set so + * getcwd(3) works. + */ + v = get_vn_by_name_and_parent(f, (uint8_t *)name, fbuf->fb_ino); + if (v == NULL) { + if (strcmp(name, ".") == 0) + dir->d_fileno = fbuf->fb_ino; + else + dir->d_fileno = 0xffffffff; + } else + dir->d_fileno = v->ino; + } - if (stbuf) + if (stbuf != NULL) dir->d_type = IFTODT(stbuf->st_mode); else dir->d_type = DT_UNKNOWN; @@ -501,6 +506,7 @@ ifuse_ops_lookup(struct fuse *f, struct fusebuf *fbuf) } fbuf->fb_err = update_attr(f, &fbuf->fb_attr, realname, vn); + fbuf->fb_ino = vn->ino; free(fbuf->fb_dat); free(realname); @@ -1034,7 +1040,7 @@ ifuse_ops_mknod(struct fuse *f, struct fusebuf *fbuf) if (!fbuf->fb_err) { fbuf->fb_err = update_attr(f, &fbuf->fb_attr, realname, vn); fbuf->fb_io_mode = fbuf->fb_attr.st_mode; - fbuf->fb_ino = fbuf->fb_attr.st_ino; + fbuf->fb_ino = vn->ino; } free(realname); diff --git a/lib/libfuse/fuse_private.h b/lib/libfuse/fuse_private.h index 7a5a3045893..7dc01b28394 100644 --- a/lib/libfuse/fuse_private.h +++ b/lib/libfuse/fuse_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_private.h,v 1.18 2018/05/16 13:09:17 helg Exp $ */ +/* $OpenBSD: fuse_private.h,v 1.19 2018/05/22 12:52:14 helg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -80,6 +80,7 @@ struct fuse_config { int set_mode; int set_uid; int set_gid; + int use_ino; }; struct fuse_core_opts { diff --git a/sys/miscfs/fuse/fuse_lookup.c b/sys/miscfs/fuse/fuse_lookup.c index e95ff4eefd6..3210dd09546 100644 --- a/sys/miscfs/fuse/fuse_lookup.c +++ b/sys/miscfs/fuse/fuse_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_lookup.c,v 1.19 2018/05/02 02:24:56 visa Exp $ */ +/* $OpenBSD: fuse_lookup.c,v 1.20 2018/05/22 12:52:14 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -111,7 +111,7 @@ fusefs_lookup(void *v) return (ENOENT); } - nid = fbuf->fb_attr.st_ino; + nid = fbuf->fb_ino; nvtype = IFTOVT(fbuf->fb_attr.st_mode); fb_delete(fbuf); } |