CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: maxv Date: Thu Jul 11 16:59:14 UTC 2019 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Fix (harmless) uninitialized variable: 'pg' could be 'endm', in which case 'pg->uobject' would not be initialized. Just invert the two last conditions of the KASSERT. ok hannken@ To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/miscfs/genfs/genfs_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/miscfs/genfs/genfs_io.c diff -u src/sys/miscfs/genfs/genfs_io.c:1.74 src/sys/miscfs/genfs/genfs_io.c:1.75 --- src/sys/miscfs/genfs/genfs_io.c:1.74 Mon Dec 10 21:10:52 2018 +++ src/sys/miscfs/genfs/genfs_io.c Thu Jul 11 16:59:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_io.c,v 1.74 2018/12/10 21:10:52 jdolecek Exp $ */ +/* $NetBSD: genfs_io.c,v 1.75 2019/07/11 16:59:14 maxv Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.74 2018/12/10 21:10:52 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.75 2019/07/11 16:59:14 maxv Exp $"); #include #include @@ -993,8 +993,8 @@ retry: * if the current page is not interesting, move on to the next. */ - KASSERT(pg == NULL || pg->uobject == uobj || - (pg->flags & PG_MARKER) != 0); + KASSERT(pg == NULL || (pg->flags & PG_MARKER) != 0 || + pg->uobject == uobj); KASSERT(pg == NULL || (pg->flags & (PG_RELEASED|PG_PAGEOUT)) == 0 || (pg->flags & (PG_BUSY|PG_MARKER)) != 0);
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: maxv Date: Thu Jul 11 16:59:14 UTC 2019 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Fix (harmless) uninitialized variable: 'pg' could be 'endm', in which case 'pg->uobject' would not be initialized. Just invert the two last conditions of the KASSERT. ok hannken@ To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Wed Jan 27 15:18:40 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_node.h genfs_vnops.c Log Message: Add genfs_node_rdtrylock(). To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/miscfs/genfs/genfs_node.h cvs rdiff -u -r1.174 -r1.175 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Wed Jan 27 15:24:54 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Constify some pointers in genfs_getpages() and genfs_do_putpages(). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Wed Jan 27 15:52:31 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_node.h genfs_vnops.c Log Message: Don't forget to tell the result of rw_tryenter(). To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/miscfs/genfs/genfs_node.h cvs rdiff -u -r1.175 -r1.176 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Wed Jan 27 15:53:06 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Use genfs_node_*lock(). To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 07:24:56 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_putpages: Localize a few variables. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 07:26:25 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Localize a few more variables. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 07:38:32 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Move local variable declarations that are used only for I/O to where they're used. This helps to track what's going in this lengthy function. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 07:44:54 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Constify & localize more variables. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 07:49:08 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Unbreak modules build. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 08:02:12 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Constify orignpages. Don't override its meaning by the value re-calucated from GOP_SIZE(GOP_SIZE_MEM), but assign another variable (orignmempages). To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 08:20:00 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Constify 2 variables, move one. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 13:43:53 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: More constification & localization. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Thu Jan 28 14:25:17 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Revert part which variable initializations within interleaved gotos. again: if (...) goto err; void *ptr = alloc(); if (...) goto again; if (...) goto err1; ... err1: if (ptr) free(ptr); err: return; This leaks memory if exited with "goto again; -> goto err;". To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Fri Jan 29 04:33:37 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Redo previous with a better goto label. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Fri Jan 29 04:36:20 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs_getpages: Narrow & clarify the context where I/O happens & vmobjlock is dropped. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Sat Jan 30 05:19:20 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Slightly more descriptive local variable names. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: uebayasi Date: Sat Jan 30 12:06:20 UTC 2010 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: Reduce the diff between genfs_getpages() and genfs_do_io(). These should be merged eventually. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: hannken Date: Sat Mar 19 13:52:45 UTC 2022 Modified Files: src/sys/miscfs/genfs: genfs_vnops.c Log Message: Remove now unused genfs_nolock(), genfs_nounlock() and genfs_noislocked(). To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: hannken Date: Sat Mar 19 13:52:45 UTC 2022 Modified Files: src/sys/miscfs/genfs: genfs_vnops.c Log Message: Remove now unused genfs_nolock(), genfs_nounlock() and genfs_noislocked(). To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/sys/miscfs/genfs/genfs_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/miscfs/genfs/genfs_vnops.c diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.216 src/sys/miscfs/genfs/genfs_vnops.c:1.217 --- src/sys/miscfs/genfs/genfs_vnops.c:1.216 Wed Oct 20 03:08:18 2021 +++ src/sys/miscfs/genfs/genfs_vnops.c Sat Mar 19 13:52:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_vnops.c,v 1.216 2021/10/20 03:08:18 thorpej Exp $ */ +/* $NetBSD: genfs_vnops.c,v 1.217 2022/03/19 13:52:45 hannken Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.216 2021/10/20 03:08:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.217 2022/03/19 13:52:45 hannken Exp $"); #include #include @@ -425,30 +425,6 @@ genfs_islocked(void *v) return 0; } -/* - * Stubs to use when there is no locking to be done on the underlying object. - */ -int -genfs_nolock(void *v) -{ - - return (0); -} - -int -genfs_nounlock(void *v) -{ - - return (0); -} - -int -genfs_noislocked(void *v) -{ - - return (0); -} - int genfs_mmap(void *v) {
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: hannken Date: Fri Mar 3 10:02:51 UTC 2023 Modified Files: src/sys/miscfs/genfs: genfs_vnops.c Log Message: Fix genfs_can_chtimes() to also handle the condition: If the time pointer is null, then write permission on the file is also sufficient. >From FreeBSD. Should fix PR kern/57246 "NFS group permissions regression" To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: hannken Date: Fri Mar 3 10:02:51 UTC 2023 Modified Files: src/sys/miscfs/genfs: genfs_vnops.c Log Message: Fix genfs_can_chtimes() to also handle the condition: If the time pointer is null, then write permission on the file is also sufficient. >From FreeBSD. Should fix PR kern/57246 "NFS group permissions regression" To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/sys/miscfs/genfs/genfs_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/miscfs/genfs/genfs_vnops.c diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.219 src/sys/miscfs/genfs/genfs_vnops.c:1.220 --- src/sys/miscfs/genfs/genfs_vnops.c:1.219 Sun Mar 27 17:10:55 2022 +++ src/sys/miscfs/genfs/genfs_vnops.c Fri Mar 3 10:02:51 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_vnops.c,v 1.219 2022/03/27 17:10:55 christos Exp $ */ +/* $NetBSD: genfs_vnops.c,v 1.220 2023/03/03 10:02:51 hannken Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.219 2022/03/27 17:10:55 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.220 2023/03/03 10:02:51 hannken Exp $"); #include #include @@ -1315,23 +1315,14 @@ genfs_can_chtimes(vnode_t *vp, kauth_cre * will be allowed to set the times [..] to the current * server time. */ - if ((error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred)) != 0) - return (vaflags & VA_UTIMES_NULL) == 0 ? EPERM : EACCES; - - /* Must be owner, or... */ - if (kauth_cred_geteuid(cred) == owner_uid) - return (0); - - /* set the times to the current time, and... */ - if ((vaflags & VA_UTIMES_NULL) == 0) - return (EPERM); + error = VOP_ACCESSX(vp, VWRITE_ATTRIBUTES, cred); + if (error != 0 && (vaflags & VA_UTIMES_NULL) != 0) + error = VOP_ACCESS(vp, VWRITE, cred); - /* have write access. */ - error = VOP_ACCESS(vp, VWRITE, cred); if (error) - return (error); + return (vaflags & VA_UTIMES_NULL) == 0 ? EPERM : EACCES; - return (0); + return 0; } /*
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: riastradh Date: Fri Jan 14 21:59:51 UTC 2022 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs(9): Prune dead branch. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/miscfs/genfs/genfs_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/miscfs/genfs/genfs_io.c diff -u src/sys/miscfs/genfs/genfs_io.c:1.101 src/sys/miscfs/genfs/genfs_io.c:1.102 --- src/sys/miscfs/genfs/genfs_io.c:1.101 Wed Aug 19 07:29:00 2020 +++ src/sys/miscfs/genfs/genfs_io.c Fri Jan 14 21:59:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_io.c,v 1.101 2020/08/19 07:29:00 simonb Exp $ */ +/* $NetBSD: genfs_io.c,v 1.102 2022/01/14 21:59:50 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.101 2020/08/19 07:29:00 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.102 2022/01/14 21:59:50 riastradh Exp $"); #include #include @@ -988,11 +988,8 @@ retry: */ if (nodirty) { -#if !defined(DEBUG) - if (dirtyonly) { - goto skip_scan; - } -#endif /* !defined(DEBUG) */ + /* We handled the dirtyonly && nodirty case above. */ + KASSERT(!dirtyonly); flags &= ~PGO_CLEANIT; } @@ -1331,10 +1328,6 @@ retry: vn_syncer_remove_from_worklist(vp); } -#if !defined(DEBUG) -skip_scan: -#endif /* !defined(DEBUG) */ - /* Wait for output to complete. */ rw_exit(slock); if (!wasclean && !async && vp->v_numoutput != 0) {
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: riastradh Date: Fri Jan 14 21:59:51 UTC 2022 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs(9): Prune dead branch. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: thorpej Date: Wed Oct 20 13:29:06 UTC 2021 Modified Files: src/sys/miscfs/genfs: genfs_rename.c Log Message: Don't use genfs_rename_knote() in the "rename foo over hard-link to itself" case, which simply results in removing the "from" name; there are assertions in genfs_rename_knote() that are too strong for that case. PR kern/56460 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/miscfs/genfs/genfs_rename.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: thorpej Date: Wed Oct 20 13:29:06 UTC 2021 Modified Files: src/sys/miscfs/genfs: genfs_rename.c Log Message: Don't use genfs_rename_knote() in the "rename foo over hard-link to itself" case, which simply results in removing the "from" name; there are assertions in genfs_rename_knote() that are too strong for that case. PR kern/56460 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/miscfs/genfs/genfs_rename.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/miscfs/genfs/genfs_rename.c diff -u src/sys/miscfs/genfs/genfs_rename.c:1.6 src/sys/miscfs/genfs/genfs_rename.c:1.7 --- src/sys/miscfs/genfs/genfs_rename.c:1.6 Wed Oct 20 03:08:18 2021 +++ src/sys/miscfs/genfs/genfs_rename.c Wed Oct 20 13:29:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_rename.c,v 1.6 2021/10/20 03:08:18 thorpej Exp $ */ +/* $NetBSD: genfs_rename.c,v 1.7 2021/10/20 13:29:06 thorpej Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_rename.c,v 1.6 2021/10/20 03:08:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_rename.c,v 1.7 2021/10/20 13:29:06 thorpej Exp $"); #include #include @@ -312,10 +312,14 @@ genfs_sane_rename(const struct genfs_ren fcnp->cn_namelen) == 0)) /* Renaming an entry over itself does nothing. */ error = 0; - else + else { /* XXX Can't use VOP_REMOVE because of locking. */ error = genfs_rename_remove(ops, mp, cred, fdvp, fcnp, fde, fvp, &tvp_new_nlink); + VN_KNOTE(fdvp, NOTE_WRITE); + VN_KNOTE(fvp, + tvp_new_nlink == 0 ? NOTE_DELETE : NOTE_LINK); + } goto out; } KASSERT(fvp != tvp); @@ -370,10 +374,9 @@ genfs_sane_rename(const struct genfs_ren goto out; /* Success! */ + genfs_rename_knote(fdvp, fvp, tdvp, tvp, tvp_new_nlink); -out: if (error == 0) { - genfs_rename_knote(fdvp, fvp, tdvp, tvp, tvp_new_nlink); - } +out: genfs_rename_exit(ops, mp, fdvp, fvp, tdvp, tvp); return error; }
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: riastradh Date: Sun Apr 9 12:26:36 UTC 2023 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs: KASSERT(A && B) -> KASSERT(A); KASSERT(B) To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/miscfs/genfs/genfs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: riastradh Date: Sun Apr 9 12:26:36 UTC 2023 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: genfs: KASSERT(A && B) -> KASSERT(A); KASSERT(B) To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/miscfs/genfs/genfs_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/miscfs/genfs/genfs_io.c diff -u src/sys/miscfs/genfs/genfs_io.c:1.102 src/sys/miscfs/genfs/genfs_io.c:1.103 --- src/sys/miscfs/genfs/genfs_io.c:1.102 Fri Jan 14 21:59:50 2022 +++ src/sys/miscfs/genfs/genfs_io.c Sun Apr 9 12:26:36 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_io.c,v 1.102 2022/01/14 21:59:50 riastradh Exp $ */ +/* $NetBSD: genfs_io.c,v 1.103 2023/04/09 12:26:36 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.102 2022/01/14 21:59:50 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.103 2023/04/09 12:26:36 riastradh Exp $"); #include #include @@ -184,7 +184,8 @@ startover: GOP_SIZE(vp, origvsize, &memeof, GOP_SIZE_MEM); } KASSERT(ap->a_centeridx >= 0 || ap->a_centeridx <= orignpages); - KASSERT((origoffset & (PAGE_SIZE - 1)) == 0 && origoffset >= 0); + KASSERT((origoffset & (PAGE_SIZE - 1)) == 0); + KASSERT(origoffset >= 0); KASSERT(orignpages > 0); /* @@ -890,7 +891,8 @@ genfs_do_putpages(struct vnode *vp, off_ UVMHIST_FUNC("genfs_putpages"); UVMHIST_CALLED(ubchist); KASSERT(origflags & (PGO_CLEANIT|PGO_FREE|PGO_DEACTIVATE)); - KASSERT((startoff & PAGE_MASK) == 0 && (endoff & PAGE_MASK) == 0); + KASSERT((startoff & PAGE_MASK) == 0); + KASSERT((endoff & PAGE_MASK) == 0); KASSERT(startoff < endoff || endoff == 0); KASSERT(rw_write_held(slock));
Re: CVS commit: src/sys/miscfs/genfs
> Log Message: > Revert part which variable initializations within interleaved gotos. > > again: > if (...) goto err; > void *ptr = alloc(); > if (...) goto again; > if (...) goto err1; > ... > err1: if (ptr) free(ptr); > err: > return; > > This leaks memory if exited with "goto again; -> goto err;". Actually it did NOT. Because the "if (...) goto again;" part carefully free()'ed the object. In the actual code: 312 if (vp->v_size < origvsize) { 313 rw_exit(&gp->g_glock); 314 if (pgs != pgs_onstack) 315 kmem_free(pgs, pgs_size); 316 goto startover; 317 } Masao -- Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635
Re: CVS commit: src/sys/miscfs/genfs
On Wed, Mar 12, 2014 at 09:39:23AM +, Juergen Hannken-Illjes wrote: > Module Name: src > Committed By: hannken > Date: Wed Mar 12 09:39:23 UTC 2014 > > Modified Files: > src/sys/miscfs/genfs: layer_vnops.c > > Log Message: > Restructure layer_lock() to always lock before testing for dead node. > Use ISSET() to test flags, add assertions. As I wrote in the manual page, I'd rather see ISSET(3) et. al. disappear, i.e. these obscure rather than clarify... - Jukka.
Re: CVS commit: src/sys/miscfs/genfs
Date: Wed, 12 Mar 2014 16:16:32 +0200 From: Jukka Ruohonen On Wed, Mar 12, 2014 at 09:39:23AM +, Juergen Hannken-Illjes wrote: > Restructure layer_lock() to always lock before testing for dead node. > Use ISSET() to test flags, add assertions. As I wrote in the manual page, I'd rather see ISSET(3) et. al. disappear, i.e. these obscure rather than clarify... I disagree. Phrases like `(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) == 0' make my head's parser stumble -- there are just enough complements to juggle that it overwhelms my brain registers for the fast path. I'd rather read `!ISSET(vp->v_iflag, (VI_XLOCK | VI_CLEAN))'.
Re: CVS commit: src/sys/miscfs/genfs
Taylor R Campbell writes: >Date: Wed, 12 Mar 2014 16:16:32 +0200 >From: Jukka Ruohonen > >On Wed, Mar 12, 2014 at 09:39:23AM +, Juergen Hannken-Illjes wrote: >> Restructure layer_lock() to always lock before testing for dead node. >> Use ISSET() to test flags, add assertions. > >As I wrote in the manual page, I'd rather see ISSET(3) et. al. disappear, >i.e. these obscure rather than clarify... > > I disagree. Phrases like `(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) == 0' > make my head's parser stumble -- there are just enough complements to > juggle that it overwhelms my brain registers for the fast path. I'd > rather read `!ISSET(vp->v_iflag, (VI_XLOCK | VI_CLEAN))'. FWIW, I agree with Taylor. pgpSzcZOop3yS.pgp Description: PGP signature
Re: CVS commit: src/sys/miscfs/genfs
On Wed, 12 Mar 2014, Greg Troxel wrote: Taylor R Campbell writes: Date: Wed, 12 Mar 2014 16:16:32 +0200 From: Jukka Ruohonen On Wed, Mar 12, 2014 at 09:39:23AM +, Juergen Hannken-Illjes wrote: > Restructure layer_lock() to always lock before testing for dead node. > Use ISSET() to test flags, add assertions. As I wrote in the manual page, I'd rather see ISSET(3) et. al. disappear, i.e. these obscure rather than clarify... I disagree. Phrases like `(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) == 0' make my head's parser stumble -- there are just enough complements to juggle that it overwhelms my brain registers for the fast path. I'd rather read `!ISSET(vp->v_iflag, (VI_XLOCK | VI_CLEAN))'. FWIW, I agree with Taylor. Me, too. But I'd rather that we had the equivalent ISCLR() macro, too, to remove another negation/complement. BTW, why do we have man pages for isset(9)/isclr(9)/setbit(9)/clrbit(9) and then a separate page for SET(9)? And why do we not have manlinks for ISSET(9) and ISCLR(9)? And no cross-refs? :) :) :) - | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com| | Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net | | Kernel Developer | | pgoyette at netbsd.org | -
Re: CVS commit: src/sys/miscfs/genfs
Paul Goyette writes: > Me, too. But I'd rather that we had the equivalent ISCLR() macro, too, > to remove another negation/complement. So is ISCLR when passed two bits true if both are clear, or if it's just not the case that both are set? Arguably this points out that the ISSET docs should explain about using 2 bits at once. pgpZNQF7rHjXV.pgp Description: PGP signature
Re: CVS commit: src/sys/miscfs/genfs
On Wed, 12 Mar 2014, Greg Troxel wrote: Paul Goyette writes: Me, too. But I'd rather that we had the equivalent ISCLR() macro, too, to remove another negation/complement. So is ISCLR when passed two bits true if both are clear, or if it's just not the case that both are set? Arguably this points out that the ISSET docs should explain about using 2 bits at once. Or might we need ISANYCLR() vs ISALLCLR() (technically, AREALLCLR() but that's just an English grammar nit!) :) - | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com| | Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net | | Kernel Developer | | pgoyette at netbsd.org | -
Re: CVS commit: src/sys/miscfs/genfs
Taylor R Campbell wrote: >Date: Wed, 12 Mar 2014 16:16:32 +0200 >From: Jukka Ruohonen > >On Wed, Mar 12, 2014 at 09:39:23AM +, Juergen Hannken-Illjes wrote: >> Restructure layer_lock() to always lock before testing for dead node. >> Use ISSET() to test flags, add assertions. > >As I wrote in the manual page, I'd rather see ISSET(3) et. al. > disappear, i.e. these obscure rather than clarify... > > I disagree. Phrases like `(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) == 0' > make my head's parser stumble -- there are just enough complements to > juggle that it overwhelms my brain registers for the fast path. I'd > rather read `!ISSET(vp->v_iflag, (VI_XLOCK | VI_CLEAN))'. I disagree. For kernel developers, that kind of bitwise arithmetics and masking ought to be intuitive. If there is more logic and it gets long, then separate it: const bool foobar = (mask & (FOO | BAR)) == 0; const bool baz = (mask & BAZ) != 0; if (foobar && baz) ... ISSET() is somewhat okay (although I do not use it), but I particularly dislike __BIT() as I forget whether the 1st bit is n = 0 or whether this API tries to be fancy and it is n = 1. 1U << n is just straigtforward. -- Mindaugas
Re: CVS commit: src/sys/miscfs/genfs
On Thu, Mar 13, 2014 at 12:32:38AM +0900, Mindaugas Rasiukevicius wrote: > Taylor R Campbell wrote: > >Date: Wed, 12 Mar 2014 16:16:32 +0200 > >From: Jukka Ruohonen > > > >On Wed, Mar 12, 2014 at 09:39:23AM +, Juergen Hannken-Illjes wrote: > >> Restructure layer_lock() to always lock before testing for dead node. > >> Use ISSET() to test flags, add assertions. > > > >As I wrote in the manual page, I'd rather see ISSET(3) et. al. > > disappear, i.e. these obscure rather than clarify... > > > > I disagree. Phrases like `(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) == 0' > > make my head's parser stumble -- there are just enough complements to > > juggle that it overwhelms my brain registers for the fast path. I'd > > rather read `!ISSET(vp->v_iflag, (VI_XLOCK | VI_CLEAN))'. > > I disagree. For kernel developers, that kind of bitwise arithmetics and > masking ought to be intuitive. If there is more logic and it gets long, > then separate it: > > const bool foobar = (mask & (FOO | BAR)) == 0; > const bool baz = (mask & BAZ) != 0; > > if (foobar && baz) ... Except you really don't want the compiler to convert the value to a 'bool'. > ISSET() is somewhat okay (although I do not use it), but I particularly > dislike __BIT() as I forget whether the 1st bit is n = 0 or whether this > API tries to be fancy and it is n = 1. 1U << n is just straigtforward. Or number from the other end... Indeed, I have to go away and find the definitions and then realise that they are just longhand! I don't normally compare bit masking against zero, just: if (var & BIT) or if (!(var & BIT)) to me they read better that way. David -- David Laight: da...@l8s.co.uk
Re: CVS commit: src/sys/miscfs/genfs
On Wed, Mar 12, 2014 at 08:11:26AM -0700, Paul Goyette wrote: > >>Me, too. But I'd rather that we had the equivalent ISCLR() macro, too, > >>to remove another negation/complement. > > > >So is ISCLR when passed two bits true if both are clear, or if it's just > >not the case that both are set? > > > >Arguably this points out that the ISSET docs should explain about using > >2 bits at once. > > Or might we need ISANYCLR() vs ISALLCLR() (technically, AREALLCLR() > but that's just an English grammar nit!) > > :) By the time you finish with that you just have an alternate and less legible expression syntax... If it were me I'd rewrite the offending code to not use flag bits at all - bitfields generate equally good code in modern compilers and are much less likely to cause confusion. -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/sys/miscfs/genfs
On Thu, Mar 13, 2014 at 04:01:33AM +, David Holland wrote: > On Wed, Mar 12, 2014 at 08:11:26AM -0700, Paul Goyette wrote: > > >>Me, too. But I'd rather that we had the equivalent ISCLR() macro, too, > > >>to remove another negation/complement. > > > > > >So is ISCLR when passed two bits true if both are clear, or if it's just > > >not the case that both are set? > > > > > >Arguably this points out that the ISSET docs should explain about using > > >2 bits at once. > > > > Or might we need ISANYCLR() vs ISALLCLR() (technically, AREALLCLR() > > but that's just an English grammar nit!) > > > > :) > > By the time you finish with that you just have an alternate and less > legible expression syntax... Indeed, cf. iso646(3) :). - Jukka.
Re: CVS commit: src/sys/miscfs/genfs
Roy Marples wrote: > Module Name: src > Committed By: roy > Date: Fri Nov 20 13:42:43 UTC 2009 > > Modified Files: > src/sys/miscfs/genfs: genfs_vnops.c > > Log Message: > Allow chown if caller is in the new group. Is it possible now to do something like chown me:users /etc/passwd ? Christoph