CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: skrll Date: Sun Aug 27 06:18:16 UTC 2017 Modified Files: src/sys/fs/v7fs: v7fs_io_kern.c Log Message: Remove some unnecessary duplicatioN To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_io_kern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_io_kern.c diff -u src/sys/fs/v7fs/v7fs_io_kern.c:1.4 src/sys/fs/v7fs/v7fs_io_kern.c:1.5 --- src/sys/fs/v7fs/v7fs_io_kern.c:1.4 Thu Jun 1 02:45:13 2017 +++ src/sys/fs/v7fs/v7fs_io_kern.c Sun Aug 27 06:18:16 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_io_kern.c,v 1.4 2017/06/01 02:45:13 chs Exp $ */ +/* $NetBSD: v7fs_io_kern.c,v 1.5 2017/08/27 06:18:16 skrll Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,13 +30,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: v7fs_io_kern.c,v 1.4 2017/06/01 02:45:13 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: v7fs_io_kern.c,v 1.5 2017/08/27 06:18:16 skrll Exp $"); + #if defined _KERNEL_OPT #include "opt_v7fs.h" #endif -#include - -__KERNEL_RCSID(0, "$NetBSD: v7fs_io_kern.c,v 1.4 2017/06/01 02:45:13 chs Exp $"); #include #include
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: hannken Date: Sat Apr 8 08:51:02 UTC 2017 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Update mtime when updating file size. PR kern/51762 (mtime not updated by open(O_TRUNC)) To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.22 src/sys/fs/v7fs/v7fs_vnops.c:1.23 --- src/sys/fs/v7fs/v7fs_vnops.c:1.22 Sat Aug 20 12:37:08 2016 +++ src/sys/fs/v7fs/v7fs_vnops.c Sat Apr 8 08:51:02 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.22 2016/08/20 12:37:08 hannken Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.23 2017/04/08 08:51:02 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.22 2016/08/20 12:37:08 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.23 2017/04/08 08:51:02 hannken Exp $"); #if defined _KERNEL_OPT #include "opt_v7fs.h" #endif @@ -499,8 +499,11 @@ v7fs_setattr(void *v) /* File size change. */ if ((vap->va_size != VNOVAL) && (vp->v_type == VREG)) { error = v7fs_datablock_size_change(fs, vap->va_size, inode); - if (error == 0) + if (error == 0) { uvm_vnp_setsize(vp, vap->va_size); + v7node->update_mtime = true; + v7node->update_ctime = true; + } } uid_t uid = inode->uid; gid_t gid = inode->gid;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: hannken Date: Mon Dec 29 15:28:08 UTC 2014 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL. Should fix the v7fs part of PR kern/48864. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.17 src/sys/fs/v7fs/v7fs_vnops.c:1.18 --- src/sys/fs/v7fs/v7fs_vnops.c:1.17 Fri Aug 8 19:15:33 2014 +++ src/sys/fs/v7fs/v7fs_vnops.c Mon Dec 29 15:28:08 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -421,6 +421,11 @@ v7fs_getattr(void *v) vap-va_fsid = v7fsmount-devvp-v_rdev; vap-va_fileid = inode-inode_number; vap-va_size = vp-v_size; + if (vp-v_type == VLNK) { + /* Ajust for trailing NUL. */ + KASSERT(vap-va_size 0); + vap-va_size -= 1; + } vap-va_atime.tv_sec = inode-atime; vap-va_mtime.tv_sec = inode-mtime; vap-va_ctime.tv_sec = inode-ctime;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: hannken Date: Mon Dec 29 15:28:58 UTC 2014 Modified Files: src/sys/fs/v7fs: v7fs_file.c v7fs_vfsops.c v7fs_vnops.c Log Message: Defer deallocating unlinked inodes to v7fs_reclaim(). Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need to search for a vnode we already hold a reference on. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/fs/v7fs/v7fs_file.c cvs rdiff -u -r1.10 -r1.11 src/sys/fs/v7fs/v7fs_vfsops.c cvs rdiff -u -r1.18 -r1.19 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_file.c diff -u src/sys/fs/v7fs/v7fs_file.c:1.5 src/sys/fs/v7fs/v7fs_file.c:1.6 --- src/sys/fs/v7fs/v7fs_file.c:1.5 Fri Dec 7 06:50:15 2012 +++ src/sys/fs/v7fs/v7fs_file.c Mon Dec 29 15:28:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file.c,v 1.5 2012/12/07 06:50:15 msaitoh Exp $ */ +/* $NetBSD: v7fs_file.c,v 1.6 2014/12/29 15:28:58 hannken Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.5 2012/12/07 06:50:15 msaitoh Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.6 2014/12/29 15:28:58 hannken Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -259,6 +259,9 @@ v7fs_file_deallocate(struct v7fs_self *f DPRINTF(directory not empty.\n); return ENOTEMPTY;/* t_vnops dir_noempty, rename_dir(6)*/ } + error = v7fs_datablock_size_change(fs, 0, inode); + if (error) + return error; inode.nlink = 0; /* remove this. */ } else { /* Decrement reference count. */ @@ -271,14 +274,7 @@ v7fs_file_deallocate(struct v7fs_self *f return error; DPRINTF(remove dirent\n); - if (inode.nlink == 0) { - v7fs_datablock_contract(fs, inode, inode.filesize); - DPRINTF(remove datablock\n); - v7fs_inode_deallocate(fs, ino); - DPRINTF(remove inode\n); - } else { - v7fs_inode_writeback(fs, inode); - } + v7fs_inode_writeback(fs, inode); return 0; } Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.10 src/sys/fs/v7fs/v7fs_vfsops.c:1.11 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.10 Wed Apr 16 18:55:19 2014 +++ src/sys/fs/v7fs/v7fs_vfsops.c Mon Dec 29 15:28:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.10 2014/04/16 18:55:19 maxv Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.10 2014/04/16 18:55:19 maxv Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -74,7 +74,6 @@ static int v7fs_openfs(struct vnode *, s static void v7fs_closefs(struct vnode *, struct mount *); static int is_v7fs_partition(struct vnode *); static enum vtype v7fs_mode_to_vtype(v7fs_mode_t mode); -int v7fs_vnode_reload(struct mount *, struct vnode *); int v7fs_mount(struct mount *mp, const char *path, void *data, size_t *data_len) @@ -586,34 +585,3 @@ v7fs_mountroot(void) return 0; } - -/* Reload disk inode information */ -int -v7fs_vnode_reload(struct mount *mp, struct vnode *vp) -{ - struct v7fs_mount *v7fsmount = mp-mnt_data; - struct v7fs_self *fs = v7fsmount-core; - struct v7fs_node *v7fs_node; - struct v7fs_inode *inode = ((struct v7fs_node *)vp-v_data)-inode; - int target_ino = inode-inode_number; - int error = 0; - - DPRINTF(#%d\n, target_ino); - mutex_enter(mntvnode_lock); - for (v7fs_node = LIST_FIRST(v7fsmount-v7fs_node_head); - v7fs_node != NULL; v7fs_node = LIST_NEXT(v7fs_node, link)) { - inode = v7fs_node-inode; - if (!v7fs_inode_allocated(inode)) { - continue; - } - if (inode-inode_number == target_ino) { - error = v7fs_inode_load(fs, v7fs_node-inode, - target_ino); - DPRINTF(sync #%d error=%d\n, target_ino, error); - break; - } - } - mutex_exit(mntvnode_lock); - - return error; -} Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.18 src/sys/fs/v7fs/v7fs_vnops.c:1.19 --- src/sys/fs/v7fs/v7fs_vnops.c:1.18 Mon Dec 29 15:28:08 2014 +++ src/sys/fs/v7fs/v7fs_vnops.c Mon Dec 29 15:28:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.19 2014/12/29 15:28:58 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.18 2014/12/29 15:28:08 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.19 2014/12/29 15:28:58 hannken Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -64,8 +64,6 @@ __KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c #define DPRINTF(arg...) ((void)0) #endif -int v7fs_vnode_reload(struct mount *, struct
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: hannken Date: Mon Dec 29 15:29:38 UTC 2014 Modified Files: src/sys/fs/v7fs: v7fs_extern.c v7fs_extern.h v7fs_vfsops.c v7fs_vnops.c Log Message: Change v7fs to vcache. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_extern.c cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_extern.h cvs rdiff -u -r1.11 -r1.12 src/sys/fs/v7fs/v7fs_vfsops.c cvs rdiff -u -r1.19 -r1.20 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_extern.c diff -u src/sys/fs/v7fs/v7fs_extern.c:1.3 src/sys/fs/v7fs/v7fs_extern.c:1.4 --- src/sys/fs/v7fs/v7fs_extern.c:1.3 Fri Jul 25 08:20:52 2014 +++ src/sys/fs/v7fs/v7fs_extern.c Mon Dec 29 15:29:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_extern.c,v 1.3 2014/07/25 08:20:52 dholland Exp $ */ +/* $NetBSD: v7fs_extern.c,v 1.4 2014/12/29 15:29:38 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_extern.c,v 1.3 2014/07/25 08:20:52 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_extern.c,v 1.4 2014/12/29 15:29:38 hannken Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h @@ -235,6 +235,7 @@ struct vfsops v7fs_vfsops = { .vfs_statvfs = v7fs_statvfs, .vfs_sync = v7fs_sync, .vfs_vget = v7fs_vget, + .vfs_loadvnode = v7fs_loadvnode, .vfs_fhtovp = v7fs_fhtovp, .vfs_vptofh = v7fs_vptofh, .vfs_init = v7fs_init, Index: src/sys/fs/v7fs/v7fs_extern.h diff -u src/sys/fs/v7fs/v7fs_extern.h:1.1 src/sys/fs/v7fs/v7fs_extern.h:1.2 --- src/sys/fs/v7fs/v7fs_extern.h:1.1 Mon Jun 27 11:52:24 2011 +++ src/sys/fs/v7fs/v7fs_extern.h Mon Dec 29 15:29:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_extern.h,v 1.1 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: v7fs_extern.h,v 1.2 2014/12/29 15:29:38 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -46,7 +46,6 @@ struct v7fs_mount { struct mount *mountp; struct vnode *devvp; /* block device mounted vnode */ struct v7fs_self *core; /* filesystem dependent implementation*/ - LIST_HEAD(, v7fs_node) v7fs_node_head; }; struct v7fs_node { @@ -59,8 +58,6 @@ struct v7fs_node { int update_ctime; int update_atime; int update_mtime; - - LIST_ENTRY(v7fs_node) link; }; #define VFSTOV7FS(mp) ((struct v7fs_mount *)((mp)-mnt_data)) Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.11 src/sys/fs/v7fs/v7fs_vfsops.c:1.12 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.11 Mon Dec 29 15:28:58 2014 +++ src/sys/fs/v7fs/v7fs_vfsops.c Mon Dec 29 15:29:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.12 2014/12/29 15:29:38 hannken Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.11 2014/12/29 15:28:58 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.12 2014/12/29 15:29:38 hannken Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -273,8 +273,6 @@ v7fs_mountfs(struct vnode *devvp, struct goto err_exit; } - LIST_INIT(v7fsmount-v7fs_node_head); - mp-mnt_data = v7fsmount; mp-mnt_stat.f_fsidx.__fsid_val[0] = (long)devvp-v_rdev; mp-mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_V7FS); @@ -368,47 +366,46 @@ v7fs_statvfs(struct mount *mp, struct st return 0; } +static bool +v7fs_sync_selector(void *cl, struct vnode *vp) +{ + struct v7fs_node *v7fs_node = vp-v_data; + + if (v7fs_node == NULL) + return false; + if (!v7fs_inode_allocated(v7fs_node-inode)) + return false; + + return true; +} + int v7fs_sync(struct mount *mp, int waitfor, kauth_cred_t cred) { struct v7fs_mount *v7fsmount = mp-mnt_data; struct v7fs_self *fs = v7fsmount-core; - struct v7fs_node *v7fs_node; - struct v7fs_inode *inode; - struct vnode *v; + struct vnode_iterator *marker; + struct vnode *vp; int err, error; - int retry_cnt; DPRINTF(\n); v7fs_superblock_writeback(fs); - for (retry_cnt = 0; retry_cnt 2; retry_cnt++) { - error = 0; - - mutex_enter(mntvnode_lock); - for (v7fs_node = LIST_FIRST(v7fsmount-v7fs_node_head); - v7fs_node != NULL; v7fs_node = LIST_NEXT(v7fs_node, link)) { - inode = v7fs_node-inode; - if (!v7fs_inode_allocated(inode)) { -continue; - } - v = v7fs_node-vnode; - mutex_enter(v-v_interlock); - mutex_exit(mntvnode_lock); - err = vget(v, LK_EXCLUSIVE | LK_NOWAIT); - if (err == 0) { -err = VOP_FSYNC(v, cred, FSYNC_WAIT, 0, 0); -vput(v); - } - if (err != 0) -error = err; - mutex_enter(mntvnode_lock); + error = 0; + vfs_vnode_iterator_init(mp, marker); + while ((vp = vfs_vnode_iterator_next(marker, + v7fs_sync_selector, NULL)) != NULL) { + err = vn_lock(vp, LK_EXCLUSIVE); + if (err) { + vrele(vp); +
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: gson Date: Fri Aug 8 19:15:33 UTC 2014 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Whitespace fix To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.16 src/sys/fs/v7fs/v7fs_vnops.c:1.17 --- src/sys/fs/v7fs/v7fs_vnops.c:1.16 Fri Feb 7 15:29:22 2014 +++ src/sys/fs/v7fs/v7fs_vnops.c Fri Aug 8 19:15:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.16 2014/02/07 15:29:22 hannken Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.16 2014/02/07 15:29:22 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.17 2014/08/08 19:15:33 gson Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -587,7 +587,7 @@ v7fs_read(void *v) } v7node-update_atime = true; - return error; + return error; } int
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: rmind Date: Wed Nov 20 23:44:23 UTC 2013 Modified Files: src/sys/fs/v7fs: v7fs_io_kern.c v7fs_vfsops.c v7fs_vnops.c Log Message: v7fs: replace malloc(9) with kmem(9), fix a memory leak and few missing mutex destruction cases in the error path. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_io_kern.c cvs rdiff -u -r1.7 -r1.8 src/sys/fs/v7fs/v7fs_vfsops.c cvs rdiff -u -r1.12 -r1.13 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_io_kern.c diff -u src/sys/fs/v7fs/v7fs_io_kern.c:1.1 src/sys/fs/v7fs/v7fs_io_kern.c:1.2 --- src/sys/fs/v7fs/v7fs_io_kern.c:1.1 Mon Jun 27 11:52:25 2011 +++ src/sys/fs/v7fs/v7fs_io_kern.c Wed Nov 20 23:44:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_io_kern.c,v 1.1 2011/06/27 11:52:25 uch Exp $ */ +/* $NetBSD: v7fs_io_kern.c,v 1.2 2013/11/20 23:44:23 rmind Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,19 +30,19 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.1 2011/06/27 11:52:25 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.2 2013/11/20 23:44:23 rmind Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.1 2011/06/27 11:52:25 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_io_kern.c,v 1.2 2013/11/20 23:44:23 rmind Exp $); #include sys/param.h #include sys/types.h #include sys/systm.h #include sys/buf.h -#include sys/malloc.h +#include sys/kmem.h #include sys/kauth.h #include sys/mutex.h @@ -69,8 +69,6 @@ static void v7fs_os_lock(void *); static void v7fs_os_unlock(void *); static bool lock_init(struct lock_ops *); -MALLOC_JUSTDEFINE(M_V7FS, v7fs core, v7fs internal structures); - int v7fs_io_init(struct v7fs_self **fs, const struct v7fs_mount_device *mount_device, size_t block_size) @@ -80,11 +78,8 @@ v7fs_io_init(struct v7fs_self **fs, struct local_io *local; int error = 0; - /* Allocate myself */ - if (!(p = (struct v7fs_self *)malloc(sizeof(*p), M_TEMP, M_WAITOK | - M_ZERO))) + if ((p = kmem_zalloc(sizeof(*p), KM_SLEEP)) == NULL) return ENOMEM; - memset(p, 0, sizeof(*p)); p-scratch_free = -1; p-scratch_remain = V7FS_SELF_NSCRATCH; @@ -95,8 +90,7 @@ v7fs_io_init(struct v7fs_self **fs, v7fs_endian_init(p); #endif /* IO */ - if (!(local = (struct local_io *)malloc(sizeof(*local), M_TEMP, - M_WAITOK | M_ZERO))) { + if ((local = kmem_zalloc(sizeof(*local), KM_SLEEP)) == NULL) { error = ENOMEM; goto errexit; } @@ -124,44 +118,41 @@ v7fs_io_init(struct v7fs_self **fs, return 0; errexit: - if (p-io.cookie) - free(p-io.cookie, M_TEMP); - if (p-sb_lock.cookie) - free(p-sb_lock.cookie, M_TEMP); - if (p-ilist_lock.cookie) - free(p-ilist_lock.cookie, M_TEMP); - if (p-mem_lock.cookie) - free(p-mem_lock.cookie, M_TEMP); - free(p, M_TEMP); - + v7fs_io_fini(p); return error; } static bool lock_init(struct lock_ops *ops) { - if (!(ops-cookie = (kmutex_t *)malloc(sizeof(kmutex_t), M_TEMP, - M_WAITOK | M_ZERO))) { + if ((ops-cookie = kmem_zalloc(sizeof(kmutex_t), KM_SLEEP)) == NULL) { return false; } mutex_init(ops-cookie, MUTEX_DEFAULT, IPL_NONE); ops-lock = v7fs_os_lock; ops-unlock = v7fs_os_unlock; - return true; } void v7fs_io_fini(struct v7fs_self *fs) { - mutex_destroy(fs-sb_lock.cookie); - mutex_destroy(fs-ilist_lock.cookie); - mutex_destroy(fs-mem_lock.cookie); - - free(fs-io.cookie, M_TEMP); - free(fs-sb_lock.cookie, M_TEMP); - free(fs-ilist_lock.cookie, M_TEMP); - free(fs, M_TEMP); + if (fs-io.cookie) { + kmem_free(fs-io.cookie, sizeof(struct local_io)); + } + if (fs-sb_lock.cookie) { + mutex_destroy(fs-sb_lock.cookie); + kmem_free(fs-sb_lock.cookie, sizeof(kmutex_t)); + } + if (fs-ilist_lock.cookie) { + mutex_destroy(fs-ilist_lock.cookie); + kmem_free(fs-ilist_lock.cookie, sizeof(kmutex_t)); + } + if (fs-mem_lock.cookie) { + mutex_destroy(fs-mem_lock.cookie); + kmem_free(fs-mem_lock.cookie, sizeof(kmutex_t)); + } + kmem_free(fs, sizeof(*fs)); } static bool Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.7 src/sys/fs/v7fs/v7fs_vfsops.c:1.8 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.7 Wed Jun 13 22:56:51 2012 +++ src/sys/fs/v7fs/v7fs_vfsops.c Wed Nov 20 23:44:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.7 2012/06/13 22:56:51 joerg Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.8 2013/11/20 23:44:23 rmind Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.7 2012/06/13 22:56:51 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.8 2013/11/20 23:44:23 rmind Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, $NetBSD:
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: christos Date: Fri Jun 28 14:49:14 UTC 2013 Modified Files: src/sys/fs/v7fs: v7fs_io.c Log Message: prevent memory leak on error http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_io.c diff -u src/sys/fs/v7fs/v7fs_io.c:1.2 src/sys/fs/v7fs/v7fs_io.c:1.3 --- src/sys/fs/v7fs/v7fs_io.c:1.2 Mon Jul 18 17:51:49 2011 +++ src/sys/fs/v7fs/v7fs_io.c Fri Jun 28 10:49:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_io.c,v 1.2 2011/07/18 21:51:49 apb Exp $ */ +/* $NetBSD: v7fs_io.c,v 1.3 2013/06/28 14:49:14 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_io.c,v 1.2 2011/07/18 21:51:49 apb Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_io.c,v 1.3 2013/06/28 14:49:14 christos Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -96,6 +96,7 @@ scratch_read(struct v7fs_self *fs, daddr uint8_t *buf = malloc(V7FS_BSIZE); if (!fs-io.read(fs-io.cookie, buf, blk)) { DPRINTF(*** I/O error block %ld\n,(long)blk); + free(buf); return NULL; } return buf;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: msaitoh Date: Fri Dec 7 06:50:15 UTC 2012 Modified Files: src/sys/fs/v7fs: v7fs_file.c Log Message: Fix off by one error. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_file.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_file.c diff -u src/sys/fs/v7fs/v7fs_file.c:1.4 src/sys/fs/v7fs/v7fs_file.c:1.5 --- src/sys/fs/v7fs/v7fs_file.c:1.4 Wed Mar 21 15:55:50 2012 +++ src/sys/fs/v7fs/v7fs_file.c Fri Dec 7 06:50:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file.c,v 1.4 2012/03/21 15:55:50 christos Exp $ */ +/* $NetBSD: v7fs_file.c,v 1.5 2012/12/07 06:50:15 msaitoh Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.4 2012/03/21 15:55:50 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.5 2012/12/07 06:50:15 msaitoh Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -76,7 +76,7 @@ v7fs_file_lookup_by_name(struct v7fs_sel if ((q = strchr(name, '/'))) { /* Zap following path. */ - len = MIN(V7FS_NAME_MAX + 1, q - name); + len = MIN(V7FS_NAME_MAX, q - name); memcpy(filename, name, len); filename[len] = '\0'; /* '/' - '\0' */ } else {
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: njoly Date: Sat Mar 31 21:44:28 UTC 2012 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Make v7fs_getattr() report file flags, and adjust v7fs_setattr() to allow unsetting SF_APPEND flag. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.9 src/sys/fs/v7fs/v7fs_vnops.c:1.10 --- src/sys/fs/v7fs/v7fs_vnops.c:1.9 Thu Mar 22 22:16:21 2012 +++ src/sys/fs/v7fs/v7fs_vnops.c Sat Mar 31 21:44:28 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.9 2012/03/22 22:16:21 njoly Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.10 2012/03/31 21:44:28 njoly Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.9 2012/03/22 22:16:21 njoly Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.10 2012/03/31 21:44:28 njoly Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -428,7 +428,7 @@ v7fs_getattr(void *v) vap-va_ctime.tv_sec = inode-ctime; vap-va_birthtime.tv_sec = 0; vap-va_gen = 1; - vap-va_flags = 0; + vap-va_flags = inode-append_mode ? SF_APPEND : 0; vap-va_rdev = inode-device; vap-va_bytes = vap-va_size; /* No sparse support. */ vap-va_filerev = 0; @@ -482,15 +482,13 @@ v7fs_setattr(void *v) return EINVAL; } /* File pointer mode. */ - if ((vap-va_flags != VNOVAL) (vap-va_flags SF_APPEND)) { + if (vap-va_flags != VNOVAL) { error = kauth_authorize_vnode(cred, KAUTH_VNODE_WRITE_FLAGS, vp, NULL, genfs_can_chflags(cred, vp-v_type, inode-uid, false)); if (error) return error; - - DPRINTF(Set append-mode.\n); - inode-append_mode = true; + inode-append_mode = vap-va_flags SF_APPEND; } /* File size change. */
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: njoly Date: Thu Mar 22 22:16:21 UTC 2012 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Pass operations flags to genfs_can_chtimes(), not file ones. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.8 src/sys/fs/v7fs/v7fs_vnops.c:1.9 --- src/sys/fs/v7fs/v7fs_vnops.c:1.8 Tue Mar 13 18:40:51 2012 +++ src/sys/fs/v7fs/v7fs_vnops.c Thu Mar 22 22:16:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.8 2012/03/13 18:40:51 elad Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.9 2012/03/22 22:16:21 njoly Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.8 2012/03/13 18:40:51 elad Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.9 2012/03/22 22:16:21 njoly Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -536,7 +536,7 @@ v7fs_setattr(void *v) (vap-va_mtime.tv_sec != VNOVAL) || (vap-va_ctime.tv_sec != VNOVAL)) { error = kauth_authorize_vnode(cred, KAUTH_VNODE_WRITE_TIMES, vp, - NULL, genfs_can_chtimes(vp, vap-va_flags, inode-uid, + NULL, genfs_can_chtimes(vp, vap-va_vaflags, inode-uid, cred)); if (error) return error;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: christos Date: Wed Mar 21 15:55:50 UTC 2012 Modified Files: src/sys/fs/v7fs: v7fs_file.c Log Message: don't re-define MIN To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_file.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_file.c diff -u src/sys/fs/v7fs/v7fs_file.c:1.3 src/sys/fs/v7fs/v7fs_file.c:1.4 --- src/sys/fs/v7fs/v7fs_file.c:1.3 Fri Jul 29 23:51:53 2011 +++ src/sys/fs/v7fs/v7fs_file.c Wed Mar 21 11:55:50 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $ */ +/* $NetBSD: v7fs_file.c,v 1.4 2012/03/21 15:55:50 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,19 +34,18 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.4 2012/03/21 15:55:50 christos Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif +#include sys/param.h #ifdef _KERNEL #include sys/systm.h -#include sys/param.h #else #include stdio.h #include string.h #include errno.h -#define MIN(a,b) ((/*CONSTCOND*/(a)(b))?(a):(b)) #endif #include v7fs.h
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: njoly Date: Fri Jan 27 12:22:03 UTC 2012 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Check parent directory write permission for DELETE operation. ok uch@. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.6 src/sys/fs/v7fs/v7fs_vnops.c:1.7 --- src/sys/fs/v7fs/v7fs_vnops.c:1.6 Sat Jul 30 03:53:18 2011 +++ src/sys/fs/v7fs/v7fs_vnops.c Fri Jan 27 12:22:02 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.6 2011/07/30 03:53:18 uch Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.7 2012/01/27 12:22:02 njoly Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.6 2011/07/30 03:53:18 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.7 2012/01/27 12:22:02 njoly Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -161,6 +161,13 @@ v7fs_lookup(void *v) return error; } + if ((nameiop == DELETE) islastcn) { + if ((error = VOP_ACCESS(dvp, VWRITE, cnp-cn_cred))) { + DPRINTF(access denied. (%s)\n, name); + return error; + } + } + /* Entry found. Allocate v-node */ // Check permissions? vpp = 0;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: christos Date: Sun Nov 13 23:09:58 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vfsops.c Log Message: use getdisksize() To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.4 src/sys/fs/v7fs/v7fs_vfsops.c:1.5 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.4 Fri Jul 29 23:53:18 2011 +++ src/sys/fs/v7fs/v7fs_vfsops.c Sun Nov 13 18:09:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.5 2011/11/13 23:09:58 christos Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.5 2011/11/13 23:09:58 christos Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -42,7 +42,8 @@ __KERNEL_RCSID(0, $NetBSD: v7fs_vfsops. #include sys/time.h #include sys/ucred.h #include sys/mount.h -#include sys/disklabel.h +#include sys/disk.h +#include sys/device.h #include sys/fcntl.h #include sys/malloc.h #include sys/kauth.h @@ -189,17 +190,16 @@ v7fs_mount(struct mount *mp, const char static int is_v7fs_partition(struct vnode *devvp) { - struct partinfo dpart; + struct dkwedge_info dkw; int error; - if ((error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED)) != 0) { - DPRINTF(VOP_IOCTL=%d\n, error); + if ((error = getdiskinfo(devvp, dkw)) != 0) { + DPRINTF(getdiskinfo=%d\n, error); return error; } - DPRINTF(fstype=%d dtype=%d bsize=%d\n, dpart.part-p_fstype, - dpart.disklab-d_type, dpart.disklab-d_secsize); + DPRINTF(ptype=%s size=% PRIu64 \n, dkw.dkw_ptype, dkw-dkw_size); - return (dpart.part-p_fstype == FS_V7) ? 0 : EINVAL; + return strcmp(dkw.dkw_ptype, DKW_PTYPE_V7) == 0 ? 0 : EINVAL; } static int
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: apb Date: Sun Aug 14 09:02:07 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_datablock.c Log Message: Rename all static functions to have v7fs_ prefix. Fixes a problem in the tools build, where the static link() and unlink() functions conflicted with those declared in unistd.h. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_datablock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_datablock.c diff -u src/sys/fs/v7fs/v7fs_datablock.c:1.4 src/sys/fs/v7fs/v7fs_datablock.c:1.5 --- src/sys/fs/v7fs/v7fs_datablock.c:1.4 Mon Jul 18 21:51:49 2011 +++ src/sys/fs/v7fs/v7fs_datablock.c Sun Aug 14 09:02:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_datablock.c,v 1.4 2011/07/18 21:51:49 apb Exp $ */ +/* $NetBSD: v7fs_datablock.c,v 1.5 2011/08/14 09:02:07 apb Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.4 2011/07/18 21:51:49 apb Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.5 2011/08/14 09:02:07 apb Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -63,15 +63,15 @@ #endif static int v7fs_datablock_deallocate(struct v7fs_self *, v7fs_daddr_t); -static int loop1(struct v7fs_self *, v7fs_daddr_t, size_t *, +static int v7fs_loop1(struct v7fs_self *, v7fs_daddr_t, size_t *, int (*)(struct v7fs_self *, void *, v7fs_daddr_t, size_t), void *); -static int loop2(struct v7fs_self *, v7fs_daddr_t, size_t *, +static int v7fs_loop2(struct v7fs_self *, v7fs_daddr_t, size_t *, int (*)(struct v7fs_self *, void *, v7fs_daddr_t, size_t), void *); -static v7fs_daddr_t link(struct v7fs_self *, v7fs_daddr_t, int); -static v7fs_daddr_t add_leaf(struct v7fs_self *, v7fs_daddr_t, int); -static v7fs_daddr_t unlink(struct v7fs_self *, v7fs_daddr_t, int); -static v7fs_daddr_t remove_leaf(struct v7fs_self *, v7fs_daddr_t, int); -static v7fs_daddr_t remove_self(struct v7fs_self *, v7fs_daddr_t); +static v7fs_daddr_t v7fs_link(struct v7fs_self *, v7fs_daddr_t, int); +static v7fs_daddr_t v7fs_add_leaf(struct v7fs_self *, v7fs_daddr_t, int); +static v7fs_daddr_t v7fs_unlink(struct v7fs_self *, v7fs_daddr_t, int); +static v7fs_daddr_t v7fs_remove_leaf(struct v7fs_self *, v7fs_daddr_t, int); +static v7fs_daddr_t v7fs_remove_self(struct v7fs_self *, v7fs_daddr_t); #ifdef V7FS_DATABLOCK_DEBUG void daddr_map_dump(const struct v7fs_daddr_map *); @@ -286,7 +286,7 @@ if (!datablock_number_sanity(fs, blk)) return EIO; - if ((ret = loop1(fs, blk, filesize, func, ctx))) + if ((ret = v7fs_loop1(fs, blk, filesize, func, ctx))) return ret; /* Index 2 */ @@ -294,7 +294,7 @@ if (!datablock_number_sanity(fs, blk)) return EIO; - if ((ret = loop2(fs, blk, filesize, func, ctx))) + if ((ret = v7fs_loop2(fs, blk, filesize, func, ctx))) return ret; /* Index 3 */ @@ -303,11 +303,11 @@ return EIO; for (i = 0; i V7FS_DADDR_PER_BLOCK; i++) { - blk2 = link(fs, blk, i); + blk2 = v7fs_link(fs, blk, i); if (!datablock_number_sanity(fs, blk)) return EIO; - if ((ret = loop2(fs, blk2, filesize, func, ctx))) + if ((ret = v7fs_loop2(fs, blk2, filesize, func, ctx))) return ret; } @@ -315,7 +315,7 @@ } static int -loop2(struct v7fs_self *fs, v7fs_daddr_t listblk, size_t *filesize, +v7fs_loop2(struct v7fs_self *fs, v7fs_daddr_t listblk, size_t *filesize, int (*func)(struct v7fs_self *, void *, v7fs_daddr_t, size_t), void *ctx) { v7fs_daddr_t blk; @@ -323,10 +323,10 @@ size_t j; for (j = 0; j V7FS_DADDR_PER_BLOCK; j++) { - blk = link(fs, listblk, j); + blk = v7fs_link(fs, listblk, j); if (!datablock_number_sanity(fs, blk)) return EIO; - if ((ret = loop1(fs, blk, filesize, func, ctx))) + if ((ret = v7fs_loop1(fs, blk, filesize, func, ctx))) return ret; } @@ -334,7 +334,7 @@ } static int -loop1(struct v7fs_self *fs, v7fs_daddr_t listblk, size_t *filesize, +v7fs_loop1(struct v7fs_self *fs, v7fs_daddr_t listblk, size_t *filesize, int (*func)(struct v7fs_self *, void *, v7fs_daddr_t, size_t), void *ctx) { v7fs_daddr_t blk; @@ -343,7 +343,7 @@ size_t k; for (k = 0; k V7FS_DADDR_PER_BLOCK; k++, *filesize -= V7FS_BSIZE) { - blk = link(fs, listblk, k); + blk = v7fs_link(fs, listblk, k); if (!datablock_number_sanity(fs, blk)) return EIO; last = *filesize = V7FS_BSIZE; @@ -374,15 +374,16 @@ blk = inode-addr[map.index[0]]; break; case 1: /*Index1 */ - blk = link(fs, addr[V7FS_NADDR_INDEX1], map.index[0]); + blk = v7fs_link(fs, addr[V7FS_NADDR_INDEX1], map.index[0]); break; case 2: /*Index2 */ - blk = link(fs, link(fs, addr[V7FS_NADDR_INDEX2], map.index[0]), - map.index[1]); + blk = v7fs_link(fs, v7fs_link(fs, + addr[V7FS_NADDR_INDEX2], map.index[0]), map.index[1]); break; case 3: /*Index3
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Mon Aug 8 11:42:30 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_io_user.c Log Message: Remove suspicious warning message. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_io_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_io_user.c diff -u src/sys/fs/v7fs/v7fs_io_user.c:1.3 src/sys/fs/v7fs/v7fs_io_user.c:1.4 --- src/sys/fs/v7fs/v7fs_io_user.c:1.3 Wed Aug 3 16:21:52 2011 +++ src/sys/fs/v7fs/v7fs_io_user.c Mon Aug 8 11:42:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $ */ +/* $NetBSD: v7fs_io_user.c,v 1.4 2011/08/08 11:42:30 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $); +__RCSID($NetBSD: v7fs_io_user.c,v 1.4 2011/08/08 11:42:30 uch Exp $); #endif /* not lint */ #include stdio.h @@ -88,7 +88,6 @@ local.addr = mmap(NULL, local.size, PROT_READ | PROT_WRITE | PROT_NONE, MAP_FILE | MAP_SHARED/*writeback*/, local.fd, 0); if (local.addr == MAP_FAILED) { - warn(mmap failed. use direct I/O.); local.addr = 0; p-io.read = read_sector; p-io.write = write_sector;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: dholland Date: Wed Aug 3 16:21:52 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_io_user.c Log Message: Insert casts to off_t to avoid 32-bit multiplication overflow when computing device offsets on 32-bit platforms. Should fix PR 45191. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_io_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_io_user.c diff -u src/sys/fs/v7fs/v7fs_io_user.c:1.2 src/sys/fs/v7fs/v7fs_io_user.c:1.3 --- src/sys/fs/v7fs/v7fs_io_user.c:1.2 Mon Jul 18 21:51:49 2011 +++ src/sys/fs/v7fs/v7fs_io_user.c Wed Aug 3 16:21:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_io_user.c,v 1.2 2011/07/18 21:51:49 apb Exp $ */ +/* $NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: v7fs_io_user.c,v 1.2 2011/07/18 21:51:49 apb Exp $); +__RCSID($NetBSD: v7fs_io_user.c,v 1.3 2011/08/03 16:21:52 dholland Exp $); #endif /* not lint */ #include stdio.h @@ -125,7 +125,7 @@ size_t blksz = lio-blksz; int fd = lio-fd; - if ((lseek(fd, sector * blksz, SEEK_SET) 0) || + if ((lseek(fd, (off_t)sector * blksz, SEEK_SET) 0) || (read(fd, buf, blksz) (ssize_t)blksz)) { warn(sector=%ld\n, (long)sector); return false; @@ -141,7 +141,7 @@ size_t blksz = lio-blksz; int fd = lio-fd; - if ((lseek(fd, sector * blksz, SEEK_SET) 0) || + if ((lseek(fd, (off_t)sector * blksz, SEEK_SET) 0) || (write(fd, buf, blksz) (ssize_t)blksz)) { warn(sector=%ld\n, (long)sector); return false;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 30 03:51:53 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_file.c Log Message: Fix return vaule. Pass t_vnops:rename_dotdot, dir_noempty, rename_dir(6) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_file.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_file.c diff -u src/sys/fs/v7fs/v7fs_file.c:1.2 src/sys/fs/v7fs/v7fs_file.c:1.3 --- src/sys/fs/v7fs/v7fs_file.c:1.2 Mon Jul 18 21:51:49 2011 +++ src/sys/fs/v7fs/v7fs_file.c Sat Jul 30 03:51:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file.c,v 1.2 2011/07/18 21:51:49 apb Exp $ */ +/* $NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.2 2011/07/18 21:51:49 apb Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_file.c,v 1.3 2011/07/30 03:51:53 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -247,16 +247,24 @@ return error; if (v7fs_inode_isdir(inode)) { - /* Check child directory exists. */ + char filename[V7FS_NAME_MAX + 1]; + v7fs_dirent_filename(filename, name); + /* Check parent */ + if (strncmp(filename, .., V7FS_NAME_MAX) == 0) { + DPRINTF(can not remove '..'\n); + return EINVAL; /* t_vnops rename_dotdot */ + } + /* Check empty */ if (v7fs_inode_filesize(inode) != sizeof(struct v7fs_dirent) * 2 /*. + ..*/) { - DPRINTF(file exists.\n); - return EEXIST; + DPRINTF(directory not empty.\n); + return ENOTEMPTY;/* t_vnops dir_noempty, rename_dir(6)*/ } inode.nlink = 0; /* remove this. */ } else { /* Decrement reference count. */ --inode.nlink; /* regular file. */ + DPRINTF(%s nlink=%d\n, name, inode.nlink); }
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 30 03:52:05 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_file_util.c Log Message: When rename directory, check hierarchy. Pass t_vnops rename_dir(5) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_file_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_file_util.c diff -u src/sys/fs/v7fs/v7fs_file_util.c:1.3 src/sys/fs/v7fs/v7fs_file_util.c:1.4 --- src/sys/fs/v7fs/v7fs_file_util.c:1.3 Mon Jul 18 21:51:49 2011 +++ src/sys/fs/v7fs/v7fs_file_util.c Sat Jul 30 03:52:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file_util.c,v 1.3 2011/07/18 21:51:49 apb Exp $ */ +/* $NetBSD: v7fs_file_util.c,v 1.4 2011/07/30 03:52:04 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.3 2011/07/18 21:51:49 apb Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.4 2011/07/30 03:52:04 uch Exp $); #ifdef _KERNEL #include sys/systm.h #include sys/param.h @@ -61,6 +61,9 @@ static int replace_subr(struct v7fs_self *, void *, v7fs_daddr_t, size_t); static int lookup_by_number_subr(struct v7fs_self *, void *, v7fs_daddr_t, size_t); +static int can_dirmove(struct v7fs_self *, v7fs_ino_t, v7fs_ino_t); +static int lookup_parent_from_dir_subr(struct v7fs_self *, void *, +v7fs_daddr_t, size_t); int v7fs_file_link(struct v7fs_self *fs, struct v7fs_inode *parent_dir, @@ -118,26 +121,38 @@ const char *from, struct v7fs_inode *parent_to, const char *to) { v7fs_ino_t from_ino, to_ino; + struct v7fs_inode inode; int error; + bool dir_move; + /* Check source file */ if ((error = v7fs_file_lookup_by_name(fs, parent_from, from, from_ino))) { DPRINTF(%s don't exists\n, from); return error; } + v7fs_inode_load(fs, inode, from_ino); + dir_move = v7fs_inode_isdir(inode); - /* If target file exists, remove. */ + /* Check target file */ error = v7fs_file_lookup_by_name(fs, parent_to, to, to_ino); - if (error == 0) { + if (error == 0) { /* found */ DPRINTF(%s already exists\n, to); if ((error = v7fs_file_deallocate(fs, parent_to, to))) { - DPRINTF(%s can't remove\n, to); + DPRINTF(%s can't remove %d\n, to, error); return error; } } else if (error != ENOENT) { DPRINTF(error=%d\n, error); return error; } + /* Check directory hierarchy. t_vnops rename_dir(5) */ + if (dir_move (error = can_dirmove(fs, from_ino, + parent_to-inode_number))) { + DPRINTF(dst '%s' is child dir of '%s'. error=%d\n, to, from, + error); + return error; + } if ((error = v7fs_directory_add_entry(fs, parent_to, from_ino, to))) { DPRINTF(can't add entry); @@ -149,18 +164,14 @@ return error; } - if (parent_from != parent_to) { + if (dir_move (parent_from != parent_to)) { /* If directory move, update .. */ - struct v7fs_inode inode; - v7fs_inode_load(fs, inode, from_ino); - if (v7fs_inode_isdir(inode)) { - if ((error = v7fs_directory_replace_entry(fs, inode, - .., parent_to-inode_number))) { -DPRINTF(can't replace parent dir); -return error; - } - v7fs_inode_writeback(fs, inode); + if ((error = v7fs_directory_replace_entry(fs, inode, .., + parent_to-inode_number))) { + DPRINTF(can't replace parent dir); + return error; } + v7fs_inode_writeback(fs, inode); } return 0; @@ -258,3 +269,76 @@ return ret; } + +struct lookup_parent_arg { + v7fs_ino_t parent_ino; +}; + +static int +can_dirmove(struct v7fs_self *fs, v7fs_ino_t from_ino, v7fs_ino_t to_ino) +{ + struct v7fs_inode inode; + v7fs_ino_t parent; + int error; + + /* Start dir. */ + if ((error = v7fs_inode_load(fs, inode, to_ino))) + return error; + + if (!v7fs_inode_isdir(inode)) + return ENOTDIR; + + /* Lookup the parent. */ + do { + struct lookup_parent_arg arg; + /* Search parent dir */ + arg.parent_ino = 0; + v7fs_datablock_foreach(fs, inode, lookup_parent_from_dir_subr, + arg); + if ((parent = arg.parent_ino) == 0) { + DPRINTF(***parent missing\n); + return ENOENT; + } + /* Load parent dir */ + if ((error = v7fs_inode_load(fs, inode, parent))) + return error; + if (parent == from_ino) { + DPRINTF(#%d is child dir of #%d\n, to_ino, from_ino); + return EINVAL; + } + } while (parent != V7FS_ROOT_INODE); + + return 0; +} + +static int +lookup_parent_from_dir_subr(struct v7fs_self *fs, void *ctx, v7fs_daddr_t blk, +size_t sz) +{ + struct lookup_parent_arg *arg = (struct lookup_parent_arg *)ctx; + char name[V7FS_NAME_MAX + 1]; + void *buf; + int ret = 0; + + if (!(buf = scratch_read(fs, blk))) + return 0; + struct v7fs_dirent *dir = (struct v7fs_dirent *)buf; + size_t i, n = sz / sizeof(*dir); + if (!v7fs_dirent_endian_convert(fs, dir, n)) { + scratch_free(fs, buf); + return V7FS_ITERATOR_ERROR; + } + + for (i = 0; i
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 30 03:53:18 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vfsops.c v7fs_vnops.c Log Message: v7fs_lookup() fix return value. Pass t_vnops rename_dir(3) v7fs_setttr() check credential. Pass t_unpriv owner v7fs_rename() reload inode(v7fs_vnode_reload). Pass t_vnops rename_reg_nodir To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_vfsops.c cvs rdiff -u -r1.5 -r1.6 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.3 src/sys/fs/v7fs/v7fs_vfsops.c:1.4 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.3 Sat Jul 23 05:10:30 2011 +++ src/sys/fs/v7fs/v7fs_vfsops.c Sat Jul 30 03:53:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -75,6 +75,7 @@ static void v7fs_closefs(struct vnode *, struct mount *); static int is_v7fs_partition(struct vnode *); static enum vtype v7fs_mode_to_vtype(v7fs_mode_t mode); +int v7fs_vnode_reload(struct mount *, struct vnode *); int v7fs_mount(struct mount *mp, const char *path, void *data, size_t *data_len) @@ -594,3 +595,34 @@ return 0; } + +/* Reload disk inode information */ +int +v7fs_vnode_reload(struct mount *mp, struct vnode *vp) +{ + struct v7fs_mount *v7fsmount = mp-mnt_data; + struct v7fs_self *fs = v7fsmount-core; + struct v7fs_node *v7fs_node; + struct v7fs_inode *inode = ((struct v7fs_node *)vp-v_data)-inode; + int target_ino = inode-inode_number; + int error = 0; + + DPRINTF(#%d\n, target_ino); + mutex_enter(mntvnode_lock); + for (v7fs_node = LIST_FIRST(v7fsmount-v7fs_node_head); + v7fs_node != NULL; v7fs_node = LIST_NEXT(v7fs_node, link)) { + inode = v7fs_node-inode; + if (!v7fs_inode_allocated(inode)) { + continue; + } + if (inode-inode_number == target_ino) { + error = v7fs_inode_load(fs, v7fs_node-inode, + target_ino); + DPRINTF(sync #%d error=%d\n, target_ino, error); + break; + } + } + mutex_exit(mntvnode_lock); + + return error; +} Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.5 src/sys/fs/v7fs/v7fs_vnops.c:1.6 --- src/sys/fs/v7fs/v7fs_vnops.c:1.5 Sun Jul 24 12:31:33 2011 +++ src/sys/fs/v7fs/v7fs_vnops.c Sat Jul 30 03:53:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.6 2011/07/30 03:53:18 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.6 2011/07/30 03:53:18 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -67,6 +67,8 @@ MALLOC_JUSTDEFINE(M_V7FS_VNODE, v7fs vnode, v7fs vnode structures); MALLOC_DECLARE(M_V7FS); +int v7fs_vnode_reload(struct mount *, struct vnode *); + static v7fs_mode_t vtype_to_v7fs_mode(enum vtype); static uint8_t v7fs_mode_to_d_type(v7fs_mode_t); @@ -110,9 +112,11 @@ bool islastcn = flags ISLASTCN; v7fs_ino_t ino; int error; - - DPRINTF(%s op=%d flags=%d parent=%d %o %dbyte\n, name, - nameiop, cnp-cn_flags, parent-inode_number, parent-mode, +#ifdef V7FS_VNOPS_DEBUG + const char *opname[] = { LOOKUP, CREATE, DELETE, RENAME }; +#endif + DPRINTF('%s' op=%s flags=%d parent=%d %o %dbyte\n, name, + opname[nameiop], cnp-cn_flags, parent-inode_number, parent-mode, parent-filesize); *a-a_vpp = 0; @@ -132,6 +136,9 @@ /* . */ if (namelen == 1 name[0] == '.') { + if ((nameiop == RENAME) islastcn) { + return EISDIR; /* t_vnops rename_dir(3) */ + } vref(dvp); /* v_usecount++ */ *a-a_vpp = dvp; DPRINTF(done.(.)\n); @@ -170,7 +177,7 @@ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); } *a-a_vpp = vpp; - DPRINTF(done.\n); + DPRINTF(done.(%s)\n, name); return 0; } @@ -439,6 +446,7 @@ struct v7fs_node *v7node = vp-v_data; struct v7fs_self *fs = v7node-v7fsmount-core; struct v7fs_inode *inode = v7node-inode; + kauth_cred_t cred = ap-a_cred; struct timespec *acc, *mod; int error = 0; acc = mod = NULL; @@ -477,15 +485,38 @@ if (error == 0) uvm_vnp_setsize(vp, vap-va_size); } + uid_t uid = inode-uid; + gid_t gid = inode-gid; if (vap-va_uid != (uid_t)VNOVAL) { - inode-uid = vap-va_uid; + uid = vap-va_uid; + error = kauth_authorize_vnode(cred, + KAUTH_VNODE_CHANGE_OWNERSHIP, vp, NULL, + genfs_can_chown(vp, cred, inode-uid,
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sun Jul 24 12:31:33 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Existing inode don't recycle. rump works. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.4 src/sys/fs/v7fs/v7fs_vnops.c:1.5 --- src/sys/fs/v7fs/v7fs_vnops.c:1.4 Sat Jul 16 12:35:40 2011 +++ src/sys/fs/v7fs/v7fs_vnops.c Sun Jul 24 12:31:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.5 2011/07/24 12:31:33 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -954,14 +954,14 @@ struct v7fs_node *v7node = vp-v_data; struct v7fs_inode *inode = v7node-inode; - DPRINTF(%p\n, vp); - + DPRINTF(%p #%d\n, vp, inode-inode_number); if (v7fs_inode_allocated(inode)) { v7fs_update(vp, 0, 0, UPDATE_WAIT); + *a-a_recycle = false; + } else { + *a-a_recycle = true; } - *a-a_recycle = true; - VOP_UNLOCK(vp); return 0; @@ -978,7 +978,7 @@ struct vnode *vp = a-a_vp; struct v7fs_node *v7node = vp-v_data; - DPRINTF(%p\n, vp); + DPRINTF(%p #%d\n, vp, v7node-inode.inode_number); mutex_enter(mntvnode_lock); LIST_REMOVE(v7node, link); mutex_exit(mntvnode_lock);
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 23 05:10:30 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vfsops.c Log Message: remove partition check from v7fs_mount. problem on rump implementation. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.2 src/sys/fs/v7fs/v7fs_vfsops.c:1.3 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.2 Sat Jul 2 01:05:38 2011 +++ src/sys/fs/v7fs/v7fs_vfsops.c Sat Jul 23 05:10:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.3 2011/07/23 05:10:30 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -223,15 +223,8 @@ goto unlock_exit; } - /* Get partition information */ - if ((error = is_v7fs_partition(devvp))) { - goto close_exit; - } - return 0; /* lock held */ -close_exit: - VOP_CLOSE(devvp, oflags, NOCRED); unlock_exit: VOP_UNLOCK(devvp);
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 16 12:35:32 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_datablock.c v7fs_datablock.h Log Message: export v7fs_datablock_addr for makefs To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_datablock.c cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_datablock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_datablock.c diff -u src/sys/fs/v7fs/v7fs_datablock.c:1.2 src/sys/fs/v7fs/v7fs_datablock.c:1.3 --- src/sys/fs/v7fs/v7fs_datablock.c:1.2 Wed Jul 13 12:18:22 2011 +++ src/sys/fs/v7fs/v7fs_datablock.c Sat Jul 16 12:35:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $ */ +/* $NetBSD: v7fs_datablock.c,v 1.3 2011/07/16 12:35:32 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.3 2011/07/16 12:35:32 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -58,12 +58,6 @@ #define DPRINTF(fmt, args...) ((void)0) #endif -struct v7fs_daddr_map { - int level; /* direct, index1, index2, index3 */ - v7fs_daddr_t index[3]; -}; - -static int v7fs_datablock_addr(size_t, struct v7fs_daddr_map *); static int v7fs_datablock_deallocate(struct v7fs_self *, v7fs_daddr_t); static int loop1(struct v7fs_self *, v7fs_daddr_t, size_t *, int (*)(struct v7fs_self *, void *, v7fs_daddr_t, size_t), void *); @@ -198,7 +192,7 @@ return error; } -static int +int v7fs_datablock_addr(size_t sz, struct v7fs_daddr_map *map) { #define NIDX V7FS_DADDR_PER_BLOCK Index: src/sys/fs/v7fs/v7fs_datablock.h diff -u src/sys/fs/v7fs/v7fs_datablock.h:1.1 src/sys/fs/v7fs/v7fs_datablock.h:1.2 --- src/sys/fs/v7fs/v7fs_datablock.h:1.1 Mon Jun 27 11:52:24 2011 +++ src/sys/fs/v7fs/v7fs_datablock.h Sat Jul 16 12:35:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_datablock.h,v 1.1 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: v7fs_datablock.h,v 1.2 2011/07/16 12:35:32 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -42,5 +42,11 @@ int v7fs_datablock_expand(struct v7fs_self *, struct v7fs_inode *, size_t); int v7fs_datablock_contract(struct v7fs_self *, struct v7fs_inode *, size_t); int v7fs_datablock_size_change(struct v7fs_self *, size_t, struct v7fs_inode *); + +struct v7fs_daddr_map { + int level; /* direct, index1, index2, index3 */ + v7fs_daddr_t index[3]; +}; +int v7fs_datablock_addr(size_t, struct v7fs_daddr_map *); __END_DECLS #endif /*!_V7FS_INODE_H_ */
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 16 12:35:40 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs.h v7fs_file.h v7fs_file_util.c v7fs_vnops.c Log Message: core symlink operation moved to v7fs_file_util.c and introduce V7FSBSD_MAXSYMLINKLEN for makefs To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs.h src/sys/fs/v7fs/v7fs_file.h \ src/sys/fs/v7fs/v7fs_file_util.c cvs rdiff -u -r1.3 -r1.4 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs.h diff -u src/sys/fs/v7fs/v7fs.h:1.1 src/sys/fs/v7fs/v7fs.h:1.2 --- src/sys/fs/v7fs/v7fs.h:1.1 Mon Jun 27 11:52:24 2011 +++ src/sys/fs/v7fs/v7fs.h Sat Jul 16 12:35:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs.h,v 1.1 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: v7fs.h,v 1.2 2011/07/16 12:35:40 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -175,6 +175,6 @@ /* Don't apear original V7 filesystem. NetBSD. */ #define V7FSBSD_IFFIFO 001 /* Named pipe. */ -#define V7FSBSD_MAXSYMLINKS 8 +#define V7FSBSD_MAXSYMLINKLEN V7FS_BSIZE #endif /*!_V7FS_H_ */ Index: src/sys/fs/v7fs/v7fs_file.h diff -u src/sys/fs/v7fs/v7fs_file.h:1.1 src/sys/fs/v7fs/v7fs_file.h:1.2 --- src/sys/fs/v7fs/v7fs_file.h:1.1 Mon Jun 27 11:52:24 2011 +++ src/sys/fs/v7fs/v7fs_file.h Sat Jul 16 12:35:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file.h,v 1.1 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: v7fs_file.h,v 1.2 2011/07/16 12:35:40 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -60,5 +60,6 @@ const char *); bool v7fs_file_lookup_by_number(struct v7fs_self *, struct v7fs_inode *, v7fs_ino_t, char *); +int v7fs_file_symlink(struct v7fs_self *, struct v7fs_inode *, const char *); __END_DECLS #endif /*!_V7FS_INODE_H_ */ Index: src/sys/fs/v7fs/v7fs_file_util.c diff -u src/sys/fs/v7fs/v7fs_file_util.c:1.1 src/sys/fs/v7fs/v7fs_file_util.c:1.2 --- src/sys/fs/v7fs/v7fs_file_util.c:1.1 Mon Jun 27 11:52:24 2011 +++ src/sys/fs/v7fs/v7fs_file_util.c Sat Jul 16 12:35:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_file_util.c,v 1.1 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: v7fs_file_util.c,v 1.2 2011/07/16 12:35:40 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.1 2011/06/27 11:52:24 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_file_util.c,v 1.2 2011/07/16 12:35:40 uch Exp $); #ifdef _KERNEL #include sys/systm.h #include sys/param.h @@ -77,6 +77,39 @@ } int +v7fs_file_symlink(struct v7fs_self *fs, struct v7fs_inode *p, +const char *target) +{ + int error; + size_t len = strlen(target) + 1; + + if (len V7FSBSD_MAXSYMLINKLEN) {/* limited target 512byte pathname */ + DPRINTF(too long pathname.); + return ENAMETOOLONG; + } + + if ((error = v7fs_datablock_expand(fs, p, len))) { + return error; + } + + v7fs_daddr_t blk = p-addr[0]; /* 1block only. */ + void *buf; + if (!(buf = scratch_read(fs, blk))) { + return EIO; + } + + strncpy(buf, target, V7FS_BSIZE); + if (!fs-io.write(fs-io.cookie, buf, blk)) { + scratch_free(fs, buf); + return EIO; + } + scratch_free(fs, buf); + v7fs_inode_writeback(fs, p); + + return 0; +} + +int v7fs_file_rename(struct v7fs_self *fs, struct v7fs_inode *parent_from, const char *from, struct v7fs_inode *parent_to, const char *to) { Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.3 src/sys/fs/v7fs/v7fs_vnops.c:1.4 --- src/sys/fs/v7fs/v7fs_vnops.c:1.3 Wed Jul 13 12:28:57 2011 +++ src/sys/fs/v7fs/v7fs_vnops.c Sat Jul 16 12:35:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.4 2011/07/16 12:35:40 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -1130,7 +1130,7 @@ *a-a_retval = 30; /* ~1G */ break; case _PC_SYMLINK_MAX: - *a-a_retval = MAXPATHLEN; + *a-a_retval = V7FSBSD_MAXSYMLINKLEN; break; case _PC_2_SYMLINKS: *a-a_retval = 1; @@ -1224,26 +1224,7 @@ struct v7fs_node *newnode = (*a-a_vpp)-v_data; struct v7fs_inode *p = newnode-inode; - - if ((error = v7fs_datablock_expand(fs, p, len))) { - v7fs_inode_deallocate(fs, ino); - error = ENOSPC; - goto unlock_exit; - } - v7fs_daddr_t blk = p-addr[0]; /* 1block only. */ - void *buf; - if (!(buf = scratch_read(fs, blk))) { - v7fs_inode_deallocate(fs, ino); - error = EIO; - goto unlock_exit; - } - strncpy(buf, from, V7FS_BSIZE); - if (!fs-io.write(fs-io.cookie, buf, blk)) { - scratch_free(fs, buf); - error = EIO; - goto unlock_exit; -
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Wed Jul 13 12:18:22 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_datablock.c Log Message: When filesize is zero, correctly return V7FS_ITERATOR_END To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_datablock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_datablock.c diff -u src/sys/fs/v7fs/v7fs_datablock.c:1.1 src/sys/fs/v7fs/v7fs_datablock.c:1.2 --- src/sys/fs/v7fs/v7fs_datablock.c:1.1 Mon Jun 27 11:52:24 2011 +++ src/sys/fs/v7fs/v7fs_datablock.c Wed Jul 13 12:18:22 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_datablock.c,v 1.1 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.1 2011/06/27 11:52:24 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_datablock.c,v 1.2 2011/07/13 12:18:22 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -262,7 +262,7 @@ int ret; if (!(filesize = v7fs_inode_filesize(p))) - return 0; + return V7FS_ITERATOR_END; #ifdef V7FS_DATABLOCK_DEBUG size_t sz = filesize; #endif
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Wed Jul 13 12:22:49 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Fix inode update method. chown and chmod works. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.1 src/sys/fs/v7fs/v7fs_vnops.c:1.2 --- src/sys/fs/v7fs/v7fs_vnops.c:1.1 Mon Jun 27 11:52:25 2011 +++ src/sys/fs/v7fs/v7fs_vnops.c Wed Jul 13 12:22:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.1 2011/06/27 11:52:25 uch Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.1 2011/06/27 11:52:25 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -439,7 +439,9 @@ struct v7fs_node *v7node = vp-v_data; struct v7fs_self *fs = v7node-v7fsmount-core; struct v7fs_inode *inode = v7node-inode; + struct timespec *acc, *mod; int error = 0; + acc = mod = NULL; DPRINTF(\n); @@ -476,20 +478,28 @@ uvm_vnp_setsize(vp, vap-va_size); } - if (vap-va_uid != (uid_t)VNOVAL) + if (vap-va_uid != (uid_t)VNOVAL) { inode-uid = vap-va_uid; - if (vap-va_gid != (uid_t)VNOVAL) + } + if (vap-va_gid != (uid_t)VNOVAL) { inode-gid = vap-va_gid; - if (vap-va_mode != (mode_t)VNOVAL) + } + if (vap-va_mode != (mode_t)VNOVAL) { v7fs_inode_chmod(inode, vap-va_mode); - if (vap-va_atime.tv_sec != VNOVAL) - inode-atime = vap-va_atime.tv_sec; - if (vap-va_mtime.tv_sec != VNOVAL) - inode-mtime = vap-va_mtime.tv_sec; - if (vap-va_ctime.tv_sec != VNOVAL) - inode-ctime = vap-va_ctime.tv_sec; + } + if (vap-va_atime.tv_sec != VNOVAL) { + acc = vap-va_atime; + } + if (vap-va_mtime.tv_sec != VNOVAL) { + mod = vap-va_mtime; + v7node-update_mtime = true; + } + if (vap-va_ctime.tv_sec != VNOVAL) { + v7node-update_ctime = true; + } - v7fs_update(vp, 0, 0, 0); + v7node-update_atime = true; + v7fs_update(vp, acc, mod, 0); return error; }
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Wed Jul 13 12:28:57 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vnops.c Log Message: Fix readdir eofflag(bogus eofflags was setted). getcwd works. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vnops.c diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.2 src/sys/fs/v7fs/v7fs_vnops.c:1.3 --- src/sys/fs/v7fs/v7fs_vnops.c:1.2 Wed Jul 13 12:22:49 2011 +++ src/sys/fs/v7fs/v7fs_vnops.c Wed Jul 13 12:28:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $ */ +/* $NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.2 2011/07/13 12:22:49 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vnops.c,v 1.3 2011/07/13 12:28:57 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -887,6 +887,9 @@ } scratch_free(fs, buf); + if (p-cnt == p-end) + return V7FS_ITERATOR_BREAK; + return error; }
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: uch Date: Sat Jul 2 01:05:38 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vfsops.c Log Message: Set missing error number To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/fs/v7fs/v7fs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.1 src/sys/fs/v7fs/v7fs_vfsops.c:1.2 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.1 Mon Jun 27 11:52:25 2011 +++ src/sys/fs/v7fs/v7fs_vfsops.c Sat Jul 2 01:05:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.1 2011/06/27 11:52:25 uch Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.1 2011/06/27 11:52:25 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.2 2011/07/02 01:05:38 uch Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -73,7 +73,7 @@ static int v7fs_mountfs(struct vnode *, struct mount *, int); static int v7fs_openfs(struct vnode *, struct mount *, struct lwp *); static void v7fs_closefs(struct vnode *, struct mount *); -static bool is_v7fs_partition(struct vnode *); +static int is_v7fs_partition(struct vnode *); static enum vtype v7fs_mode_to_vtype(v7fs_mode_t mode); int @@ -185,7 +185,7 @@ mp-mnt_op-vfs_name, mp, l); } -static bool +static int is_v7fs_partition(struct vnode *devvp) { struct partinfo dpart; @@ -193,12 +193,12 @@ if ((error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED)) != 0) { DPRINTF(VOP_IOCTL=%d\n, error); - return false; + return error; } DPRINTF(fstype=%d dtype=%d bsize=%d\n, dpart.part-p_fstype, dpart.disklab-d_type, dpart.disklab-d_secsize); - return dpart.part-p_fstype == FS_V7; + return (dpart.part-p_fstype == FS_V7) ? 0 : EINVAL; } static int @@ -224,8 +224,9 @@ } /* Get partition information */ - if (!is_v7fs_partition(devvp)) + if ((error = is_v7fs_partition(devvp))) { goto close_exit; + } return 0; /* lock held */ @@ -576,8 +577,8 @@ DPRINTF(); /* On mountroot, devvp (rootdev) is opened by vfs_mountroot */ - if (!is_v7fs_partition (rootvp)) - return EINVAL; + if ((error = is_v7fs_partition (rootvp))) + return error; if ((error = vfs_rootmountalloc(MOUNT_V7FS, root_device, mp))) { DPRINTF(mountalloc error=%d\n, error);