CVS commit: src/sys/fs

2010-01-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Jan 26 21:29:48 UTC 2010

Modified Files:
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Drop two uses of disk label data.

msdosfs and cd9660 are the only filesystems that verify the filesystem
type in the label. This is the wrong place, sanity checks should only
rely on the inner structure of the filesystem (like signatures or
magic numbers).

msdosfs also used the device type information from the label to
deduce a filesystem parameter heuristically for the gemdos variant.
If there is no information inside the filesystem data itself, this
should be an explicit mount option.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.77 -r1.78 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:33:07 UTC 2022

Modified Files:
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/udf: udf_vfsops.c

Log Message:
Lock devvp for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/udf/udf_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:33:07 UTC 2022

Modified Files:
src/sys/fs/cd9660: cd9660_vfsops.c
src/sys/fs/udf: udf_vfsops.c

Log Message:
Lock devvp for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/fs/cd9660/cd9660_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/udf/udf_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/cd9660/cd9660_vfsops.c
diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.96 src/sys/fs/cd9660/cd9660_vfsops.c:1.97
--- src/sys/fs/cd9660/cd9660_vfsops.c:1.96	Sat Apr  4 20:49:30 2020
+++ src/sys/fs/cd9660/cd9660_vfsops.c	Tue May  3 07:33:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vfsops.c,v 1.96 2020/04/04 20:49:30 ad Exp $	*/
+/*	$NetBSD: cd9660_vfsops.c,v 1.97 2022/05/03 07:33:07 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.96 2020/04/04 20:49:30 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.97 2022/05/03 07:33:07 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -358,7 +358,10 @@ iso_mountfs(struct vnode *devvp, struct 
 		return EROFS;
 
 	/* Flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error != 0)
 		return (error);
 
 	/* This is the "logical sector size".  The standard says this

Index: src/sys/fs/udf/udf_vfsops.c
diff -u src/sys/fs/udf/udf_vfsops.c:1.84 src/sys/fs/udf/udf_vfsops.c:1.85
--- src/sys/fs/udf/udf_vfsops.c:1.84	Wed Mar 23 13:06:06 2022
+++ src/sys/fs/udf/udf_vfsops.c	Tue May  3 07:33:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vfsops.c,v 1.84 2022/03/23 13:06:06 andvar Exp $ */
+/* $NetBSD: udf_vfsops.c,v 1.85 2022/05/03 07:33:07 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.84 2022/03/23 13:06:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.85 2022/05/03 07:33:07 hannken Exp $");
 #endif /* not lint */
 
 
