diff options
author | Martin Natano <natano@cvs.openbsd.org> | 2016-08-21 09:23:34 +0000 |
---|---|---|
committer | Martin Natano <natano@cvs.openbsd.org> | 2016-08-21 09:23:34 +0000 |
commit | f27a5f7ed3aa93bab22c772ad9f9cea44ec16214 (patch) | |
tree | 3a143d7dc60079271fe8022c716d71642d3e5d12 | |
parent | c70f39bfe1cec5fc31aa0a07c334b7b3d24b3c5c (diff) |
There are three callers of update_vattr(). Two of them don't use the
updated struct vattr afterwards, so the call can be removed. Remove both
calls and the function itself, inlining the last remaining call.
ok millert
-rw-r--r-- | sys/miscfs/fuse/fuse_lookup.c | 10 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_vnops.c | 25 | ||||
-rw-r--r-- | sys/miscfs/fuse/fusefs.h | 3 |
3 files changed, 11 insertions, 27 deletions
diff --git a/sys/miscfs/fuse/fuse_lookup.c b/sys/miscfs/fuse/fuse_lookup.c index ca93c59d186..a0d2fc49aa6 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.13 2016/08/16 21:32:58 natano Exp $ */ +/* $OpenBSD: fuse_lookup.c,v 1.14 2016/08/21 09:23:33 natano Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -174,15 +174,11 @@ fusefs_lookup(void *v) error = 0; } else { error = VFS_VGET(fmp->mp, nid, &tdp); - - if (!error) - tdp->v_type = IFTOVT(fbuf->fb_vattr.va_mode); - - update_vattr(fmp->mp, &fbuf->fb_vattr); - if (error) goto out; + tdp->v_type = IFTOVT(fbuf->fb_vattr.va_mode); + if (vdp != NULL && vdp->v_type == VDIR) VTOI(tdp)->parent = dp->ufs_ino.i_number; diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index c73c2e797fe..496729bb9a9 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.30 2016/08/16 21:32:58 natano Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.31 2016/08/21 09:23:33 natano Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -203,19 +203,6 @@ filt_fusefsvnode(struct knote *kn, long int hint) return (kn->kn_fflags != 0); } -void -update_vattr(struct mount *mp, struct vattr *v) -{ - v->va_fsid = mp->mnt_stat.f_fsid.val[0]; - v->va_type = IFTOVT(v->va_mode); -#if (S_BLKSIZE == 512) - v->va_bytes = v->va_bytes << 9; -#else - v->va_bytes = v->va_bytes * S_BLKSIZE; -#endif - v->va_mode = v->va_mode & ~S_IFMT; -} - int fusefs_open(void *v) { @@ -401,8 +388,13 @@ fusefs_getattr(void *v) return (error); } - update_vattr(fmp->mp, &fbuf->fb_vattr); memcpy(vap, &fbuf->fb_vattr, sizeof(*vap)); + + vap->va_fsid = fmp->mp->mnt_stat.f_fsid.val[0]; + vap->va_type = IFTOVT(vap->va_mode); + vap->va_bytes *= S_BLKSIZE; + vap->va_mode &= ~S_IFMT; + fb_delete(fbuf); return (error); } @@ -518,15 +510,12 @@ fusefs_setattr(void *v) } error = fb_queue(fmp->dev, fbuf); - if (error) { if (error == ENOSYS) fmp->undef_op |= UNDEF_SETATTR; goto out; } - update_vattr(fmp->mp, &fbuf->fb_vattr); - memcpy(vap, &fbuf->fb_vattr, sizeof(*vap)); VN_KNOTE(ap->a_vp, NOTE_ATTRIB); out: diff --git a/sys/miscfs/fuse/fusefs.h b/sys/miscfs/fuse/fusefs.h index 5b7027cbb00..2b96e3c168a 100644 --- a/sys/miscfs/fuse/fusefs.h +++ b/sys/miscfs/fuse/fusefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusefs.h,v 1.7 2014/05/20 13:32:22 syl Exp $ */ +/* $OpenBSD: fusefs.h,v 1.8 2016/08/21 09:23:33 natano Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -72,7 +72,6 @@ extern struct pool fusefs_fbuf_pool; /* fuse helpers */ #define TSLEEP_TIMEOUT 5 -void update_vattr(struct mount *mp, struct vattr *v); /* files helpers. */ int fusefs_file_open(struct fusefs_mnt *, struct fusefs_node *, enum fufh_type, |