@@ -574,7 +574,10 @@ udf_mountfs(struct vnode *devvp, struct 
 	intnum_anchors, error;
 
 	/* flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)))
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error)
 		return error;
 
 	/* setup basic mount information */



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:34:38 UTC 2022

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vfsops.c
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/sysvbfs/sysvbfs_vfsops.c
cvs rdiff -u -r1.18 -r1.19 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.



CVS commit: src/sys/fs

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:34:38 UTC 2022

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vfsops.c
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/fs/sysvbfs/sysvbfs_vfsops.c
cvs rdiff -u -r1.18 -r1.19 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/sysvbfs/sysvbfs_vfsops.c
diff -u src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.47 src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.48
--- src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.47	Fri Jan 17 20:08:08 2020
+++ src/sys/fs/sysvbfs/sysvbfs_vfsops.c	Tue May  3 07:34:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs_vfsops.c,v 1.47 2020/01/17 20:08:08 ad Exp $	*/
+/*	$NetBSD: sysvbfs_vfsops.c,v 1.48 2022/05/03 07:34:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.47 2020/01/17 20:08:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.48 2022/05/03 07:34:38 hannken Exp $");
 
 #include 
 #include 
@@ -139,9 +139,11 @@ sysvbfs_mount(struct mount *mp, const ch
 		(mp->mnt_flag & MNT_RDONLY) == 0)
 			accessmode |= VWRITE;
 
+		vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
 		error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
 		KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
 		KAUTH_ARG(accessmode));
+		VOP_UNLOCK(devvp);
 	}
 
 	if (error) {

Index: src/sys/fs/v7fs/v7fs_vfsops.c
diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.18 src/sys/fs/v7fs/v7fs_vfsops.c:1.19
--- src/sys/fs/v7fs/v7fs_vfsops.c:1.18	Sat Feb  5 14:11:52 2022
+++ src/sys/fs/v7fs/v7fs_vfsops.c	Tue May  3 07:34:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vfsops.c,v 1.18 2022/02/05 14:11:52 zafer Exp $	*/
+/*	$NetBSD: v7fs_vfsops.c,v 1.19 2022/05/03 07:34:38 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.18 2022/02/05 14:11:52 zafer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.19 2022/05/03 07:34:38 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -157,9 +157,12 @@ v7fs_mount(struct mount *mp, const char 
 		(mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
 		(mp->mnt_flag & MNT_RDONLY) == 0)
 			accessmode |= VWRITE;
+
+		vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
 		error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
 		KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
 		KAUTH_ARG(accessmode));
+		VOP_UNLOCK(devvp);
 	}
 
 	if (error) {



CVS commit: src/sys/fs

2022-07-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul 31 13:08:19 UTC 2022

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vnops.c
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Don't panic for a negative offset, just fail the operation with EINVAL.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/fs/sysvbfs/sysvbfs_vnops.c
cvs rdiff -u -r1.37 -r1.38 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.



CVS commit: src/sys/fs

2022-07-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul 31 13:08:19 UTC 2022

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vnops.c
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Don't panic for a negative offset, just fail the operation with EINVAL.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/fs/sysvbfs/sysvbfs_vnops.c
cvs rdiff -u -r1.37 -r1.38 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/sysvbfs/sysvbfs_vnops.c
diff -u src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.68 src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.69
--- src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.68	Wed Oct 20 03:08:17 2021
+++ src/sys/fs/sysvbfs/sysvbfs_vnops.c	Sun Jul 31 13:08:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs_vnops.c,v 1.68 2021/10/20 03:08:17 thorpej Exp $	*/
+/*	$NetBSD: sysvbfs_vnops.c,v 1.69 2022/07/31 13:08:18 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.68 2021/10/20 03:08:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.69 2022/07/31 13:08:18 mlelstv Exp $");
 
 #include 
 #include 
@@ -632,7 +632,9 @@ sysvbfs_readdir(void *v)
 	uio->uio_offset, uio->uio_resid);
 
 	KDASSERT(vp->v_type == VDIR);
-	KDASSERT(uio->uio_offset >= 0);
+
+	if (uio->uio_offset < 0)
+		return EINVAL;
 
 	dp = malloc(sizeof(struct dirent), M_BFS, M_WAITOK | M_ZERO);
 

Index: src/sys/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.37 src/sys/fs/v7fs/v7fs_vnops.c:1.38
--- src/sys/fs/v7fs/v7fs_vnops.c:1.37	Sun May 22 11:27:36 2022
+++ src/sys/fs/v7fs/v7fs_vnops.c	Sun Jul 31 13:08:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.37 2022/05/22 11:27:36 andvar Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.38 2022/07/31 13:08:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.37 2022/05/22 11:27:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.38 2022/07/31 13:08:19 mlelstv Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -996,9 +996,11 @@ v7fs_readdir(void *v)
 	DPRINTF("offset=%zu residue=%zu\n", uio->uio_offset, uio->uio_resid);
 
 	KDASSERT(vp->v_type == VDIR);
-	KDASSERT(uio->uio_offset >= 0);
 	KDASSERT(v7fs_inode_isdir(inode));
 
+	if (uio->uio_offset  < 0)
+		return EINVAL;
+
 	struct v7fs_readdir_arg arg;
 	arg.start = uio->uio_offset / sizeof(*dp);
 	arg.end = arg.start +  uio->uio_resid / sizeof(*dp);



CVS commit: src/sys/fs

2022-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep 12 13:11:41 UTC 2022

Modified Files:
src/sys/fs/union: union_vfsops.c
src/sys/fs/unionfs: unionfs_vfsops.c

Log Message:
kmem_alloc -> kmem_zalloc, thanks Rin.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/unionfs/unionfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs

2022-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep 12 13:11:41 UTC 2022

Modified Files:
src/sys/fs/union: union_vfsops.c
src/sys/fs/unionfs: unionfs_vfsops.c

Log Message:
kmem_alloc -> kmem_zalloc, thanks Rin.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/unionfs/unionfs_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/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.82 src/sys/fs/union/union_vfsops.c:1.83
--- src/sys/fs/union/union_vfsops.c:1.82	Sun Sep 11 11:42:29 2022
+++ src/sys/fs/union/union_vfsops.c	Mon Sep 12 09:11:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.82 2022/09/11 15:42:29 christos Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.83 2022/09/12 13:11:41 christos Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.82 2022/09/11 15:42:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.83 2022/09/12 13:11:41 christos Exp $");
 
 #include 
 #include 
@@ -423,7 +423,7 @@ union_statvfs(struct mount *mp, struct s
 {
 	int error;
 	struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
-	struct statvfs *sbuf = kmem_alloc(sizeof(*sbuf), KM_SLEEP);
+	struct statvfs *sbuf = kmem_zalloc(sizeof(*sbuf), KM_SLEEP);
 	unsigned long lbsize;
 
 #ifdef UNION_DIAGNOSTIC

Index: src/sys/fs/unionfs/unionfs_vfsops.c
diff -u src/sys/fs/unionfs/unionfs_vfsops.c:1.15 src/sys/fs/unionfs/unionfs_vfsops.c:1.16
--- src/sys/fs/unionfs/unionfs_vfsops.c:1.15	Sun Sep 11 12:42:07 2022
+++ src/sys/fs/unionfs/unionfs_vfsops.c	Mon Sep 12 09:11:41 2022
@@ -392,7 +392,7 @@ unionfs_statvfs(struct mount *mp, struct
 	struct unionfs_mount *ump;
 	int		error;
 	uint64_t	lbsize;
-	struct statvfs *sbuf = kmem_alloc(sizeof(*sbuf), KM_SLEEP);
+	struct statvfs *sbuf = kmem_zalloc(sizeof(*sbuf), KM_SLEEP);
 
 	ump = MOUNTTOUNIONFSMOUNT(mp);
 



CVS commit: src/sys/fs/cd9660

2019-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jul 12 17:18:30 UTC 2019

Modified Files:
src/sys/fs/cd9660: cd9660_vnops.c

Log Message:
Fix info leak: zero out the buffer, because it is not entirely filled, and
the uninitialized bytes get copied to userland in sys___getdens30(). Remove
unneeded cast while here.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/fs/cd9660/cd9660_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/fs/cd9660

2019-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jul 12 17:18:30 UTC 2019

Modified Files:
src/sys/fs/cd9660: cd9660_vnops.c

Log Message:
Fix info leak: zero out the buffer, because it is not entirely filled, and
the uninitialized bytes get copied to userland in sys___getdens30(). Remove
unneeded cast while here.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/fs/cd9660/cd9660_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/cd9660/cd9660_vnops.c
diff -u src/sys/fs/cd9660/cd9660_vnops.c:1.54 src/sys/fs/cd9660/cd9660_vnops.c:1.55
--- src/sys/fs/cd9660/cd9660_vnops.c:1.54	Sat Mar 12 02:36:25 2016
+++ src/sys/fs/cd9660/cd9660_vnops.c	Fri Jul 12 17:18:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vnops.c,v 1.54 2016/03/12 02:36:25 christos Exp $	*/
+/*	$NetBSD: cd9660_vnops.c,v 1.55 2019/07/12 17:18:30 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.54 2016/03/12 02:36:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.55 2019/07/12 17:18:30 maxv Exp $");
 
 #include 
 #include 
@@ -399,7 +399,7 @@ cd9660_readdir(void *v)
 	imp = dp->i_mnt;
 	bmask = imp->im_bmask;
 
-	idp = (struct isoreaddir *)malloc(sizeof(*idp), M_TEMP, M_WAITOK);
+	idp = malloc(sizeof(*idp), M_TEMP, M_WAITOK | M_ZERO);
 	idp->saveent.d_namlen = idp->assocent.d_namlen = 0;
 	/*
 	 * XXX



CVS commit: src/sys/fs/tmpfs

2019-07-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jul 13 14:24:37 UTC 2019

Modified Files:
src/sys/fs/tmpfs: tmpfs_mem.c

Log Message:
Remove the roundups, they are incorrect and cause memcmp to wrongfully fail
because of uninitialized bytes at the end of the buffers.

ok rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/fs/tmpfs/tmpfs_mem.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/tmpfs/tmpfs_mem.c
diff -u src/sys/fs/tmpfs/tmpfs_mem.c:1.9 src/sys/fs/tmpfs/tmpfs_mem.c:1.10
--- src/sys/fs/tmpfs/tmpfs_mem.c:1.9	Mon Aug 22 23:07:36 2016
+++ src/sys/fs/tmpfs/tmpfs_mem.c	Sat Jul 13 14:24:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_mem.c,v 1.9 2016/08/22 23:07:36 skrll Exp $	*/
+/*	$NetBSD: tmpfs_mem.c,v 1.10 2019/07/13 14:24:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_mem.c,v 1.9 2016/08/22 23:07:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_mem.c,v 1.10 2019/07/13 14:24:37 maxv Exp $");
 
 #include 
 #include 
@@ -234,8 +234,8 @@ tmpfs_strname_free(struct tmpfs_mount *m
 bool
 tmpfs_strname_neqlen(struct componentname *fcnp, struct componentname *tcnp)
 {
-	const size_t fln = roundup2(fcnp->cn_namelen, TMPFS_NAME_QUANTUM);
-	const size_t tln = roundup2(tcnp->cn_namelen, TMPFS_NAME_QUANTUM);
+	const size_t fln = fcnp->cn_namelen;
+	const size_t tln = tcnp->cn_namelen;
 
 	return (fln != tln) || memcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fln);
 }



CVS commit: src/sys/fs/tmpfs

2019-07-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jul 13 14:24:37 UTC 2019

Modified Files:
src/sys/fs/tmpfs: tmpfs_mem.c

Log Message:
Remove the roundups, they are incorrect and cause memcmp to wrongfully fail
because of uninitialized bytes at the end of the buffers.

ok rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/fs/tmpfs/tmpfs_mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/tmpfs

2019-07-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul 14 05:58:44 UTC 2019

Modified Files:
src/sys/fs/tmpfs: tmpfs_rename.c

Log Message:
Fix uninitialized variable: if 'tvp' is NULL, '*tdep' is not initialized.
This could have caused the KASSERT to wrongfully fire.

ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/tmpfs/tmpfs_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/fs/tmpfs

2019-07-13 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul 14 05:58:44 UTC 2019

Modified Files:
src/sys/fs/tmpfs: tmpfs_rename.c

Log Message:
Fix uninitialized variable: if 'tvp' is NULL, '*tdep' is not initialized.
This could have caused the KASSERT to wrongfully fire.

ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/tmpfs/tmpfs_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/fs/tmpfs/tmpfs_rename.c
diff -u src/sys/fs/tmpfs/tmpfs_rename.c:1.8 src/sys/fs/tmpfs/tmpfs_rename.c:1.9
--- src/sys/fs/tmpfs/tmpfs_rename.c:1.8	Mon Jul  6 10:24:59 2015
+++ src/sys/fs/tmpfs/tmpfs_rename.c	Sun Jul 14 05:58:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_rename.c,v 1.8 2015/07/06 10:24:59 wiz Exp $	*/
+/*	$NetBSD: tmpfs_rename.c,v 1.9 2019/07/14 05:58:44 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_rename.c,v 1.8 2015/07/06 10:24:59 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_rename.c,v 1.9 2019/07/14 05:58:44 maxv Exp $");
 
 #include 
 #include 
@@ -282,7 +282,7 @@ tmpfs_gro_rename(struct mount *mp, kauth
 	KASSERT(tcnp != NULL);
 	KASSERT(tdep != NULL);
 	KASSERT(fdep != tdep);
-	KASSERT((*fdep) != (*tdep));
+	KASSERT((tvp == NULL) || (*fdep) != (*tdep));
 	KASSERT((*fdep) != NULL);
 	KASSERT((*fdep)->td_node == VP_TO_TMPFS_NODE(fvp));
 	KASSERT((tvp == NULL) || ((*tdep) != NULL));



CVS commit: src/sys/fs/msdosfs

2010-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jan 25 15:30:44 UTC 2010

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Fetch sector size also from wedges.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/msdosfs

2010-01-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jan 26 20:25:52 UTC 2010

Modified Files:
src/sys/fs/msdosfs: msdosfs_fat.c

Log Message:
On broken filesystems the fillinmap inner loop may have never read a
block, so don't try to release it if bp==NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/msdosfs/msdosfs_fat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/msdosfs

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 10:30:41 UTC 2010

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Replace individual queries for partition information with
new helper function.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/puffs

2010-02-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Feb 17 14:32:08 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_vfsops.c

Log Message:
* add a rant about why MPSAFE isn't enabled even though puffs code is
* predict_false that we are mounting when calling statvfs
* KNF


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/fs/puffs/puffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2010-02-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb 24 19:14:12 UTC 2010

Modified Files:
src/sys/fs/udf: udf.h udf_subr.c

Log Message:
Extract UDF metadata partition parameters as already done for VAT and sparable
partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.101 -r1.102 src/sys/fs/udf/udf_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2010-02-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb 24 19:20:13 UTC 2010

Modified Files:
src/sys/fs/udf: udf.h udf_subr.c

Log Message:
Rename metadata partition parameters to be less generic and add the flags.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.102 -r1.103 src/sys/fs/udf/udf_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2010-02-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Feb 25 16:15:58 UTC 2010

Modified Files:
src/sys/fs/udf: udf.h udf_allocation.c udf_subr.c udf_subr.h

Log Message:
First part of shrinking/growing metadata partition support:

- extending the metadata partition

Still to follow:
- sparsify metadata partition
- growing the metadata partition
- unsparsifying metadata partition


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.27 -r1.28 src/sys/fs/udf/udf_allocation.c
cvs rdiff -u -r1.103 -r1.104 src/sys/fs/udf/udf_subr.c
cvs rdiff -u -r1.17 -r1.18 src/sys/fs/udf/udf_subr.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2010-02-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Feb 26 09:57:39 UTC 2010

Modified Files:
src/sys/fs/udf: udf_allocation.c

Log Message:
Typo and style


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/fs/udf/udf_allocation.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2010-02-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Feb 26 09:57:39 UTC 2010

Modified Files:
src/sys/fs/udf: udf_allocation.c

Log Message:
Typo and style


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/fs/udf/udf_allocation.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/udf/udf_allocation.c
diff -u src/sys/fs/udf/udf_allocation.c:1.28 src/sys/fs/udf/udf_allocation.c:1.29
--- src/sys/fs/udf/udf_allocation.c:1.28	Thu Feb 25 16:15:57 2010
+++ src/sys/fs/udf/udf_allocation.c	Fri Feb 26 09:57:39 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_allocation.c,v 1.28 2010/02/25 16:15:57 reinoud Exp $ */
+/* $NetBSD: udf_allocation.c,v 1.29 2010/02/26 09:57:39 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.28 2010/02/25 16:15:57 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.29 2010/02/26 09:57:39 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -1499,7 +1499,7 @@
 	DPRINTF(RESERVE, ("\tfree space on metadata partition %"PRIu64" blks\n", meta_free_lbs));
 
 	/* give away some of the free meta space, in unit block sizes */
-	to_trunc = meta_free_lbs/4;			/* give out a quart */
+	to_trunc = meta_free_lbs/4;			/* give out a quarter */
 	to_trunc = MAX(to_trunc, num_lb);
 	to_trunc = unit * ((to_trunc + unit-1) / unit);	/* round up */
 
@@ -1534,7 +1534,6 @@
 	sbd->num_bytes = udf_rw32(sbd->num_bytes) - to_trunc/8;
 	bitmap->max_offset = udf_rw32(sbd->num_bits);
 
-
 	num_vpart = udf_rw32(lvid->num_part);
 	freepos = &lvid->tables[0] + meta_vpart_num;
 	sizepos = &lvid->tables[0] + num_vpart + meta_vpart_num;



CVS commit: src/sys/fs/ptyfs

2019-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 26 18:35:48 UTC 2019

Modified Files:
src/sys/fs/ptyfs: ptyfs_vnops.c

Log Message:
cast VNOVAL to the the va_size type which is u_quad_t... I think it is time
to change this to uint64_t...


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/ptyfs/ptyfs_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/ptyfs/ptyfs_vnops.c
diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.55 src/sys/fs/ptyfs/ptyfs_vnops.c:1.56
--- src/sys/fs/ptyfs/ptyfs_vnops.c:1.55	Mon Sep  3 12:29:35 2018
+++ src/sys/fs/ptyfs/ptyfs_vnops.c	Thu Sep 26 14:35:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptyfs_vnops.c,v 1.55 2018/09/03 16:29:35 riastradh Exp $	*/
+/*	$NetBSD: ptyfs_vnops.c,v 1.56 2019/09/26 18:35:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1993, 1995
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.55 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.56 2019/09/26 18:35:48 christos Exp $");
 
 #include 
 #include 
@@ -405,7 +405,7 @@ ptyfs_setattr(void *v)
 	kauth_action_t action = KAUTH_VNODE_WRITE_FLAGS;
 	bool changing_sysflags = false;
 
-	if (vap->va_size != VNOVAL) {
+	if (vap->va_size != (u_quad_t)VNOVAL) {
  		switch (ptyfs->ptyfs_type) {
  		case PTYFSroot:
  			return EISDIR;
@@ -417,7 +417,7 @@ ptyfs_setattr(void *v)
 		}
 	}
 
-	if (vap->va_flags != VNOVAL) {
+	if (vap->va_flags != (u_quad_t)VNOVAL) {
 		if (vp->v_mount->mnt_flag & MNT_RDONLY)
 			return EROFS;
 



CVS commit: src/sys/fs/ptyfs

2019-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 26 18:35:48 UTC 2019

Modified Files:
src/sys/fs/ptyfs: ptyfs_vnops.c

Log Message:
cast VNOVAL to the the va_size type which is u_quad_t... I think it is time
to change this to uint64_t...


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/ptyfs/ptyfs_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/fs/puffs

2019-09-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 27 22:36:57 UTC 2019

Modified Files:
src/sys/fs/puffs: puffs_vfsops.c

Log Message:
Fix copying issue that was causing errors in unit_test puffs_tstavfs by
removing code.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/fs/puffs/puffs_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/puffs/puffs_vfsops.c
diff -u src/sys/fs/puffs/puffs_vfsops.c:1.122 src/sys/fs/puffs/puffs_vfsops.c:1.123
--- src/sys/fs/puffs/puffs_vfsops.c:1.122	Mon Sep 23 08:00:57 2019
+++ src/sys/fs/puffs/puffs_vfsops.c	Fri Sep 27 18:36:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vfsops.c,v 1.122 2019/09/23 12:00:57 christos Exp $	*/
+/*	$NetBSD: puffs_vfsops.c,v 1.123 2019/09/27 22:36:57 christos Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.122 2019/09/23 12:00:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.123 2019/09/27 22:36:57 christos Exp $");
 
 #include 
 #include 
@@ -501,14 +501,9 @@ puffs_vfsop_statvfs(struct mount *mp, st
 	 *
 	 * XXX: cache the copy in non-error case
 	 */
+	copy_statvfs_info(sbp, mp);
 	if (!error) {
-		struct statvfs *sb = STATVFSBUF_GET();
-		puffs_statvfs_to_statvfs(&statvfs_msg->pvfsr_sb, sb);
-		copy_statvfs_info(sb, mp);
-		STATVFSBUF_PUT(sb);
 		statvfs_to_puffs_statvfs(sbp, &statvfs_msg->pvfsr_sb);
-	} else {
-		copy_statvfs_info(sbp, mp);
 	}
 
 	PUFFS_MSG_RELEASE(statvfs);



CVS commit: src/sys/fs/puffs

2019-09-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 27 22:36:57 UTC 2019

Modified Files:
src/sys/fs/puffs: puffs_vfsops.c

Log Message:
Fix copying issue that was causing errors in unit_test puffs_tstavfs by
removing code.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/fs/puffs/puffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/tmpfs

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:34:40 UTC 2019

Modified Files:
src/sys/fs/tmpfs: tmpfs_vfsops.c

Log Message:
remove an always false check and its' "This can never happen?" comment.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/tmpfs/tmpfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/tmpfs

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 12:34:40 UTC 2019

Modified Files:
src/sys/fs/tmpfs: tmpfs_vfsops.c

Log Message:
remove an always false check and its' "This can never happen?" comment.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/tmpfs/tmpfs_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/tmpfs/tmpfs_vfsops.c
diff -u src/sys/fs/tmpfs/tmpfs_vfsops.c:1.74 src/sys/fs/tmpfs/tmpfs_vfsops.c:1.75
--- src/sys/fs/tmpfs/tmpfs_vfsops.c:1.74	Tue Jan  1 10:06:54 2019
+++ src/sys/fs/tmpfs/tmpfs_vfsops.c	Fri Oct  4 12:34:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vfsops.c,v 1.74 2019/01/01 10:06:54 hannken Exp $	*/
+/*	$NetBSD: tmpfs_vfsops.c,v 1.75 2019/10/04 12:34:40 mrg Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.74 2019/01/01 10:06:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.75 2019/10/04 12:34:40 mrg Exp $");
 
 #include 
 #include 
@@ -132,10 +132,6 @@ tmpfs_mount(struct mount *mp, const char
 	if (args->ta_root_uid == VNOVAL || args->ta_root_gid == VNOVAL)
 		return EINVAL;
 
-	/* This can never happen? */
-	if ((args->ta_root_mode & ALLPERMS) == VNOVAL)
-		return EINVAL;
-
 	/* Get the memory usage limit for this file-system. */
 	if (args->ta_size_max < PAGE_SIZE) {
 		memlimit = UINT64_MAX;



CVS commit: src/sys/fs/udf

2022-03-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Mar  8 10:52:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_strat_sequential.c

Log Message:
On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/udf/udf_strat_sequential.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-03-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Mar  8 10:52:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_strat_sequential.c

Log Message:
On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/udf/udf_strat_sequential.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/udf/udf_strat_sequential.c
diff -u src/sys/fs/udf/udf_strat_sequential.c:1.15 src/sys/fs/udf/udf_strat_sequential.c:1.16
--- src/sys/fs/udf/udf_strat_sequential.c:1.15	Tue May 24 09:55:57 2016
+++ src/sys/fs/udf/udf_strat_sequential.c	Tue Mar  8 10:52:43 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_strat_sequential.c,v 1.15 2016/05/24 09:55:57 reinoud Exp $ */
+/* $NetBSD: udf_strat_sequential.c,v 1.16 2022/03/08 10:52:43 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_strat_sequential.c,v 1.15 2016/05/24 09:55:57 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_strat_sequential.c,v 1.16 2022/03/08 10:52:43 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -549,6 +549,8 @@ udf_doshedule(struct udf_mount *ump)
 	if (new_queue != priv->cur_queue) {
 		DPRINTF(SHEDULE, ("switching from %d to %d\n",
 			priv->cur_queue, new_queue));
+		if (new_queue == UDF_SHED_READING)
+			udf_mmc_synchronise_caches(ump);
 	}
 
 	priv->cur_queue = new_queue;



CVS commit: src/sys/fs/udf

2022-03-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Mar  8 18:30:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_subr.c

Log Message:
For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track.  To allow for scratches, write out at least
a 32 pieces.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/fs/udf/udf_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-03-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Mar  8 18:30:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_subr.c

Log Message:
For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track.  To allow for scratches, write out at least
a 32 pieces.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/fs/udf/udf_subr.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/udf/udf_subr.c
diff -u src/sys/fs/udf/udf_subr.c:1.166 src/sys/fs/udf/udf_subr.c:1.167
--- src/sys/fs/udf/udf_subr.c:1.166	Sun Feb  6 20:20:19 2022
+++ src/sys/fs/udf/udf_subr.c	Tue Mar  8 18:30:43 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.166 2022/02/06 20:20:19 andvar Exp $ */
+/* $NetBSD: udf_subr.c,v 1.167 2022/03/08 18:30:43 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.166 2022/02/06 20:20:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.167 2022/03/08 18:30:43 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -3797,10 +3797,11 @@ udf_close_logvol(struct udf_mount *ump, 
 {
 	struct vnode *devvp = ump->devvp;
 	struct mmc_op mmc_op;
+	uint32_t phys;
 	int logvol_integrity;
 	int error = 0, error1 = 0, error2 = 0;
 	int tracknr;
-	int nvats, n, nok;
+	int nvats, n, relblk, wrtrack_skew, nok;
 
 	/* already/still closed? */
 	logvol_integrity = udf_rw32(ump->logvol_integrity->integrity_type);
@@ -3821,8 +3822,17 @@ udf_close_logvol(struct udf_mount *ump, 
 		DPRINTF(VOLUMES, ("writeout vat_node\n"));
 		udf_writeout_vat(ump);
 
-		/* at least two DVD packets and 3 CD-R packets */
-		nvats = 32;
+		/*
+		 * For bug-compatibility with Windows, the last VAT sector
+		 * must be a multiple of 16/32 from the start of the track.
+		 * To allow for scratches, write out at least a 32 pieces.
+		 */
+		phys = ump->data_track.track_start;
+		wrtrack_skew = phys % 32;
+
+		phys = ump->data_track.next_writable;
+		relblk = phys % 32;
+		nvats = 32 + 32 - (relblk - wrtrack_skew);
 
 #if notyet
 		/*



CVS commit: src/sys/fs/udf

2022-03-18 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Mar 18 16:06:18 UTC 2022

Modified Files:
src/sys/fs/udf: ecma167-udf.h

Log Message:
Replace the variable field data[0] to data[1] to avoid undefined behaviour.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/udf/ecma167-udf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-03-18 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Mar 18 16:06:18 UTC 2022

Modified Files:
src/sys/fs/udf: ecma167-udf.h

Log Message:
Replace the variable field data[0] to data[1] to avoid undefined behaviour.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/udf/ecma167-udf.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/udf/ecma167-udf.h
diff -u src/sys/fs/udf/ecma167-udf.h:1.16 src/sys/fs/udf/ecma167-udf.h:1.17
--- src/sys/fs/udf/ecma167-udf.h:1.16	Thu Aug  9 13:49:30 2018
+++ src/sys/fs/udf/ecma167-udf.h	Fri Mar 18 16:06:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ecma167-udf.h,v 1.16 2018/08/09 13:49:30 reinoud Exp $ */
+/* $NetBSD: ecma167-udf.h,v 1.17 2022/03/18 16:06:18 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004, 2005, 2006, 2008, 2009, 2017, 2018
@@ -651,7 +651,7 @@ struct fileid_desc {
 	uint8_t			l_fi;	/* Length of file identifier area */
 	struct long_ad		icb;
 	uint16_t		l_iu;	/* Length of implementation use area */
-	uint8_t			data[0];
+	uint8_t			data[1];
 } __packed;
 #define	UDF_FID_SIZE	38
 #define	UDF_FILE_CHAR_VIS	(1 << 0) /* Invisible */



CVS commit: src/sys/fs/union

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:48:04 UTC 2022

Modified Files:
src/sys/fs/union: union_subr.c union_vnops.c

Log Message:
As FSTRANS is part of VOP_*LOCK() since June 4, 2017 the vdead_check()
from union_lock() is no longer needed.

Adapt union_lock() to the recent addition of upgrade or downgrade.

VV_LOCKSWORK now.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/union/union_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/fs/union

2022-03-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar 19 13:48:04 UTC 2022

Modified Files:
src/sys/fs/union: union_subr.c union_vnops.c

Log Message:
As FSTRANS is part of VOP_*LOCK() since June 4, 2017 the vdead_check()
from union_lock() is no longer needed.

Adapt union_lock() to the recent addition of upgrade or downgrade.

VV_LOCKSWORK now.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/union/union_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/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.79 src/sys/fs/union/union_subr.c:1.80
--- src/sys/fs/union/union_subr.c:1.79	Tue Aug 18 09:44:07 2020
+++ src/sys/fs/union/union_subr.c	Sat Mar 19 13:48:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_subr.c,v 1.79 2020/08/18 09:44:07 hannken Exp $	*/
+/*	$NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.79 2020/08/18 09:44:07 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $");
 
 #include 
 #include 
@@ -567,6 +567,7 @@ union_loadvnode(struct mount *mp, struct
 
 	vp->v_tag = VT_UNION;
 	vp->v_op = union_vnodeop_p;
+	vp->v_vflag |= VV_LOCKSWORK;
 	vp->v_data = un;
 	un->un_vnode = vp;
 

Index: src/sys/fs/union/union_vnops.c
diff -u src/sys/fs/union/union_vnops.c:1.82 src/sys/fs/union/union_vnops.c:1.83
--- src/sys/fs/union/union_vnops.c:1.82	Fri Dec 10 19:30:05 2021
+++ src/sys/fs/union/union_vnops.c	Sat Mar 19 13:48:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vnops.c,v 1.82 2021/12/10 19:30:05 andvar Exp $	*/
+/*	$NetBSD: union_vnops.c,v 1.83 2022/03/19 13:48:04 hannken Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.82 2021/12/10 19:30:05 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.83 2022/03/19 13:48:04 hannken Exp $");
 
 #include 
 #include 
@@ -1709,15 +1709,6 @@ union_lock(void *v)
 		lockvp = LOCKVP(vp);
 		error = union_lock1(vp, lockvp, flags);
 		mutex_exit(&un->un_lock);
-		if (error)
-			return error;
-		if (mutex_tryenter(vp->v_interlock)) {
-			error = vdead_check(vp, VDEAD_NOWAIT);
-			mutex_exit(vp->v_interlock);
-		} else
-			error = EBUSY;
-		if (error)
-			union_unlock1(vp, lockvp);
 		return error;
 	}
 
@@ -1726,7 +1717,7 @@ union_lock(void *v)
 		lockvp = LOCKVP(vp);
 		mutex_exit(&un->un_lock);
 		error = union_lock1(vp, lockvp, flags);
-		if (error != 0)
+		if (error != 0 || (flags & (LK_DOWNGRADE | LK_UPGRADE)) != 0)
 			return error;
 		mutex_enter(&un->un_lock);
 		if (lockvp == LOCKVP(vp))
@@ -1735,14 +1726,6 @@ union_lock(void *v)
 	}
 	mutex_exit(&un->un_lock);
 
-	mutex_enter(vp->v_interlock);
-	error = vdead_check(vp, VDEAD_NOWAIT);
-	if (error) {
-		union_unlock1(vp, lockvp);
-		error = vdead_check(vp, 0);
-		KASSERT(error == ENOENT);
-	}
-	mutex_exit(vp->v_interlock);
 	return error;
 }
 



CVS commit: src/sys/fs/v7fs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 12:45:58 UTC 2022

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
fix unlock on error.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.



CVS commit: src/sys/fs/v7fs

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 12:45:58 UTC 2022

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
fix unlock on error.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/fs/v7fs/v7fs_vnops.c:1.36
--- src/sys/fs/v7fs/v7fs_vnops.c:1.35	Sun Mar 27 12:24:58 2022
+++ src/sys/fs/v7fs/v7fs_vnops.c	Wed Mar 30 08:45:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.35 2022/03/27 16:24:58 christos Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.36 2022/03/30 12:45:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.35 2022/03/27 16:24:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.36 2022/03/30 12:45:58 christos Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -762,8 +762,8 @@ v7fs_link(void *v)
 	/* Sync dirent size change. */
 	uvm_vnp_setsize(dvp, v7fs_inode_filesize(&parent_node->inode));
 
-	VOP_UNLOCK(vp);
 unlock:
+	VOP_UNLOCK(vp);
 	if (abrt)
 		VOP_ABORTOP(dvp, cnp);
 	return error;



CVS commit: src/sys/fs/udf

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 13:24:00 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
Fix locking in udf_link(). XXX: udf_symlink is prolly similarly broken.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/fs/udf/udf_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/fs/udf

2022-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 30 13:24:00 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
Fix locking in udf_link(). XXX: udf_symlink is prolly similarly broken.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/fs/udf/udf_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/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.120 src/sys/fs/udf/udf_vnops.c:1.121
--- src/sys/fs/udf/udf_vnops.c:1.120	Sun Mar 27 12:24:58 2022
+++ src/sys/fs/udf/udf_vnops.c	Wed Mar 30 09:23:59 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.120 2022/03/27 16:24:58 christos Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.121 2022/03/30 13:23:59 christos Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.120 2022/03/27 16:24:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.121 2022/03/30 13:23:59 christos Exp $");
 #endif /* not lint */
 
 
@@ -1542,12 +1542,20 @@ udf_mkdir(void *v)
 
 /* - */
 
-static int
-udf_do_link(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
+int
+udf_link(void *v)
 {
+	struct vop_link_v2_args /* {
+		struct vnode *a_dvp;
+		struct vnode *a_vp;
+		struct componentname *a_cnp;
+	} */ *ap = v;
+	struct vnode *dvp = ap->a_dvp;
+	struct vnode *vp  = ap->a_vp;
+	struct componentname *cnp = ap->a_cnp;
 	struct udf_node *udf_node, *dir_node;
 	struct vattr vap;
-	int error;
+	int error, abrt = 1;
 
 	DPRINTF(CALL, ("udf_link called\n"));
 	KASSERT(dvp != vp);
@@ -1558,44 +1566,31 @@ udf_do_link(struct vnode *dvp, struct vn
 	dir_node = VTOI(dvp);
 	udf_node = VTOI(vp);
 
+	if ((error = vn_lock(vp, LK_EXCLUSIVE))) {
+		DPRINTF("lock failed. %p\n", vp);
+		goto out;
+	}
+
 	error = VOP_GETATTR(vp, &vap, FSCRED);
 	if (error)
-		goto out;
+		goto out1;
 
 	/* check link count overflow */
 	if (vap.va_nlink >= (1<<16)-1) {	/* uint16_t */
 		error = EMLINK;
-		goto out;
+		goto out1;
 	}
 	error = kauth_authorize_vnode(cnp->cn_cred, KAUTH_VNODE_ADD_LINK, vp,
 	dvp, 0);
 	if (error)
-		goto out;
-
+		goto out1;
+	abrt = 0;
 	error = udf_dir_attach(dir_node->ump, dir_node, udf_node, &vap, cnp);
+out1:
+	VOP_UNLOCK(vp);
 out:
-	if (error)
-		VOP_UNLOCK(vp);
-	return error;
-}
-
-int
-udf_link(void *v)
-{
-	struct vop_link_v2_args /* {
-		struct vnode *a_dvp;
-		struct vnode *a_vp;
-		struct componentname *a_cnp;
-	} */ *ap = v;
-	struct vnode *dvp = ap->a_dvp;
-	struct vnode *vp  = ap->a_vp;
-	struct componentname *cnp = ap->a_cnp;
-	int error;
-
-	error = udf_do_link(dvp, vp, cnp);
-	if (error)
+	if (abrt)
 		VOP_ABORTOP(dvp, cnp);
-
 	return error;
 }
 



CVS commit: src/sys/fs/udf

2022-04-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr  1 08:26:28 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
Fix malformed DPRINTF() macro


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/fs/udf/udf_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/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.121 src/sys/fs/udf/udf_vnops.c:1.122
--- src/sys/fs/udf/udf_vnops.c:1.121	Wed Mar 30 13:23:59 2022
+++ src/sys/fs/udf/udf_vnops.c	Fri Apr  1 08:26:27 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.121 2022/03/30 13:23:59 christos Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.122 2022/04/01 08:26:27 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.121 2022/03/30 13:23:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.122 2022/04/01 08:26:27 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -1567,7 +1567,7 @@ udf_link(void *v)
 	udf_node = VTOI(vp);
 
 	if ((error = vn_lock(vp, LK_EXCLUSIVE))) {
-		DPRINTF("lock failed. %p\n", vp);
+		DPRINTF(LOCKING, ("exclusive lock failed for vnode %p\n", vp));
 		goto out;
 	}
 



CVS commit: src/sys/fs/udf

2022-04-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr  1 08:26:28 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
Fix malformed DPRINTF() macro


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/fs/udf/udf_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/fs/msdosfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:58:21 UTC 2022

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Lock vnode for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/msdosfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:58:21 UTC 2022

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Lock vnode for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/msdosfs/msdosfs_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/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.138
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Sat Apr 16 07:58:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.138 2022/04/16 07:58:21 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.138 2022/04/16 07:58:21 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -472,7 +472,10 @@ msdosfs_mountfs(struct vnode *devvp, str
 	u_long fatbytes, fatblocksecs;
 
 	/* Flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error)
 		return (error);
 
 	ronly = (mp->mnt_flag & MNT_RDONLY) != 0;



CVS commit: src/sys/fs/udf

2022-04-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr 22 21:21:10 UTC 2022

Modified Files:
src/sys/fs/udf: udf_subr.c

Log Message:
Fix endian issue with UDF extended attribute handling


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/fs/udf/udf_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-04-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr 22 21:21:10 UTC 2022

Modified Files:
src/sys/fs/udf: udf_subr.c

Log Message:
Fix endian issue with UDF extended attribute handling


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/fs/udf/udf_subr.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/udf/udf_subr.c
diff -u src/sys/fs/udf/udf_subr.c:1.168 src/sys/fs/udf/udf_subr.c:1.169
--- src/sys/fs/udf/udf_subr.c:1.168	Sun Apr 10 09:50:46 2022
+++ src/sys/fs/udf/udf_subr.c	Fri Apr 22 21:21:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.168 2022/04/10 09:50:46 andvar Exp $ */
+/* $NetBSD: udf_subr.c,v 1.169 2022/04/22 21:21:10 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.168 2022/04/10 09:50:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.169 2022/04/22 21:21:10 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -2439,11 +2439,11 @@ udf_extattr_search_intern(struct udf_nod
 		if ((a_l == 0) || (a_l > l_ea))
 			return EINVAL;
 
-		if (attrhdr->type != sattr)
+		if (udf_rw32(attrhdr->type) != sattr)
 			goto next_attribute;
 
 		/* we might have found it! */
-		if (attrhdr->type < 2048) {	/* Ecma-167 attribute */
+		if (udf_rw32(attrhdr->type) < 2048) {	/* Ecma-167 attribute */
 			*offsetp = offset;
 			*lengthp = a_l;
 			return 0;		/* success */



CVS commit: src/sys/fs/udf

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:35:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
No IO_NODELOCKED for unlocked vnode.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/fs/udf/udf_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/fs/udf

2022-05-03 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May  3 07:35:43 UTC 2022

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
No IO_NODELOCKED for unlocked vnode.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/fs/udf/udf_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/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.123 src/sys/fs/udf/udf_vnops.c:1.124
--- src/sys/fs/udf/udf_vnops.c:1.123	Sun Apr 10 09:50:46 2022
+++ src/sys/fs/udf/udf_vnops.c	Tue May  3 07:35:43 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.123 2022/04/10 09:50:46 andvar Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.124 2022/05/03 07:35:43 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.123 2022/04/10 09:50:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.124 2022/05/03 07:35:43 hannken Exp $");
 #endif /* not lint */
 
 
@@ -1701,7 +1701,7 @@ udf_do_symlink(struct udf_node *udf_node
 	/* write out structure on the new file */
 	error = vn_rdwr(UIO_WRITE, udf_node->vnode,
 		pathbuf, pathlen, 0,
-		UIO_SYSSPACE, IO_NODELOCKED | IO_ALTSEMANTICS,
+		UIO_SYSSPACE, IO_ALTSEMANTICS,
 		FSCRED, NULL, NULL);
 
 	/* return status of symlink contents writeout */



CVS commit: src/sys/fs/tmpfs

2022-06-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun  1 08:42:38 UTC 2022

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
tmpfs_read: respect MNT_NOATIME.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/fs/tmpfs/tmpfs_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/fs/tmpfs

2022-06-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun  1 08:42:38 UTC 2022

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
tmpfs_read: respect MNT_NOATIME.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/fs/tmpfs/tmpfs_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/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.149 src/sys/fs/tmpfs/tmpfs_vnops.c:1.150
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.149	Sun Mar 27 16:24:57 2022
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jun  1 08:42:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.149 2022/03/27 16:24:57 christos Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.150 2022/06/01 08:42:38 hannken Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.149 2022/03/27 16:24:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.150 2022/06/01 08:42:38 hannken Exp $");
 
 #include 
 #include 
@@ -555,7 +555,9 @@ tmpfs_read(void *v)
 		UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
 	}
 
-	tmpfs_update(vp, TMPFS_UPDATE_ATIME);
+	if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
+		tmpfs_update(vp, TMPFS_UPDATE_ATIME);
+
 	return error;
 }
 



CVS commit: src/sys/fs/puffs

2010-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan  7 22:45:31 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_msgif.c puffs_msgif.h puffs_sys.h

Log Message:
Add a PUFFS_UNMOUNT server->kernel request, which causes the kernel
to initiate self destruct, i.e. unmount(MNT_FORCE).  This, however,
is a semi-controlled self-destruct, since all caches are flushed
before the (possibly) violent unmount takes place.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.68 -r1.69 src/sys/fs/puffs/puffs_msgif.h
cvs rdiff -u -r1.73 -r1.74 src/sys/fs/puffs/puffs_sys.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/puffs

2010-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan  7 22:59:27 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_msgif.c

Log Message:
Fix variable name in my commit tree too.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/fs/puffs/puffs_msgif.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/puffs

2010-01-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan  7 23:02:34 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_msgif.c puffs_sys.h puffs_vfsops.c

Log Message:
Rename PUFFS_SOPREQ_EXIT to PUFFS_SOPREQSYS_EXIT to better signal
it comes from within the kernel instead of as a direct result of
a user request.

no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/puffs/puffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/puffs

2010-01-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan 14 14:44:13 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
Since VOP_GETATTR() does not require a locked vnode, resolve and
reference the puffs_node before sending the request to the file
server.  This diminishes the window where the inode can be reclaimed
and be invalidated before it is accessed (but does not completely
eliminate the race, as that is a caller problem which we cannot
fix here).


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/fs/puffs/puffs_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/fs/puffs

2010-01-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jan 14 19:50:07 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_msgif.c puffs_vfsops.c

Log Message:
In case the operations thread has exited, do not queue any more
operations.  This prevents kernel memory leaks (one of which happened
every time the file system was unmounted via PUFFSOP_UNMOUNT ...
and incidentally would've been trivially caught with the old
malloc(9) interface.  I wonder if the message is to use a ton of
pools instead of regression-attractive kmem interface).


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.85 -r1.86 src/sys/fs/puffs/puffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/ntfs

2019-10-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Oct 18 08:18:40 UTC 2019

Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c

Log Message:
It is not possible to call vflush() from xxx_mount().

Replace with a vnode iterator and use vrecycle().


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/fs/ntfs/ntfs_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/ntfs/ntfs_vfsops.c
diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.107 src/sys/fs/ntfs/ntfs_vfsops.c:1.108
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.107	Mon Apr 17 08:32:00 2017
+++ src/sys/fs/ntfs/ntfs_vfsops.c	Fri Oct 18 08:18:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_vfsops.c,v 1.107 2017/04/17 08:32:00 hannken Exp $	*/
+/*	$NetBSD: ntfs_vfsops.c,v 1.108 2019/10/18 08:18:40 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.107 2017/04/17 08:32:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.108 2019/10/18 08:18:40 hannken Exp $");
 
 #include 
 #include 
@@ -322,6 +322,7 @@ ntfs_mountfs(struct vnode *devvp, struct
 	dev_t dev = devvp->v_rdev;
 	int error, i;
 	struct vnode *vp;
+	struct vnode_iterator *marker;
 
 	ntmp = NULL;
 
@@ -471,9 +472,13 @@ out1:
 		if (ntmp->ntm_sysvn[i])
 			vrele(ntmp->ntm_sysvn[i]);
 
-	if (vflush(mp, NULLVP, 0)) {
-		dprintf(("ntfs_mountfs: vflush failed\n"));
+	vfs_vnode_iterator_init(mp, &marker);
+	while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
+		if (vrecycle(vp))
+			continue;
+		panic("%s: cannot recycle vnode %p", __func__, vp);
 	}
+	vfs_vnode_iterator_destroy(marker);
 out:
 	spec_node_setmountedfs(devvp, NULL);
 	if (bp)



CVS commit: src/sys/fs/ntfs

2019-10-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Oct 18 08:18:40 UTC 2019

Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c

Log Message:
It is not possible to call vflush() from xxx_mount().

Replace with a vnode iterator and use vrecycle().


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/fs/ntfs/ntfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/ntfs

2019-10-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Oct 18 08:19:33 UTC 2019

Modified Files:
src/sys/fs/ntfs: ntfs_subr.c

Log Message:
When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.

Should fix PR kern/54598: mount ntfs panic


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/fs/ntfs/ntfs_subr.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/ntfs/ntfs_subr.c
diff -u src/sys/fs/ntfs/ntfs_subr.c:1.61 src/sys/fs/ntfs/ntfs_subr.c:1.62
--- src/sys/fs/ntfs/ntfs_subr.c:1.61	Sat Mar 28 19:24:05 2015
+++ src/sys/fs/ntfs/ntfs_subr.c	Fri Oct 18 08:19:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_subr.c,v 1.61 2015/03/28 19:24:05 maxv Exp $	*/
+/*	$NetBSD: ntfs_subr.c,v 1.62 2019/10/18 08:19:33 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko (sem...@freebsd.org)
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.61 2015/03/28 19:24:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.62 2019/10/18 08:19:33 hannken Exp $");
 
 #include 
 #include 
@@ -271,6 +271,8 @@ ntfs_loadntnode(struct ntfsmount *ntmp, 
 		struct buf *bp;
 		daddr_t bn;
 		off_t boff;
+		size_t resid, l;
+		char *data;
 
 		dprintf(("%s: read system node\n", __func__));
 
@@ -281,17 +283,26 @@ ntfs_loadntnode(struct ntfsmount *ntmp, 
 		boff = ntfs_cntob(ntmp->ntm_mftcn) +
 		ntfs_bntob(ntmp->ntm_bpmftrec) * ip->i_number;
 		bn = ntfs_cntobn(ntfs_btocn(boff));
-		off = ntfs_btocnoff(boff);
+		boff = ntfs_btocnoff(boff);
+		resid = ntfs_bntob(ntmp->ntm_bpmftrec);
+		data = (char *)mfrp;
+		while (resid > 0) {
+			l = MIN(resid, ntfs_cntob(1) - boff);
+
+			error = bread(ntmp->ntm_devvp, bn, ntfs_cntob(1),
+			0, &bp);
+			if (error) {
+printf("%s: BREAD FAILED\n", __func__);
+goto out;
+			}
+			memcpy(data, (char *)bp->b_data + boff, l);
+			bqrelse(bp);
 
-		error = bread(ntmp->ntm_devvp, bn, ntfs_cntob(1),
-		0, &bp);
-		if (error) {
-			printf("%s: BREAD FAILED\n", __func__);
-			goto out;
+			bn += ntfs_cntobn(1);
+			boff = 0;
+			data += l;
+			resid -= l;
 		}
-		memcpy(mfrp, (char *)bp->b_data + off,
-		ntfs_bntob(ntmp->ntm_bpmftrec));
-		bqrelse(bp);
 	} else {
 		struct vnode   *vp;
 



CVS commit: src/sys/fs/ntfs

2019-10-18 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Oct 18 08:19:33 UTC 2019

Modified Files:
src/sys/fs/ntfs: ntfs_subr.c

Log Message:
When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.

Should fix PR kern/54598: mount ntfs panic


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/fs/ntfs/ntfs_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/autofs

2019-11-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Nov 14 08:45:24 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c

Log Message:
autofs: Whitespace fix


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/fs/autofs/autofs_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/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.4 src/sys/fs/autofs/autofs_vfsops.c:1.5
--- src/sys/fs/autofs/autofs_vfsops.c:1.4	Sun Jan 14 22:43:18 2018
+++ src/sys/fs/autofs/autofs_vfsops.c	Thu Nov 14 08:45:24 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.4 2018/01/14 22:43:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.5 2019/11/14 08:45:24 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -239,7 +239,6 @@ autofs_unmount(struct mount *mp, int mnt
 			mutex_exit(&->am_lock);
 			return EBUSY;
 		}
-			
 		autofs_node_delete(anp);
 	}
 	autofs_node_delete(amp->am_root);



CVS commit: src/sys/fs/autofs

2019-11-14 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Nov 14 08:45:24 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c

Log Message:
autofs: Whitespace fix


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/fs/autofs/autofs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 09:22:00 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c

Log Message:
autofs: Fix change by r1.3 "prevent assert on unmount."

Must delete all nodes on unmount, otherwise automounts with >1 level of 
directories can't be deleted.
taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/autofs/autofs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/autofs

2019-11-16 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 16 09:22:00 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c

Log Message:
autofs: Fix change by r1.3 "prevent assert on unmount."

Must delete all nodes on unmount, otherwise automounts with >1 level of 
directories can't be deleted.
taken-from: FreeBSD and DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/autofs/autofs_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/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.5 src/sys/fs/autofs/autofs_vfsops.c:1.6
--- src/sys/fs/autofs/autofs_vfsops.c:1.5	Thu Nov 14 08:45:24 2019
+++ src/sys/fs/autofs/autofs_vfsops.c	Sat Nov 16 09:22:00 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.5 2019/11/14 08:45:24 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.6 2019/11/16 09:22:00 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -232,13 +232,14 @@ autofs_unmount(struct mount *mp, int mnt
 	mutex_enter(&->am_lock);
 	while (!RB_EMPTY(&->am_root->an_children)) {
 		struct autofs_node *anp;
+		/*
+		 * Force delete all nodes when more than one level of
+		 * directories are created via indirect map. Autofs doesn't
+		 * support rmdir(2), thus this is the only way to get out.
+		 */
 		anp = RB_MIN(autofs_node_tree, &->am_root->an_children);
-		if (!RB_EMPTY(&anp->an_children)) {
-			AUTOFS_DEBUG("%s: %s has children", __func__,
-			anp->an_name);
-			mutex_exit(&->am_lock);
-			return EBUSY;
-		}
+		while (!RB_EMPTY(&anp->an_children))
+			anp = RB_MIN(autofs_node_tree, &anp->an_children);
 		autofs_node_delete(anp);
 	}
 	autofs_node_delete(amp->am_root);



CVS commit: src/sys/fs/autofs

2019-11-22 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 07:38:03 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: Drop unused autofs_mount field which originates from FreeBSD

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/autofs

2019-11-22 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 07:38:03 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: Drop unused autofs_mount field which originates from FreeBSD

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs.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/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.1 src/sys/fs/autofs/autofs.h:1.2
--- src/sys/fs/autofs/autofs.h:1.1	Tue Jan  9 03:31:14 2018
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 07:38:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.1 2018/01/09 03:31:14 christos Exp $	*/
+/*	$NetBSD: autofs.h,v 1.2 2019/11/23 07:38:03 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -120,7 +120,6 @@ struct autofs_node {
 };
 
 struct autofs_mount {
-	TAILQ_ENTRY(autofs_mount)	am_next;
 	struct autofs_node		*am_root;
 	struct mount			*am_mp;
 	kmutex_t			am_lock;



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:00:59 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: u_int -> unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs.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/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.2 src/sys/fs/autofs/autofs.h:1.3
--- src/sys/fs/autofs/autofs.h:1.2	Sat Nov 23 07:38:03 2019
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 08:00:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.2 2019/11/23 07:38:03 tkusumi Exp $	*/
+/*	$NetBSD: autofs.h,v 1.3 2019/11/23 08:00:59 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -145,7 +145,7 @@ struct autofs_request {
 	charar_key[AUTOFS_MAXPATHLEN];
 	charar_options[AUTOFS_MAXPATHLEN];
 	struct callout			ar_callout;
-	volatile u_int			ar_refcount;
+	volatile unsigned int		ar_refcount;
 };
 
 struct autofs_softc {



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:00:59 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: u_int -> unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:30:39 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_mount.h

Log Message:
autofs: Fix a comment on autofs_args

mount_autofs(8) also uses this.
mount_autofs(8) was added by NetBSD as an optional command (not needed to use 
autofs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_mount.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/autofs/autofs_mount.h
diff -u src/sys/fs/autofs/autofs_mount.h:1.2 src/sys/fs/autofs/autofs_mount.h:1.3
--- src/sys/fs/autofs/autofs_mount.h:1.2	Sun Jan 14 22:43:18 2018
+++ src/sys/fs/autofs/autofs_mount.h	Sat Nov 23 08:30:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_mount.h,v 1.2 2018/01/14 22:43:18 christos Exp $	*/
+/*	$NetBSD: autofs_mount.h,v 1.3 2019/11/23 08:30:39 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 
 /*
  * Arguments to mount autofs filesystem.
- * This structure should only be used by automount(8).
  */
 struct autofs_args {
 	char	*from;



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:30:39 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_mount.h

Log Message:
autofs: Fix a comment on autofs_args

mount_autofs(8) also uses this.
mount_autofs(8) was added by NetBSD as an optional command (not needed to use 
autofs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_mount.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 15:17:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Don't calculate dirent reclen twice

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs_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/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.6 src/sys/fs/autofs/autofs_vfsops.c:1.7
--- src/sys/fs/autofs/autofs_vfsops.c:1.6	Sat Nov 16 09:22:00 2019
+++ src/sys/fs/autofs/autofs_vfsops.c	Sat Nov 23 15:17:46 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.6 2019/11/16 09:22:00 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.7 2019/11/23 15:17:46 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -74,6 +74,7 @@ autofs_init(void)
 static void
 autofs_done(void)
 {
+
 	KASSERT(autofs_softc);
 	KASSERT(!autofs_softc->sc_dev_opened);
 

Index: src/sys/fs/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.1 src/sys/fs/autofs/autofs_vnops.c:1.2
--- src/sys/fs/autofs/autofs_vnops.c:1.1	Tue Jan  9 03:31:14 2018
+++ src/sys/fs/autofs/autofs_vnops.c	Sat Nov 23 15:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.1 2018/01/09 03:31:14 christos Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.1 2018/01/09 03:31:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -413,8 +413,7 @@ autofs_print(void *v)
 }
 
 static int
-autofs_readdir_one(struct uio *uio, const char *name, ino_t ino,
-size_t *reclenp)
+autofs_readdir_one(struct uio *uio, const char *name, ino_t ino)
 {
 	struct dirent dirent;
 
@@ -424,9 +423,6 @@ autofs_readdir_one(struct uio *uio, cons
 	dirent.d_namlen = strlen(dirent.d_name);
 	dirent.d_reclen = _DIRENT_SIZE(&dirent);
 
-	if (reclenp)
-		*reclenp = dirent.d_reclen;
-
 	if (!uio)
 		return 0;
 
@@ -439,11 +435,12 @@ autofs_readdir_one(struct uio *uio, cons
 static size_t
 autofs_dirent_reclen(const char *name)
 {
-	size_t reclen;
+	struct dirent dirent;
 
-	(void)autofs_readdir_one(NULL, name, -1, &reclen);
+	strlcpy(dirent.d_name, name, sizeof(dirent.d_name));
+	dirent.d_namlen = strlen(dirent.d_name);
 
-	return reclen;
+	return _DIRENT_SIZE(&dirent);
 }
 
 static int
@@ -463,7 +460,7 @@ autofs_readdir(void *v)
 	struct autofs_mount *amp = VFSTOAUTOFS(vp->v_mount);
 	struct autofs_node *anp = VTOI(vp);
 	struct autofs_node *child;
-	size_t reclen, reclens;
+	size_t reclens;
 	int error;
 
 	if (vp->v_type != VDIR)
@@ -496,7 +493,7 @@ autofs_readdir(void *v)
 	 * Write out the directory entry for ".".
 	 */
 	if (uio->uio_offset == 0) {
-		error = autofs_readdir_one(uio, ".", anp->an_ino, &reclen);
+		error = autofs_readdir_one(uio, ".", anp->an_ino);
 		if (error)
 			goto out;
 	}
@@ -509,8 +506,7 @@ autofs_readdir(void *v)
 		if (uio->uio_offset != reclens)
 			return EINVAL;
 		error = autofs_readdir_one(uio, "..",
-		(anp->an_parent ? anp->an_parent->an_ino : anp->an_ino),
-		&reclen);
+		anp->an_parent ? anp->an_parent->an_ino : anp->an_ino);
 		if (error)
 			goto out;
 	}
@@ -538,9 +534,8 @@ autofs_readdir(void *v)
 			return EINVAL;
 		}
 
-		error = autofs_readdir_one(uio, child->an_name,
-		child->an_ino, &reclen);
-		reclens += reclen;
+		error = autofs_readdir_one(uio, child->an_name, child->an_ino);
+		reclens += autofs_dirent_reclen(child->an_name);
 		if (error) {
 			mutex_exit(&->am_lock);
 			goto out;
@@ -562,7 +557,7 @@ out:
 	/*
 	 * Don't return an error if we managed to copy out some entries.
 	 */
-	if (uio->uio_resid < reclen)
+	if (uio->uio_resid < initial_resid)
 		return 0;
 
 	return error;



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 15:17:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Don't calculate dirent reclen twice

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs_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/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 17:13:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h autofs_vnops.c

Log Message:
autofs: Remove unused autofs_node::an_vnode_lock

Unlike FreeBSD and DragonFlyBSD, this is unused in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs.h
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_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/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 17:13:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h autofs_vnops.c

Log Message:
autofs: Remove unused autofs_node::an_vnode_lock

Unlike FreeBSD and DragonFlyBSD, this is unused in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs.h
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_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/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.3 src/sys/fs/autofs/autofs.h:1.4
--- src/sys/fs/autofs/autofs.h:1.3	Sat Nov 23 08:00:59 2019
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 17:13:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.3 2019/11/23 08:00:59 tkusumi Exp $	*/
+/*	$NetBSD: autofs.h,v 1.4 2019/11/23 17:13:46 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -111,7 +111,6 @@ struct autofs_node {
 	autofs_node)		an_children;
 	struct autofs_mount		*an_mount;
 	struct vnode			*an_vnode;
-	kmutex_t			an_vnode_lock;
 	boolan_cached;
 	boolan_wildcards;
 	struct callout			an_callout;

Index: src/sys/fs/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.2 src/sys/fs/autofs/autofs_vnops.c:1.3
--- src/sys/fs/autofs/autofs_vnops.c:1.2	Sat Nov 23 15:17:46 2019
+++ src/sys/fs/autofs/autofs_vnops.c	Sat Nov 23 17:13:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.3 2019/11/23 17:13:46 tkusumi Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.3 2019/11/23 17:13:46 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -578,10 +578,8 @@ autofs_reclaim(void *v)
 	 * We do not free autofs_node here; instead we are
 	 * destroying them in autofs_node_delete().
 	 */
-	mutex_enter(&anp->an_vnode_lock);
 	anp->an_vnode = NULL;
 	vp->v_data = NULL;
-	mutex_exit(&anp->an_vnode_lock);
 
 	return 0;
 }
@@ -629,7 +627,6 @@ autofs_node_new(struct autofs_node *pare
 	anp->an_name = autofs_strndup(name, namelen, KM_SLEEP);
 	anp->an_ino = amp->am_last_ino++;
 	callout_init(&anp->an_callout, 0);
-	mutex_init(&anp->an_vnode_lock, MUTEX_DEFAULT, IPL_NONE);
 	getnanotime(&anp->an_ctime);
 	anp->an_parent = parent;
 	anp->an_mount = amp;
@@ -681,7 +678,6 @@ autofs_node_delete(struct autofs_node *a
 	if (anp->an_parent)
 		RB_REMOVE(autofs_node_tree, &anp->an_parent->an_children, anp);
 
-	mutex_destroy(&anp->an_vnode_lock);
 	kmem_strfree(anp->an_name);
 	pool_put(&autofs_node_pool, anp);
 }



CVS commit: src/sys/fs/autofs

2019-11-26 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Nov 26 16:17:31 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Use NULLVP for NULL vnode

I originally used NULL for NetBSD autofs, but it got mixed up with
NULLVP when merged with NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs_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/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.7 src/sys/fs/autofs/autofs_vfsops.c:1.8
--- src/sys/fs/autofs/autofs_vfsops.c:1.7	Sat Nov 23 15:17:46 2019
+++ src/sys/fs/autofs/autofs_vfsops.c	Tue Nov 26 16:17:31 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.7 2019/11/23 15:17:46 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.8 2019/11/26 16:17:31 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -273,7 +273,7 @@ autofs_root(struct mount *mp, struct vno
 	error = vn_lock(*vpp, LK_EXCLUSIVE);
 	if (error) {
 		vrele(*vpp);
-		*vpp = NULL;
+		*vpp = NULLVP;
 		return error;
 	}
 

Index: src/sys/fs/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.3 src/sys/fs/autofs/autofs_vnops.c:1.4
--- src/sys/fs/autofs/autofs_vnops.c:1.3	Sat Nov 23 17:13:46 2019
+++ src/sys/fs/autofs/autofs_vnops.c	Tue Nov 26 16:17:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.3 2019/11/23 17:13:46 tkusumi Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.4 2019/11/26 16:17:31 tkusumi Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.3 2019/11/23 17:13:46 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.4 2019/11/26 16:17:31 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -87,7 +87,7 @@ autofs_getattr(void *v)
 	if (autofs_mount_on_stat &&
 	autofs_cached(anp, NULL, 0) == false &&
 	autofs_ignore_thread() == false) {
-		struct vnode *newvp = NULL;
+		struct vnode *newvp = NULLVP;
 		int error = autofs_trigger_vn(vp, "", 0, &newvp);
 		if (error)
 			return error;
@@ -171,7 +171,7 @@ mounted:
 		return error;
 
 	if (!vp->v_mountedhere) {
-		*newvp = NULL;
+		*newvp = NULLVP;
 		return 0;
 	} else {
 		/*
@@ -212,7 +212,7 @@ autofs_lookup(void *v)
 	KASSERT(VOP_ISLOCKED(dvp));
 
 	anp = VTOI(dvp);
-	*vpp = NULL;
+	*vpp = NULLVP;
 
 	/* Check accessibility of directory. */
 	KASSERT(!VOP_ACCESS(dvp, VEXEC, cnp->cn_cred));
@@ -259,7 +259,7 @@ autofs_lookup(void *v)
 
 	if (autofs_cached(anp, cnp->cn_nameptr, cnp->cn_namelen) == false &&
 	autofs_ignore_thread() == false) {
-		struct vnode *newvp = NULL;
+		struct vnode *newvp = NULLVP;
 		error = autofs_trigger_vn(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 		&newvp);
 		if (error)
@@ -468,7 +468,7 @@ autofs_readdir(void *v)
 
 	if (autofs_cached(anp, NULL, 0) == false &&
 	autofs_ignore_thread() == false) {
-		struct vnode *newvp = NULL;
+		struct vnode *newvp = NULLVP;
 		error = autofs_trigger_vn(vp, "", 0, &newvp);
 		if (error)
 			return error;
@@ -578,7 +578,7 @@ autofs_reclaim(void *v)
 	 * We do not free autofs_node here; instead we are
 	 * destroying them in autofs_node_delete().
 	 */
-	anp->an_vnode = NULL;
+	anp->an_vnode = NULLVP;
 	vp->v_data = NULL;
 
 	return 0;
@@ -630,7 +630,7 @@ autofs_node_new(struct autofs_node *pare
 	getnanotime(&anp->an_ctime);
 	anp->an_parent = parent;
 	anp->an_mount = amp;
-	anp->an_vnode = NULL;
+	anp->an_vnode = NULLVP;
 	anp->an_cached = false;
 	anp->an_wildcards = false;
 	anp->an_retries = 0;



CVS commit: src/sys/fs/autofs

2019-11-26 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Nov 26 16:17:31 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Use NULLVP for NULL vnode

I originally used NULL for NetBSD autofs, but it got mixed up with
NULLVP when merged with NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs_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/fs/autofs

2022-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec 11 11:31:55 UTC 2022

Modified Files:
src/sys/fs/autofs: autofs_vnops.c

Log Message:
Use genfs_pathconf for VOP_PATHCONF.
Fixes bin/57103.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/autofs/autofs_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/fs/autofs

2022-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Dec 11 11:31:55 UTC 2022

Modified Files:
src/sys/fs/autofs: autofs_vnops.c

Log Message:
Use genfs_pathconf for VOP_PATHCONF.
Fixes bin/57103.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/autofs/autofs_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/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.7 src/sys/fs/autofs/autofs_vnops.c:1.8
--- src/sys/fs/autofs/autofs_vnops.c:1.7	Tue Jun 29 22:34:06 2021
+++ src/sys/fs/autofs/autofs_vnops.c	Sun Dec 11 11:31:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.7 2021/06/29 22:34:06 dholland Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.8 2022/12/11 11:31:55 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.7 2021/06/29 22:34:06 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.8 2022/12/11 11:31:55 mlelstv Exp $");
 
 #include "autofs.h"
 
@@ -604,6 +604,7 @@ static const struct vnodeopv_entry_desc 
 	{ &vop_islocked_desc,	genfs_islocked },
 	{ &vop_getpages_desc,	genfs_getpages },
 	{ &vop_putpages_desc,	genfs_putpages },
+	{ &vop_pathconf_desc,	genfs_pathconf },
 	{ NULL, NULL }
 };
 



CVS commit: src/sys/fs/nilfs

2023-01-29 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Jan 29 16:07:14 UTC 2023

Modified Files:
src/sys/fs/nilfs: nilfs_subr.h

Log Message:
Remove old prototypes from writing that shouldn't have been comitted at all!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/fs/nilfs/nilfs_subr.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/nilfs/nilfs_subr.h
diff -u src/sys/fs/nilfs/nilfs_subr.h:1.4 src/sys/fs/nilfs/nilfs_subr.h:1.5
--- src/sys/fs/nilfs/nilfs_subr.h:1.4	Sun Mar 29 14:12:28 2015
+++ src/sys/fs/nilfs/nilfs_subr.h	Sun Jan 29 16:07:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_subr.h,v 1.4 2015/03/29 14:12:28 riastradh Exp $ */
+/* $NetBSD: nilfs_subr.h,v 1.5 2023/01/29 16:07:14 reinoud Exp $ */
 
 /*
  * Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -105,154 +105,3 @@ int nilfs_fsync(void *v);
 int nilfs_advlock(void *v);
 
 #endif	/* !_FS_NILFS_NILFS_SUBR_H_ */
-
-#if 0
-/* device information updating */
-int nilfs_update_trackinfo(struct nilfs_mount *ump, struct mmc_trackinfo *trackinfo);
-int nilfs_update_discinfo(struct nilfs_mount *ump);
-int nilfs_search_tracks(struct nilfs_mount *ump, struct nilfs_args *args,
-		  int *first_tracknr, int *last_tracknr);
-int nilfs_search_writing_tracks(struct nilfs_mount *ump);
-int nilfs_setup_writeparams(struct nilfs_mount *ump);
-int nilfs_synchronise_caches(struct nilfs_mount *ump);
-
-/* tags operations */
-int nilfs_fidsize(struct fileid_desc *fid);
-int nilfs_check_tag(void *blob);
-int nilfs_check_tag_payload(void *blob, uint32_t max_length);
-void nilfs_validate_tag_sum(void *blob);
-void nilfs_validate_tag_and_crc_sums(void *blob);
-int nilfs_tagsize(union dscrptr *dscr, uint32_t nilfs_sector_size);
-
-/* read/write descriptors */
-int nilfs_read_phys_dscr(
-		struct nilfs_mount *ump,
-		uint32_t sector,
-		struct malloc_type *mtype,		/* where to allocate */
-		union dscrptr **dstp);			/* out */
-
-int nilfs_write_phys_dscr_sync(struct nilfs_mount *ump, struct nilfs_node *nilfs_node,
-		int what, union dscrptr *dscr,
-		uint32_t sector, uint32_t logsector);
-int nilfs_write_phys_dscr_async(struct nilfs_mount *ump, struct nilfs_node *nilfs_node,
-		  int what, union dscrptr *dscr,
-		  uint32_t sector, uint32_t logsector,
-		  void (*dscrwr_callback)(struct buf *));
-
-/* read/write node descriptors */
-int nilfs_create_logvol_dscr(struct nilfs_mount *ump, struct nilfs_node *nilfs_node,
-	struct long_ad *icb, union dscrptr **dscrptr);
-void nilfs_free_logvol_dscr(struct nilfs_mount *ump, struct long_ad *icb_loc,
-	void *dscr);
-int nilfs_read_logvol_dscr(struct nilfs_mount *ump, struct long_ad *icb,
-	union dscrptr **dscrptr);
-int nilfs_write_logvol_dscr(struct nilfs_node *nilfs_node, union dscrptr *dscr,
-	struct long_ad *icb, int waitfor);
-
-
-/* volume descriptors readers and checkers */
-int nilfs_read_anchors(struct nilfs_mount *ump);
-int nilfs_read_vds_space(struct nilfs_mount *ump);
-int nilfs_process_vds(struct nilfs_mount *ump);
-int nilfs_read_vds_tables(struct nilfs_mount *ump);
-int nilfs_read_rootdirs(struct nilfs_mount *ump);
-
-/* open/close and sync volumes */
-int nilfs_open_logvol(struct nilfs_mount *ump);
-int nilfs_close_logvol(struct nilfs_mount *ump, int mntflags);
-int nilfs_writeout_vat(struct nilfs_mount *ump);
-int nilfs_write_physical_partition_spacetables(struct nilfs_mount *ump, int waitfor);
-int nilfs_write_metadata_partition_spacetable(struct nilfs_mount *ump, int waitfor);
-void nilfs_do_sync(struct nilfs_mount *ump, kauth_cred_t cred, int waitfor);
-
-/* translation services */
-int nilfs_translate_vtop(struct nilfs_mount *ump, struct long_ad *icb_loc,
-		uint32_t *lb_numres, uint32_t *extres);
-void nilfs_translate_vtop_list(struct nilfs_mount *ump, uint32_t sectors,
-		uint16_t vpart_num, uint64_t *lmapping, uint64_t *pmapping);
-int nilfs_translate_file_extent(struct nilfs_node *node,
-		uint32_t from, uint32_t num_lb, uint64_t *map);
-void nilfs_get_adslot(struct nilfs_node *nilfs_node, int slot, struct long_ad *icb, int *eof);
-int nilfs_append_adslot(struct nilfs_node *nilfs_node, int *slot, struct long_ad *icb);
-
-int nilfs_vat_read(struct nilfs_node *vat_node, uint8_t *blob, int size, uint32_t offset);
-int nilfs_vat_write(struct nilfs_node *vat_node, uint8_t *blob, int size, uint32_t offset);
-
-/* disc allocation */
-void nilfs_late_allocate_buf(struct nilfs_mount *ump, struct buf *buf, uint64_t *lmapping, struct long_ad *node_ad_cpy, uint16_t *vpart_num);
-void nilfs_free_allocated_space(struct nilfs_mount *ump, uint32_t lb_num, uint16_t vpart_num, uint32_t num_lb);
-int nilfs_pre_allocate_space(struct nilfs_mount *ump, int nilfs_c_type, uint32_t num_lb, uint16_t vpartnr, uint64_t *lmapping);
-int nilfs_grow_node(struct nilfs_node *node, uint64_t new_size);
-int nilfs_shrink_node(struct nilfs_node *node, uint64_t new_size);
-
-/* node readers and writers */

CVS commit: src/sys/fs/nilfs

2023-01-29 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Jan 29 16:07:14 UTC 2023

Modified Files:
src/sys/fs/nilfs: nilfs_subr.h

Log Message:
Remove old prototypes from writing that shouldn't have been comitted at all!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/fs/nilfs/nilfs_subr.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/union

2023-02-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Feb  6 10:33:32 UTC 2023

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
Set IMNT_MPSAFE only if all lower layers have it set.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/fs/union/union_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/union

2023-02-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Feb  6 10:33:32 UTC 2023

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
Set IMNT_MPSAFE only if all lower layers have it set.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/fs/union/union_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/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.85 src/sys/fs/union/union_vfsops.c:1.86
--- src/sys/fs/union/union_vfsops.c:1.85	Mon Nov 21 10:37:14 2022
+++ src/sys/fs/union/union_vfsops.c	Mon Feb  6 10:33:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $");
 
 #include 
 #include 
@@ -198,7 +198,14 @@ union_mount(struct mount *mp, const char
 		goto bad;
 	}
 
-	mp->mnt_iflag |= IMNT_MPSAFE;
+	/*
+	 * This mount is mp-safe if both lower mounts are mp-safe.
+	 */
+
+	if (((um->um_lowervp == NULLVP) ||
+	(um->um_lowervp->v_mount->mnt_iflag & IMNT_MPSAFE)) &&
+	(um->um_uppervp->v_mount->mnt_iflag & IMNT_MPSAFE))
+		mp->mnt_iflag |= IMNT_MPSAFE;
 
 	/*
 	 * Unless the mount is readonly, ensure that the top layer



CVS commit: src/sys/fs/union

2023-02-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Feb 13 08:39:40 UTC 2023

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
When mounting a union file system set its lower mount only on success.

Reported-by: syzbot+b81b69971581b4f4d...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/fs/union/union_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/union

2023-02-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Feb 13 08:39:40 UTC 2023

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
When mounting a union file system set its lower mount only on success.

Reported-by: syzbot+b81b69971581b4f4d...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/fs/union/union_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/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.86 src/sys/fs/union/union_vfsops.c:1.87
--- src/sys/fs/union/union_vfsops.c:1.86	Mon Feb  6 10:33:32 2023
+++ src/sys/fs/union/union_vfsops.c	Mon Feb 13 08:39:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.86 2023/02/06 10:33:32 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.87 2023/02/13 08:39:40 hannken Exp $");
 
 #include 
 #include 
@@ -255,15 +255,16 @@ union_mount(struct mount *mp, const char
 
 	mp->mnt_data = um;
 	vfs_getnewfsid(mp);
-	error = vfs_set_lowermount(mp, um->um_uppervp->v_mount);
-	if (error)
-		goto bad;
 
 	error = set_statvfs_info(path, UIO_USERSPACE, NULL, UIO_USERSPACE,
 	mp->mnt_op->vfs_name, mp, l);
 	if (error)
 		goto bad;
 
+	error = vfs_set_lowermount(mp, um->um_uppervp->v_mount);
+	if (error)
+		goto bad;
+
 	switch (um->um_op) {
 	case UNMNT_ABOVE:
 		cp = ":";



CVS commit: src/sys/fs/msdosfs

2023-02-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Feb 13 23:14:21 UTC 2023

Modified Files:
src/sys/fs/msdosfs: msdosfs_conv.c

Log Message:
s/chacters/characters/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/msdosfs/msdosfs_conv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/msdosfs

2023-02-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Feb 13 23:14:21 UTC 2023

Modified Files:
src/sys/fs/msdosfs: msdosfs_conv.c

Log Message:
s/chacters/characters/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/msdosfs/msdosfs_conv.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/msdosfs/msdosfs_conv.c
diff -u src/sys/fs/msdosfs/msdosfs_conv.c:1.18 src/sys/fs/msdosfs/msdosfs_conv.c:1.19
--- src/sys/fs/msdosfs/msdosfs_conv.c:1.18	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_conv.c	Mon Feb 13 23:14:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_conv.c,v 1.18 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_conv.c,v 1.19 2023/02/13 23:14:21 andvar Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1997 Wolfgang Solfrank.
@@ -58,7 +58,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.18 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.19 2023/02/13 23:14:21 andvar Exp $");
 
 /*
  * System include files.
@@ -866,7 +866,7 @@ ucs2utf8str(const u_int16_t *in, int n, 
 
 /*
  * Convert UTF8 string into UCS-2 string
- * return total number of output chacters
+ * return total number of output characters
  */
 static int
 utf8ucs2str(const u_int8_t *in, int n, u_int16_t *out, int m)
@@ -920,7 +920,7 @@ ucs2char8str(const u_int16_t *in, int n,
 
 /*
  * Convert 8bit character string into UCS-2 string
- * return total number of output chacters
+ * return total number of output characters
  */
 static int
 char8ucs2str(const u_int8_t *in, int n, u_int16_t *out, int m)



CVS commit: src/sys/fs/hfs

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 16:21:14 UTC 2023

Modified Files:
src/sys/fs/hfs: libhfs.c libhfs.h

Log Message:
fs/hfs: Avoid buffer overrun in hfslib_reada_node_offsets.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/hfs/libhfs.c
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/hfs/libhfs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/hfs

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 16:21:14 UTC 2023

Modified Files:
src/sys/fs/hfs: libhfs.c libhfs.h

Log Message:
fs/hfs: Avoid buffer overrun in hfslib_reada_node_offsets.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/hfs/libhfs.c
cvs rdiff -u -r1.8 -r1.9 src/sys/fs/hfs/libhfs.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/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.15 src/sys/fs/hfs/libhfs.c:1.16
--- src/sys/fs/hfs/libhfs.c:1.15	Sun Dec 30 22:40:00 2018
+++ src/sys/fs/hfs/libhfs.c	Wed Mar  1 16:21:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: libhfs.c,v 1.15 2018/12/30 22:40:00 sevan Exp $	*/
+/*	$NetBSD: libhfs.c,v 1.16 2023/03/01 16:21:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.15 2018/12/30 22:40:00 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.16 2023/03/01 16:21:14 riastradh Exp $");
 
 #include "libhfs.h"
 
@@ -1477,7 +1477,7 @@ hfslib_reada_node(void* in_bytes,
 		HFS_LIBERR("could not allocate node records");
 
 	last_bytes_read = hfslib_reada_node_offsets((uint8_t*)in_bytes + nodesize -
-			numrecords * sizeof(uint16_t), rec_offsets);
+			numrecords * sizeof(uint16_t), rec_offsets, numrecords);
 	if (last_bytes_read == 0)
 		HFS_LIBERR("could not read node record offsets");
 
@@ -1566,7 +1566,8 @@ exit:	
  *	in reverse order. Does not read the free space offset.
  */
 size_t
-hfslib_reada_node_offsets(void* in_bytes, uint16_t* out_offset_array)
+hfslib_reada_node_offsets(void* in_bytes, uint16_t* out_offset_array,
+uint16_t numrecords)
 {
 	void*		ptr;
 
@@ -1583,6 +1584,8 @@ hfslib_reada_node_offsets(void* in_bytes
 	 */
 	out_offset_array--;
 	do {
+		if (numrecords-- == 0)
+			return 0;
 		out_offset_array++;
 		*out_offset_array = be16tohp(&ptr);
 	} while (*out_offset_array != (uint16_t)14);

Index: src/sys/fs/hfs/libhfs.h
diff -u src/sys/fs/hfs/libhfs.h:1.8 src/sys/fs/hfs/libhfs.h:1.9
--- src/sys/fs/hfs/libhfs.h:1.8	Sat Jan  5 10:25:11 2019
+++ src/sys/fs/hfs/libhfs.h	Wed Mar  1 16:21:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: libhfs.h,v 1.8 2019/01/05 10:25:11 maya Exp $	*/
+/*	$NetBSD: libhfs.h,v 1.9 2023/03/01 16:21:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -585,7 +585,7 @@ size_t hfslib_read_master_directory_bloc
 	hfs_hfs_master_directory_block_t*);
 size_t hfslib_reada_node(void*, hfs_node_descriptor_t*, void***, uint16_t**,
 	hfs_btree_file_type, hfs_volume*, hfs_callback_args*);
-size_t hfslib_reada_node_offsets(void*, uint16_t*);
+size_t hfslib_reada_node_offsets(void*, uint16_t*, uint16_t);
 size_t hfslib_read_header_node(void**, uint16_t*, uint16_t,
 	hfs_header_record_t*, void*, void*);
 size_t hfslib_read_catalog_keyed_record(void*, hfs_catalog_keyed_record_t*,



CVS commit: src/sys/fs/hfs

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 16:21:26 UTC 2023

Modified Files:
src/sys/fs/hfs: libhfs.c

Log Message:
fs/hfs: Avoid undefined pointer arith in hfslib_reada_node_offsets.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/hfs/libhfs.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/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.16 src/sys/fs/hfs/libhfs.c:1.17
--- src/sys/fs/hfs/libhfs.c:1.16	Wed Mar  1 16:21:14 2023
+++ src/sys/fs/hfs/libhfs.c	Wed Mar  1 16:21:26 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: libhfs.c,v 1.16 2023/03/01 16:21:14 riastradh Exp $	*/
+/*	$NetBSD: libhfs.c,v 1.17 2023/03/01 16:21:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.16 2023/03/01 16:21:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.17 2023/03/01 16:21:26 riastradh Exp $");
 
 #include "libhfs.h"
 
@@ -1582,13 +1582,11 @@ hfslib_reada_node_offsets(void* in_bytes
 	 * offset=14, we know this is the last offset. In this way, we don't need
 	 * to know the number of records beforehand.
 	 */
-	out_offset_array--;
 	do {
 		if (numrecords-- == 0)
 			return 0;
-		out_offset_array++;
 		*out_offset_array = be16tohp(&ptr);
-	} while (*out_offset_array != (uint16_t)14);
+	} while (*out_offset_array++ != (uint16_t)14);
 
 	return ((uint8_t*)ptr - (uint8_t*)in_bytes);
 }



CVS commit: src/sys/fs/hfs

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 16:21:26 UTC 2023

Modified Files:
src/sys/fs/hfs: libhfs.c

Log Message:
fs/hfs: Avoid undefined pointer arith in hfslib_reada_node_offsets.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/hfs/libhfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 15 10:55:53 UTC 2022

Modified Files:
src/sys/fs/udf: udf_strat_direct.c udf_strat_rmw.c

Log Message:
s/adressing/addressing/


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/udf/udf_strat_direct.c
cvs rdiff -u -r1.29 -r1.30 src/sys/fs/udf/udf_strat_rmw.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Jan 15 10:55:53 UTC 2022

Modified Files:
src/sys/fs/udf: udf_strat_direct.c udf_strat_rmw.c

Log Message:
s/adressing/addressing/


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/udf/udf_strat_direct.c
cvs rdiff -u -r1.29 -r1.30 src/sys/fs/udf/udf_strat_rmw.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/udf/udf_strat_direct.c
diff -u src/sys/fs/udf/udf_strat_direct.c:1.14 src/sys/fs/udf/udf_strat_direct.c:1.15
--- src/sys/fs/udf/udf_strat_direct.c:1.14	Tue May 24 09:55:57 2016
+++ src/sys/fs/udf/udf_strat_direct.c	Sat Jan 15 10:55:53 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_strat_direct.c,v 1.14 2016/05/24 09:55:57 reinoud Exp $ */
+/* $NetBSD: udf_strat_direct.c,v 1.15 2022/01/15 10:55:53 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_strat_direct.c,v 1.14 2016/05/24 09:55:57 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_strat_direct.c,v 1.15 2022/01/15 10:55:53 msaitoh Exp $");
 #endif /* not lint */
 
 
@@ -347,7 +347,7 @@ udf_queue_buf_direct(struct udf_strat_ar
 	 * Translate new mappings in lmapping to pmappings and try to
 	 * conglomerate extents to reduce the number of writes.
 	 *
-	 * pmapping to contain lb_nums as used for disc adressing.
+	 * pmapping to contain lb_nums as used for disc addressing.
 	 */
 	pmapping = ump->la_pmapping;
 	sectors  = (buf->b_bcount + sector_size -1) / sector_size;

Index: src/sys/fs/udf/udf_strat_rmw.c
diff -u src/sys/fs/udf/udf_strat_rmw.c:1.29 src/sys/fs/udf/udf_strat_rmw.c:1.30
--- src/sys/fs/udf/udf_strat_rmw.c:1.29	Sat Aug 21 09:59:46 2021
+++ src/sys/fs/udf/udf_strat_rmw.c	Sat Jan 15 10:55:53 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_strat_rmw.c,v 1.29 2021/08/21 09:59:46 andvar Exp $ */
+/* $NetBSD: udf_strat_rmw.c,v 1.30 2022/01/15 10:55:53 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_strat_rmw.c,v 1.29 2021/08/21 09:59:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_strat_rmw.c,v 1.30 2022/01/15 10:55:53 msaitoh Exp $");
 #endif /* not lint */
 
 
@@ -956,7 +956,7 @@ udf_queuebuf_rmw(struct udf_strat_args *
 
 	/*
 	 * Translate new mappings in lmapping to pmappings.
-	 * pmapping to contain lb_nums as used for disc adressing.
+	 * pmapping to contain lb_nums as used for disc addressing.
 	 */
 	pmapping = ump->la_pmapping;
 	sectors  = (buf->b_bcount + sector_size -1) / sector_size;



CVS commit: src/sys/fs/udf

2022-01-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Jan 28 20:00:52 UTC 2022

Modified Files:
src/sys/fs/udf: udf_allocation.c

Log Message:
On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/fs/udf/udf_allocation.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-01-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Jan 28 20:00:52 UTC 2022

Modified Files:
src/sys/fs/udf: udf_allocation.c

Log Message:
On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/fs/udf/udf_allocation.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/udf/udf_allocation.c
diff -u src/sys/fs/udf/udf_allocation.c:1.44 src/sys/fs/udf/udf_allocation.c:1.45
--- src/sys/fs/udf/udf_allocation.c:1.44	Fri Sep  3 21:55:00 2021
+++ src/sys/fs/udf/udf_allocation.c	Fri Jan 28 20:00:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_allocation.c,v 1.44 2021/09/03 21:55:00 andvar Exp $ */
+/* $NetBSD: udf_allocation.c,v 1.45 2022/01/28 20:00:52 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.44 2021/09/03 21:55:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.45 2022/01/28 20:00:52 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -864,7 +864,7 @@ udf_search_free_vatloc(struct udf_mount 
 	}
 
 	/* mark entry with initialiser just in case */
-	lb_map = udf_rw32(0xfffe);
+	lb_map = udf_rw32(0x);
 	udf_vat_write(ump->vat_node, (uint8_t *) &lb_map, 4,
 		ump->vat_offset + lb_num *4);
 	ump->vat_last_free_lb = lb_num;



CVS commit: src/sys/fs/v7fs

2022-02-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Feb  1 17:12:24 UTC 2022

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
fix spelling of "regular" in comment


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.



CVS commit: src/sys/fs/v7fs

2022-02-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Feb  1 17:12:24 UTC 2022

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
fix spelling of "regular" in comment


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.32 src/sys/fs/v7fs/v7fs_vnops.c:1.33
--- src/sys/fs/v7fs/v7fs_vnops.c:1.32	Wed Oct 20 03:08:18 2021
+++ src/sys/fs/v7fs/v7fs_vnops.c	Tue Feb  1 17:12:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.32 2021/10/20 03:08:18 thorpej Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.33 2022/02/01 17:12:24 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.32 2021/10/20 03:08:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.33 2022/02/01 17:12:24 jakllsch Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -144,7 +144,7 @@ v7fs_lookup(void *v)
 		return 0;
 	}
 
-	/* ".." and reguler file. */
+	/* ".." and regular file. */
 	if ((error = v7fs_file_lookup_by_name(fs, parent, name, &ino))) {
 		/* Not found. Tell this entry be able to allocate. */
 		if (((nameiop == CREATE) || (nameiop == RENAME)) && islastcn) {



CVS commit: src/sys/fs/udf

2022-02-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Feb  3 09:46:26 UTC 2022

Modified Files:
src/sys/fs/udf: udf_allocation.c

Log Message:
Revere modification of initializer; it can lead to race conditions where two
allocation would pick the `empty' space causing a panic later on.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/fs/udf/udf_allocation.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/udf

2022-02-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Feb  3 09:46:26 UTC 2022

Modified Files:
src/sys/fs/udf: udf_allocation.c

Log Message:
Revere modification of initializer; it can lead to race conditions where two
allocation would pick the `empty' space causing a panic later on.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/fs/udf/udf_allocation.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/udf/udf_allocation.c
diff -u src/sys/fs/udf/udf_allocation.c:1.45 src/sys/fs/udf/udf_allocation.c:1.46
--- src/sys/fs/udf/udf_allocation.c:1.45	Fri Jan 28 20:00:52 2022
+++ src/sys/fs/udf/udf_allocation.c	Thu Feb  3 09:46:26 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_allocation.c,v 1.45 2022/01/28 20:00:52 reinoud Exp $ */
+/* $NetBSD: udf_allocation.c,v 1.46 2022/02/03 09:46:26 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.45 2022/01/28 20:00:52 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.46 2022/02/03 09:46:26 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -863,8 +863,8 @@ udf_search_free_vatloc(struct udf_mount 
 		ump->vat_entries++;
 	}
 
-	/* mark entry with initialiser just in case */
-	lb_map = udf_rw32(0x);
+	/* mark entry with non free-space initialiser just in case */
+	lb_map = udf_rw32(0xfffe);
 	udf_vat_write(ump->vat_node, (uint8_t *) &lb_map, 4,
 		ump->vat_offset + lb_num *4);
 	ump->vat_last_free_lb = lb_num;



CVS commit: src/sys/fs/v7fs

2022-02-05 Thread Zafer Aydogan
Module Name:src
Committed By:   zafer
Date:   Sat Feb  5 14:11:52 UTC 2022

Modified Files:
src/sys/fs/v7fs: v7fs_vfsops.c

Log Message:
fix membername in dprintf


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.



  1   2   3   4   >