CVS commit: src/usr.sbin/makefs

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 20:22:20 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Bump inode number on target FS from 32 bits to 64 bits


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/makefs/makefs.h

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



CVS commit: src/usr.sbin/makefs

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 20:22:20 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Bump inode number on target FS from 32 bits to 64 bits


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/makefs/makefs.h

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

Modified files:

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.41 src/usr.sbin/makefs/makefs.h:1.42
--- src/usr.sbin/makefs/makefs.h:1.41	Sun Feb 18 16:59:16 2024
+++ src/usr.sbin/makefs/makefs.h	Mon Jun 17 20:22:20 2024
@@ -89,7 +89,7 @@ enum fi_flags {
 };
 
 typedef struct {
-	uint32_t	 ino;		/* inode number used on target fs */
+	uint64_t	 ino;		/* inode number used on target fs */
 	uint32_t	 nlink;		/* number of links to this entry */
 	enum fi_flags	 flags;		/* flags used by fs specific code */
 	struct stat	 st;		/* stat entry */



CVS commit: src/usr.sbin/makefs/cd9660

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 13:31:17 UTC 2024

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_conversion.c

Log Message:
We know the target string buffer only needs 18 but gcc can't figure this out.
Fixes compiling with -Werror=format-truncation


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/cd9660/cd9660_conversion.c

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



CVS commit: src/usr.sbin/makefs/cd9660

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 13:31:17 UTC 2024

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_conversion.c

Log Message:
We know the target string buffer only needs 18 but gcc can't figure this out.
Fixes compiling with -Werror=format-truncation


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/cd9660/cd9660_conversion.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660/cd9660_conversion.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_conversion.c:1.5 src/usr.sbin/makefs/cd9660/cd9660_conversion.c:1.6
--- src/usr.sbin/makefs/cd9660/cd9660_conversion.c:1.5	Wed Feb  8 21:33:12 2017
+++ src/usr.sbin/makefs/cd9660/cd9660_conversion.c	Mon Jun 17 13:31:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_conversion.c,v 1.5 2017/02/08 21:33:12 christos Exp $	*/
+/*	$NetBSD: cd9660_conversion.c,v 1.6 2024/06/17 13:31:17 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_conversion.c,v 1.5 2017/02/08 21:33:12 christos Exp $");
+__RCSID("$NetBSD: cd9660_conversion.c,v 1.6 2024/06/17 13:31:17 reinoud Exp $");
 #endif  /* !__lint */
 
 
@@ -174,7 +174,7 @@ void
 cd9660_time_8426(unsigned char *buf, time_t tim)
 {
 	struct tm t;
-	char temp[18];
+	char temp[70];	/* we know its only 18 but gcc can't figure this out */
 
 	if (stampst.st_ino)
 		(void)gmtime_r(, );



CVS commit: src/sys/fs/cd9660

2024-05-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed May 15 11:01:27 UTC 2024

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

Log Message:
Fixing potential, though unlikely overflow as detected by coverity scan


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/fs/cd9660/cd9660_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.103 src/sys/fs/cd9660/cd9660_vfsops.c:1.104
--- src/sys/fs/cd9660/cd9660_vfsops.c:1.103	Sat Feb  3 22:39:27 2024
+++ src/sys/fs/cd9660/cd9660_vfsops.c	Wed May 15 11:01:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vfsops.c,v 1.103 2024/02/03 22:39:27 christos Exp $	*/
+/*	$NetBSD: cd9660_vfsops.c,v 1.104 2024/05/15 11:01:27 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.103 2024/02/03 22:39:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.104 2024/05/15 11:01:27 reinoud Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -845,7 +845,7 @@ cd9660_loadvnode(struct mount *mp, struc
 		struct buf *bp2;
 		if ((imp->im_flags & ISOFSMNT_EXTATT)
 		&& (off = isonum_711(isodir->ext_attr_length)))
-			cd9660_blkatoff(vp, (off_t)-(off << imp->im_bshift),
+			cd9660_blkatoff(vp, -((off_t) off << imp->im_bshift),
 			NULL, );
 		else
 			bp2 = NULL;



CVS commit: src/sys/fs/cd9660

2024-05-15 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed May 15 11:01:27 UTC 2024

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

Log Message:
Fixing potential, though unlikely overflow as detected by coverity scan


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

2023-06-27 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jun 27 09:58:50 UTC 2023

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

Log Message:
Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/udf/udf_strat_direct.c
cvs rdiff -u -r1.30 -r1.31 src/sys/fs/udf/udf_strat_rmw.c
cvs rdiff -u -r1.19 -r1.20 src/sys/fs/udf/udf_strat_sequential.c
cvs rdiff -u -r1.126 -r1.127 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

2023-06-27 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jun 27 09:58:50 UTC 2023

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

Log Message:
Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/udf/udf_strat_direct.c
cvs rdiff -u -r1.30 -r1.31 src/sys/fs/udf/udf_strat_rmw.c
cvs rdiff -u -r1.19 -r1.20 src/sys/fs/udf/udf_strat_sequential.c
cvs rdiff -u -r1.126 -r1.127 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.h
diff -u src/sys/fs/udf/udf.h:1.54 src/sys/fs/udf/udf.h:1.55
--- src/sys/fs/udf/udf.h:1.54	Sun Aug  7 11:06:19 2022
+++ src/sys/fs/udf/udf.h	Tue Jun 27 09:58:50 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.h,v 1.54 2022/08/07 11:06:19 andvar Exp $ */
+/* $NetBSD: udf.h,v 1.55 2023/06/27 09:58:50 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -76,7 +76,9 @@ extern int udf_verbose;
 #define UDF_DEBUG_RESERVE	0x100
 
 /* initial value of udf_verbose */
-#define UDF_DEBUGGING		(0)
+#define UDF_DEBUGGING		(0x000)
+//#define UDF_DEBUGGING		(0x02f)
+
 
 #ifdef UDF_DEBUG
 #define DPRINTF(name, arg) { \

Index: src/sys/fs/udf/udf_strat_direct.c
diff -u src/sys/fs/udf/udf_strat_direct.c:1.15 src/sys/fs/udf/udf_strat_direct.c:1.16
--- src/sys/fs/udf/udf_strat_direct.c:1.15	Sat Jan 15 10:55:53 2022
+++ src/sys/fs/udf/udf_strat_direct.c	Tue Jun 27 09:58:50 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_strat_direct.c,v 1.15 2022/01/15 10:55:53 msaitoh Exp $ */
+/* $NetBSD: udf_strat_direct.c,v 1.16 2023/06/27 09:58:50 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_strat_direct.c,v 1.15 2022/01/15 10:55:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_strat_direct.c,v 1.16 2023/06/27 09:58:50 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -116,7 +116,7 @@ udf_wr_nodedscr_callback(struct buf *buf
 	if (udf_node->outstanding_nodedscr == 0) {
 		/* unlock the node */
 		UDF_UNLOCK_NODE(udf_node, 0);
-		wakeup(_node->outstanding_nodedscr);
+		cv_broadcast(_node->node_lock);
 	}
 
 	putiobuf(buf);
@@ -223,7 +223,7 @@ out:
 	udf_node->outstanding_nodedscr--;
 	if (udf_node->outstanding_nodedscr == 0) {
 		UDF_UNLOCK_NODE(udf_node, 0);
-		wakeup(_node->outstanding_nodedscr);
+		cv_broadcast(_node->node_lock);
 	}
 
 	return error;

Index: src/sys/fs/udf/udf_strat_rmw.c
diff -u src/sys/fs/udf/udf_strat_rmw.c:1.30 src/sys/fs/udf/udf_strat_rmw.c:1.31
--- src/sys/fs/udf/udf_strat_rmw.c:1.30	Sat Jan 15 10:55:53 2022
+++ src/sys/fs/udf/udf_strat_rmw.c	Tue Jun 27 09:58:50 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_strat_rmw.c,v 1.30 2022/01/15 10:55:53 msaitoh Exp $ */
+/* $NetBSD: udf_strat_rmw.c,v 1.31 2023/06/27 09:58:50 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_strat_rmw.c,v 1.30 2022/01/15 10:55:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_strat_rmw.c,v 1.31 2023/06/27 09:58:50 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -756,7 +756,7 @@ udf_write_nodedscr_rmw(struct udf_strat_
 	if (udf_node->outstanding_nodedscr == 0) {
 		/* XXX still using wakeup! */
 		UDF_UNLOCK_NODE(udf_node, 0);
-		wakeup(_node->outstanding_nodedscr);
+		cv_broadcast(_node->node_lock);
 	}
 	udf_puteccline(eccline);
 
@@ -1205,6 +1205,8 @@ udf_discstrat_thread(void *arg)
 
 	work = 1;
 	priv->thread_running = 1;
+	cv_broadcast(>discstrat_cv);
+
 	mutex_enter(>discstrat_mutex);
 	priv->num_floating = 0;
 	while (priv->run_thread || work || priv->num_floating) {
@@ -1356,7 +1358,8 @@ udf_discstrat_thread(void *arg)
 
 	priv->thread_running  = 0;
 	priv->thread_finished = 1;
-	wakeup(>run_thread);
+	cv_broadcast(>discstrat_cv);
+
 	kthread_exit(0);
 	/* not reached */
 }
@@ -1459,9 +1462,11 @@ udf_discstrat_init_rmw(struct udf_strat_
 	}
 
 	/* wait for thread to spin up */
+	mutex_enter(>discstrat_mutex);
 	while (!priv->thread_running) {
-		tsleep(>thread_running, PRIBIO+1, "udfshedstart", hz);
+		cv_timedwait(>discstrat_cv, >discstrat_mutex, hz);
 	}
+	mutex_exit(>discstrat_mutex);
 }
 
 
@@ -1477,20 +1482,23 @@ udf_discstrat_finish_rmw(struct udf_stra
 	/* stop our sheduling thread */
 	KASSERT(priv->run_thread == 1);
 	priv->run_thread = 0;
-	wakeup(priv->queue_lwp);
+
+	mutex_enter(>discstrat_mutex);
 	while (!priv->thread_finished) {
-		tsleep(>run_thread, PRIBIO + 1, "udfshedfin", hz);
+		cv_broadcast(>discstrat_cv);
+		cv_timedwait(

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/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/doc

2022-12-18 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Dec 18 15:56:27 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Note the addition of trivial power management support for amdsmn(4) and
amdccp(4)


To generate a diff of this commit:
cvs rdiff -u -r1.2941 -r1.2942 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2941 src/doc/CHANGES:1.2942
--- src/doc/CHANGES:1.2941	Fri Dec 16 17:35:42 2022
+++ src/doc/CHANGES	Sun Dec 18 15:56:27 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2941 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2942 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -24,3 +24,5 @@
 # 
 
 Changes from NetBSD 10.0 to NetBSD 11.0:
+	amdsmn(4): added trivial power management support
+	amdccp(4): added trivial power management support



CVS commit: src/doc

2022-12-18 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Dec 18 15:56:27 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Note the addition of trivial power management support for amdsmn(4) and
amdccp(4)


To generate a diff of this commit:
cvs rdiff -u -r1.2941 -r1.2942 src/doc/CHANGES

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



CVS commit: src/sys

2022-12-18 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Dec 18 15:50:32 UTC 2022

Modified Files:
src/sys/arch/x86/pci: amdsmn.c
src/sys/dev/acpi: amdccp_acpi.c
src/sys/dev/fdt: amdccp_fdt.c
src/sys/dev/pci: amdccp_pci.c

Log Message:
Add amdsmn(4) and amdccp(4) power management stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/amdccp_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/amdccp_fdt.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/amdccp_pci.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/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.14 src/sys/arch/x86/pci/amdsmn.c:1.15
--- src/sys/arch/x86/pci/amdsmn.c:1.14	Sat Oct  1 15:50:05 2022
+++ src/sys/arch/x86/pci/amdsmn.c	Sun Dec 18 15:50:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.14 2022/10/01 15:50:05 msaitoh Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.15 2022/12/18 15:50:32 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.14 2022/10/01 15:50:05 msaitoh Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.15 2022/12/18 15:50:32 reinoud Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -159,6 +159,8 @@ amdsmn_attach(device_t parent, device_t 
 
 	// aprint_normal(": AMD Family 17h System Management Network\n");
 	aprint_normal(": AMD System Management Network\n");
+
+	pmf_device_register(self, NULL, NULL);
 	amdsmn_rescan(self, NULL, NULL);
 }
 
@@ -178,6 +180,8 @@ amdsmn_detach(device_t self, int flags)
 {
 	struct amdsmn_softc *sc = device_private(self);
 
+	pmf_device_deregister(self);
+
 	mutex_destroy(>smn_lock);
 	aprint_normal_dev(self,"detach!\n");
 

Index: src/sys/dev/acpi/amdccp_acpi.c
diff -u src/sys/dev/acpi/amdccp_acpi.c:1.5 src/sys/dev/acpi/amdccp_acpi.c:1.6
--- src/sys/dev/acpi/amdccp_acpi.c:1.5	Fri Jan 29 15:49:55 2021
+++ src/sys/dev/acpi/amdccp_acpi.c	Sun Dec 18 15:50:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_acpi.c,v 1.5 2021/01/29 15:49:55 thorpej Exp $ */
+/* $NetBSD: amdccp_acpi.c,v 1.6 2022/12/18 15:50:32 reinoud Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.5 2021/01/29 15:49:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.6 2022/12/18 15:50:32 reinoud Exp $");
 
 #include 
 #include 
@@ -103,6 +103,7 @@ amdccp_acpi_attach(device_t parent, devi
 #endif
 
 	amdccp_common_attach(sc);
+	pmf_device_register(self, NULL, NULL);
 
 done:
 	acpi_resource_cleanup();

Index: src/sys/dev/fdt/amdccp_fdt.c
diff -u src/sys/dev/fdt/amdccp_fdt.c:1.6 src/sys/dev/fdt/amdccp_fdt.c:1.7
--- src/sys/dev/fdt/amdccp_fdt.c:1.6	Wed Jan 27 03:10:21 2021
+++ src/sys/dev/fdt/amdccp_fdt.c	Sun Dec 18 15:50:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_fdt.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: amdccp_fdt.c,v 1.7 2022/12/18 15:50:32 reinoud Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.7 2022/12/18 15:50:32 reinoud Exp $");
 
 #include 
 #include 
@@ -89,4 +89,5 @@ amdccp_fdt_attach(device_t parent, devic
 	aprint_normal(": AMD CCP\n");
 
 	amdccp_common_attach(sc);
+	pmf_device_register(self, NULL, NULL);
 }

Index: src/sys/dev/pci/amdccp_pci.c
diff -u src/sys/dev/pci/amdccp_pci.c:1.3 src/sys/dev/pci/amdccp_pci.c:1.4
--- src/sys/dev/pci/amdccp_pci.c:1.3	Wed Oct 26 13:35:25 2022
+++ src/sys/dev/pci/amdccp_pci.c	Sun Dec 18 15:50:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_pci.c,v 1.3 2022/10/26 13:35:25 msaitoh Exp $ */
+/* $NetBSD: amdccp_pci.c,v 1.4 2022/12/18 15:50:32 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdccp_pci.c,v 1.3 2022/10/26 13:35:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_pci.c,v 1.4 2022/12/18 15:50:32 reinoud Exp $");
 
 #include 
 #include 
@@ -122,4 +122,5 @@ amdccp_pci_attach(device_t parent, devic
 	}
 
 	amdccp_common_attach(sc);
+	pmf_device_register(self, NULL, NULL);
 }



CVS commit: src/sys

2022-12-18 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Dec 18 15:50:32 UTC 2022

Modified Files:
src/sys/arch/x86/pci: amdsmn.c
src/sys/dev/acpi: amdccp_acpi.c
src/sys/dev/fdt: amdccp_fdt.c
src/sys/dev/pci: amdccp_pci.c

Log Message:
Add amdsmn(4) and amdccp(4) power management stubs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/pci/amdsmn.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/amdccp_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/amdccp_fdt.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/amdccp_pci.c

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



CVS commit: src/usr.sbin/sysinst

2022-12-10 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat Dec 10 20:58:37 UTC 2022

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
Update list with file systems who do have fsck adding udf since there is now a
fsck_udf.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.sbin/sysinst/disks.c

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

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.93 src/usr.sbin/sysinst/disks.c:1.94
--- src/usr.sbin/sysinst/disks.c:1.93	Sat Dec 10 16:52:02 2022
+++ src/usr.sbin/sysinst/disks.c	Sat Dec 10 20:58:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.93 2022/12/10 16:52:02 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.94 2022/12/10 20:58:37 reinoud Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -88,12 +88,12 @@ static const char name_prefix[] = NAME_P
 
 /* things we could have as /sbin/newfs_* and /sbin/fsck_* */
 static const char *extern_fs_with_chk[] = {
-	"ext2fs", "lfs", "msdos", "v7fs"
+	"ext2fs", "lfs", "msdos", "udf", "v7fs"
 };
 
 /* things we could have as /sbin/newfs_* but not /sbin/fsck_* */
 static const char *extern_fs_newfs_only[] = {
-	"sysvbfs", "udf"
+	"sysvbfs"
 };
 
 /* Local prototypes */



CVS commit: src/usr.sbin/sysinst

2022-12-10 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat Dec 10 20:58:37 UTC 2022

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
Update list with file systems who do have fsck adding udf since there is now a
fsck_udf.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.sbin/sysinst/disks.c

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



CVS commit: src/sys/kern

2022-09-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Sep 28 09:57:13 UTC 2022

Modified Files:
src/sys/kern: vfs_dirhash.c

Log Message:
Remove reference to udf_node in comment; it is FS agnostic.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/vfs_dirhash.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/kern/vfs_dirhash.c
diff -u src/sys/kern/vfs_dirhash.c:1.14 src/sys/kern/vfs_dirhash.c:1.15
--- src/sys/kern/vfs_dirhash.c:1.14	Sat Aug 21 09:59:46 2021
+++ src/sys/kern/vfs_dirhash.c	Wed Sep 28 09:57:13 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_dirhash.c,v 1.14 2021/08/21 09:59:46 andvar Exp $ */
+/* $NetBSD: vfs_dirhash.c,v 1.15 2022/09/28 09:57:13 reinoud Exp $ */
 
 /*
  * Copyright (c) 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.14 2021/08/21 09:59:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.15 2022/09/28 09:57:13 reinoud Exp $");
 
 /* CLEAN UP! */
 #include 
@@ -57,8 +57,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.
  * internal only and is FS/mountpoint/vnode independent. On exit of the
  * exported functions this mutex is not held.
  *
- * The dirhash structure is considered part of the vnode/inode/udf_node
- * structure and will thus use the lock that protects that vnode/inode.
+ * The dirhash structure is considered part of the vnode/inode structure and
+ * will thus use the lock that protects that vnode/inode.
  *
  * The dirhash entries are considered part of the dirhash structure and thus
  * are on the same lock.



CVS commit: src/sys/kern

2022-09-28 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Sep 28 09:57:13 UTC 2022

Modified Files:
src/sys/kern: vfs_dirhash.c

Log Message:
Remove reference to udf_node in comment; it is FS agnostic.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/vfs_dirhash.c

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



Re: CVS commit: src/sys/dev/nvmm

2022-09-15 Thread Reinoud Zandijk
Hi Taylor,

Thanks for updating NVMM! Would it be a good idea to sync our code with
DragonBSDs? AFAICS they kept the code compiling for NetBSD too. To have a
common code base?

With regards,
Reinoud

On Tue, Sep 13, 2022 at 08:10:04PM +, Taylor R Campbell wrote:
> Module Name:  src
> Committed By: riastradh
> Date: Tue Sep 13 20:10:04 UTC 2022
> 
> Modified Files:
>   src/sys/dev/nvmm: nvmm.c nvmm_internal.h
>   src/sys/dev/nvmm/x86: nvmm_x86_vmx.c
> 
> Log Message:
> nvmm(4): Add suspend/resume support.
> 
> New MD nvmm_impl callbacks:
> 
> - .suspend_interrupt forces all VMs on all physical CPUs to exit.
> - .vcpu_suspend suspends an individual vCPU on a machine.
> - .machine_suspend suspends an individual machine.
> - .suspend suspends the whole system.
> - .resume resumes the whole system.
> - .machine_resume resumes an individual machine.
> - .vcpu_resume resumes an indidivudal vCPU on a machine.
> 
> Suspending nvmm:
> 
> 1. causes new VM operations (ioctl and close) to block until resumed,
> 2. uses .suspend_interrupt to interrupt any concurrent and force them
>to return early, and then
> 3. uses the various suspend callbacks to suspend all vCPUs, machines,
>and the whole system -- all vCPUs before the machine they're on,
>and all machines before the system.
> 
> Resuming nvmm does the reverse of (3) -- resume system, resume each
> machine and then the vCPUs on that machine -- and then unblocks
> operations.
> 
> Implemented only for x86-vmx for now:
> 
> - suspend_interrupt triggers a TLB IPI to cause VM exits;
> - vcpu_suspend issues VMCLEAR to force any in-CPU state to be written
>   to memory;
> - machine_suspend does nothing;
> - suspend does VMXOFF on all CPUs;
> - resume does VMXON on all CPUs;
> - machine_resume does nothing; and
> - vcpu_resume just marks each vCPU as valid but inactive so
>   subsequent use will clear it and load it with vmptrld.
> 
> x86-svm left as an exercise for the reader.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.46 -r1.47 src/sys/dev/nvmm/nvmm.c
> cvs rdiff -u -r1.20 -r1.21 src/sys/dev/nvmm/nvmm_internal.h
> cvs rdiff -u -r1.84 -r1.85 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.


CVS commit: src/sys/ufs/ffs

2022-05-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri May 13 15:02:34 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
Fix typo dallocate -> deallocate


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/ufs/ffs/ffs_wapbl.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/ufs/ffs/ffs_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.46 src/sys/ufs/ffs/ffs_wapbl.c:1.47
--- src/sys/ufs/ffs/ffs_wapbl.c:1.46	Sat Apr 11 17:43:54 2020
+++ src/sys/ufs/ffs/ffs_wapbl.c	Fri May 13 15:02:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.46 2020/04/11 17:43:54 jdolecek Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.47 2022/05/13 15:02:34 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.46 2020/04/11 17:43:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.47 2022/05/13 15:02:34 reinoud Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -146,7 +146,7 @@ ffs_wapbl_replay_finish(struct mount *mp
 		 * The journal may have left partially allocated inodes in mode
 		 * zero.  This may occur if a crash occurs betweeen the node
 		 * allocation in ffs_nodeallocg and when the node is properly
-		 * initialized in ufs_makeinode.  If so, just dallocate them.
+		 * initialized in ufs_makeinode.  If so, just deallocate them.
 		 */
 		if (ip->i_mode == 0) {
 			error = UFS_WAPBL_BEGIN(mp);



CVS commit: src/sys/ufs/ffs

2022-05-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri May 13 15:02:34 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
Fix typo dallocate -> deallocate


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/ufs/ffs/ffs_wapbl.c

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



CVS commit: src/doc

2022-05-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon May  9 07:20:18 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Forgot to mention adding support for VirtIO PCI v1.0 attachments next to
legacy v0.9.


To generate a diff of this commit:
cvs rdiff -u -r1.2872 -r1.2873 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2872 src/doc/CHANGES:1.2873
--- src/doc/CHANGES:1.2872	Tue May  3 22:12:54 2022
+++ src/doc/CHANGES	Mon May  9 07:20:18 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2872 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2873 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -336,6 +336,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	bind: Import version 9.16.12. [christos 20210219]
 	OpenSSL: Imported 1.1.1j. [christos 20210219]
 	byacc: Update to 20210109. [christos 20210220]
+	virtio(4): Add support for VirtIO PCI v1.0 attachments next to legacy v0.9
+		[reinoud 20210120]
 	regex(3): Add NLS support and gnu regex extensions (off by default).
 		[christos 20210223]
 	wpa: Import wpa_supplicant and hostapd 2.9. [christos 20210228]



CVS commit: src/doc

2022-05-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon May  9 07:20:18 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Forgot to mention adding support for VirtIO PCI v1.0 attachments next to
legacy v0.9.


To generate a diff of this commit:
cvs rdiff -u -r1.2872 -r1.2873 src/doc/CHANGES

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



CVS commit: src/usr.sbin/makefs

2022-05-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun May  8 21:29:20 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Revert, sorry this was not intended to be committed.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/makefs.h

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

Modified files:

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.39 src/usr.sbin/makefs/makefs.h:1.40
--- src/usr.sbin/makefs/makefs.h:1.39	Sat May  7 08:54:02 2022
+++ src/usr.sbin/makefs/makefs.h	Sun May  8 21:29:20 2022
@@ -44,7 +44,7 @@
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #define HAVE_STRUCT_STAT_ST_GEN 1
 #define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
-//#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
+#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
 #define HAVE_STRUCT_STAT_BIRTHTIME 1
 #define HAVE_FSTATVFS 1
 #endif



CVS commit: src/usr.sbin/makefs

2022-05-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun May  8 21:29:20 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Revert, sorry this was not intended to be committed.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/makefs.h

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



CVS commit: src/usr.sbin/makefs

2022-05-07 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat May  7 08:54:02 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h udf.c

Log Message:
When creating disc images, keep the proposed size a multiple of the blockingnr
for good measure; this prevents possible burning/copying issues on packet
media.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.38 src/usr.sbin/makefs/makefs.h:1.39
--- src/usr.sbin/makefs/makefs.h:1.38	Sat Apr  9 10:05:35 2022
+++ src/usr.sbin/makefs/makefs.h	Sat May  7 08:54:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.h,v 1.38 2022/04/09 10:05:35 riastradh Exp $	*/
+/*	$nEtBSD: makefs.h,v 1.38 2022/04/09 10:05:35 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #define HAVE_STRUCT_STAT_ST_GEN 1
 #define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
-#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
+//#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
 #define HAVE_STRUCT_STAT_BIRTHTIME 1
 #define HAVE_FSTATVFS 1
 #endif

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.29 src/usr.sbin/makefs/udf.c:1.30
--- src/usr.sbin/makefs/udf.c:1.29	Tue Apr 26 15:18:08 2022
+++ src/usr.sbin/makefs/udf.c	Sat May  7 08:54:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.30 2022/05/07 08:54:02 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.30 2022/05/07 08:54:02 reinoud Exp $");
 
 #include 
 #include 
@@ -1130,7 +1130,24 @@ udf_enumerate_and_estimate(const char *d
 		stats->ndatablocks += (n - nblk);
 		nblk += n - nblk;
 	}
+
+	/* keep proposed size a multiple of blockingnr for image creation */
+	if (S_ISREG(dev_fd_stat.st_mode)) {
+		struct mmc_trackinfo ti;
+		int blockingnr;
+		int error;
+
+		/* adjust proposed size to be a multiple of the blockingnr */
+		udf_update_discinfo();
+		ti.tracknr = mmc_discinfo.first_track_last_session;
+		error = udf_update_trackinfo();
+		assert(!error);
+		blockingnr = udf_get_blockingnr();
+		nblk = UDF_ROUNDUP(nblk, blockingnr);
+	}
+
 	proposed_size = (off_t) nblk * fsopts->sectorsize;
+
 	/* sanity size */
 	if (proposed_size < 512*1024)
 		proposed_size = 512*1024;



CVS commit: src/usr.sbin/makefs

2022-05-07 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat May  7 08:54:02 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h udf.c

Log Message:
When creating disc images, keep the proposed size a multiple of the blockingnr
for good measure; this prevents possible burning/copying issues on packet
media.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/udf.c

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



CVS commit: src/sbin/newfs_udf

2022-05-07 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat May  7 08:51:32 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Data is written out in fixed sized packets; discs are normally a multiple of
the packet size but they don't have to be so never write past the last sector.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.9 src/sbin/newfs_udf/udf_core.c:1.10
--- src/sbin/newfs_udf/udf_core.c:1.9	Tue Apr 26 15:11:42 2022
+++ src/sbin/newfs_udf/udf_core.c	Sat May  7 08:51:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.9 2022/04/26 15:11:42 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.10 2022/05/07 08:51:32 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.9 2022/04/26 15:11:42 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.10 2022/05/07 08:51:32 reinoud Exp $");
 
 #include 
 #include 
@@ -3782,6 +3782,7 @@ udf_writeout_writequeue(bool complete)
 	int		 blockingnr = layout.blockingnr;
 	int		 linesize, offset, ret;
 	uint8_t		*linebuf;
+	int32_t		 wsects;
 	uint64_t	 present, all_present = -1;
 	uint64_t	 rpos, wpos;
 	static int	 t = 0;
@@ -3832,8 +3833,17 @@ udf_writeout_writequeue(bool complete)
 		if (complete || (packet->present == all_present)) {
 			printf("%c", "\\|/-"[t++ % 4]); fflush(stdout);fflush(stderr);
 //printf("write %lu + %d\n", packet->start_sectornr, linesize / context.sector_size);
+
+			/* don't write past last possible lba */
+			wsects = (mmc_discinfo.last_possible_lba + 1 - packet->start_sectornr);
+			assert(wsects >= 0);
+			wsects = MIN(wsects, blockingnr);
+	
 			wpos = (uint64_t) packet->start_sectornr * context.sector_size;
-			ret = pwrite(dev_fd, packet->packet_data, linesize, wpos);
+			ret = pwrite(dev_fd,
+packet->packet_data,
+wsects * context.sector_size,
+wpos);
 			printf("\b");
 			if (ret == -1)
 warn("error writing packet, "



CVS commit: src/sbin/newfs_udf

2022-05-07 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat May  7 08:51:32 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Data is written out in fixed sized packets; discs are normally a multiple of
the packet size but they don't have to be so never write past the last sector.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:18:08 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Avoid warning by clang of unused variable

While here, use the computated obj_size even though it's always the same as
its information length since we don't use extended attribute files or
stream directories.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.28 src/usr.sbin/makefs/udf.c:1.29
--- src/usr.sbin/makefs/udf.c:1.28	Tue Apr 26 14:59:37 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 15:18:08 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $");
 
 #include 
 #include 
@@ -473,6 +473,7 @@ udf_file_inject_blob(union dscrptr *dscr
 	dscr->tag.desc_crc_len = udf_rw16(crclen);
 	udf_validate_tag_and_crc_sums(dscr);
 
+	(void) obj_size;
 	return 0;
 }
 
@@ -617,7 +618,7 @@ udf_append_file_mapping(union dscrptr *d
 	} else if (udf_rw16(dscr->tag.id) == TAGID_EXTFENTRY) {
 		efe->l_ad = udf_rw32(l_ad);
 		efe->inf_len  = udf_rw64(inf_len);
-		efe->obj_size = udf_rw64(inf_len);
+		efe->obj_size = udf_rw64(obj_size);
 		efe->logblks_rec = udf_rw64(logblks_rec);
 	}
 }



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:18:08 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Avoid warning by clang of unused variable

While here, use the computated obj_size even though it's always the same as
its information length since we don't use extended attribute files or
stream directories.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makefs/udf.c

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



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:11:42 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug also in commented out code


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.8 src/sbin/newfs_udf/udf_core.c:1.9
--- src/sbin/newfs_udf/udf_core.c:1.8	Tue Apr 26 15:09:52 2022
+++ src/sbin/newfs_udf/udf_core.c	Tue Apr 26 15:11:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.8 2022/04/26 15:09:52 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.9 2022/04/26 15:11:42 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.8 2022/04/26 15:09:52 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.9 2022/04/26 15:11:42 reinoud Exp $");
 
 #include 
 #include 
@@ -3006,7 +3006,7 @@ udf_create_VAT(union dscrptr **vat_dscr,
 		fe->l_ad= udf_rw32(sizeof(struct long_ad));
 		blks = UDF_ROUNDUP(inf_len, context.sector_size) /
 			context.sector_size;
-		fe->logblks_rec = udf_rw32(blks);
+		fe->logblks_rec = udf_rw64(blks);
 
 		vat_len  = sizeof(struct file_entry)-1 - UDF_DESC_TAG_LENGTH;
 		vat_len += udf_rw32(fe->l_ad) + udf_rw32(fe->l_ea);



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:11:42 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug also in commented out code


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:09:53 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug : Logblks recorded in fe/efe VAT is 64 bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.7 src/sbin/newfs_udf/udf_core.c:1.8
--- src/sbin/newfs_udf/udf_core.c:1.7	Tue Apr 26 14:54:40 2022
+++ src/sbin/newfs_udf/udf_core.c	Tue Apr 26 15:09:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.7 2022/04/26 14:54:40 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.8 2022/04/26 15:09:52 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.7 2022/04/26 14:54:40 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.8 2022/04/26 15:09:52 reinoud Exp $");
 
 #include 
 #include 
@@ -2944,7 +2944,7 @@ udf_create_VAT(union dscrptr **vat_dscr,
 		fe->l_ad  = udf_rw32(sizeof(struct long_ad));
 		blks = UDF_ROUNDUP(inf_len, context.sector_size) /
 			context.sector_size;
-		fe->logblks_rec = udf_rw32(blks);
+		fe->logblks_rec = udf_rw64(blks);
 
 		/* update vat descriptor's CRC length */
 		vat_len  = sizeof(struct file_entry) - 1 - UDF_DESC_TAG_LENGTH;
@@ -2976,7 +2976,7 @@ udf_create_VAT(union dscrptr **vat_dscr,
 		efe->l_ad= udf_rw32(sizeof(struct long_ad));
 		blks = UDF_ROUNDUP(inf_len, context.sector_size) /
 			context.sector_size;
-		efe->logblks_rec = udf_rw32(blks);
+		efe->logblks_rec = udf_rw64(blks);
 
 		vat_len  = sizeof(struct extfile_entry)-1 - UDF_DESC_TAG_LENGTH;
 		vat_len += udf_rw32(efe->l_ad);



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:09:53 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug : Logblks recorded in fe/efe VAT is 64 bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 14:59:37 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug that resulted in UniqueIDs of 0 in file identifiers; note that
the the unique ID in a longad stored in a FID is 32 bit where in the file
descriptor (fe/efe) its 64 bits long.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 14:59:37 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug that resulted in UniqueIDs of 0 in file identifiers; note that
the the unique ID in a longad stored in a FID is 32 bit where in the file
descriptor (fe/efe) its 64 bits long.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.27 src/usr.sbin/makefs/udf.c:1.28
--- src/usr.sbin/makefs/udf.c:1.27	Tue Apr 26 13:27:24 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 14:59:37 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $");
 
 #include 
 #include 
@@ -666,13 +666,13 @@ udf_create_new_file(struct stat *st, uni
 		if (error)
 			errx(error, "can't create fe");
 		*dscr = (union dscrptr *) fe;
-		icb->longad_uniqueid = fe->unique_id;
+		icb->longad_uniqueid = udf_rw32(udf_rw64(fe->unique_id));
 	} else {
 		error = udf_create_new_efe(, filetype, st);
 		if (error)
 			errx(error, "can't create fe");
 		*dscr = (union dscrptr *) efe;
-		icb->longad_uniqueid = efe->unique_id;
+		icb->longad_uniqueid = udf_rw32(udf_rw64(efe->unique_id));
 	}
 
 	return 0;



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 14:54:40 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug in permission storage


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.6 src/sbin/newfs_udf/udf_core.c:1.7
--- src/sbin/newfs_udf/udf_core.c:1.6	Tue Apr 26 13:40:15 2022
+++ src/sbin/newfs_udf/udf_core.c	Tue Apr 26 14:54:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.6 2022/04/26 13:40:15 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.7 2022/04/26 14:54:40 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.6 2022/04/26 13:40:15 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.7 2022/04/26 14:54:40 reinoud Exp $");
 
 #include 
 #include 
@@ -2466,7 +2466,7 @@ udf_create_new_fe(struct file_entry **fe
 		fe->uid  = udf_rw32(st->st_uid);
 		fe->gid  = udf_rw32(st->st_gid);
 
-		fe->perm = unix_mode_to_udf_perm(st->st_mode);
+		fe->perm = udf_rw32(unix_mode_to_udf_perm(st->st_mode));
 
 		icbflags = udf_rw16(fe->icbtag.flags);
 		icbflags &= ~UDF_ICB_TAG_FLAGS_SETUID;
@@ -2566,7 +2566,7 @@ udf_create_new_efe(struct extfile_entry 
 		efe->uid = udf_rw32(st->st_uid);
 		efe->gid = udf_rw32(st->st_gid);
 
-		efe->perm = unix_mode_to_udf_perm(st->st_mode);
+		efe->perm = udf_rw32(unix_mode_to_udf_perm(st->st_mode));
 
 		icbflags = udf_rw16(efe->icbtag.flags);
 		icbflags &= ~UDF_ICB_TAG_FLAGS_SETUID;



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 14:54:40 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug in permission storage


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:40:15 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug with VAT 1.50 format


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.5 src/sbin/newfs_udf/udf_core.c:1.6
--- src/sbin/newfs_udf/udf_core.c:1.5	Mon Apr 25 20:41:25 2022
+++ src/sbin/newfs_udf/udf_core.c	Tue Apr 26 13:40:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.5 2022/04/25 20:41:25 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.6 2022/04/26 13:40:15 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.5 2022/04/25 20:41:25 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.6 2022/04/26 13:40:15 reinoud Exp $");
 
 #include 
 #include 
@@ -2922,7 +2922,7 @@ udf_create_VAT(union dscrptr **vat_dscr,
 		bpos = ((uint8_t *) implext->data) + 4;
 		vatlvext = (struct vatlvext_extattr_entry *) bpos;
 
-		vatlvext->unique_id_chk = udf_rw64(fe->unique_id);
+		vatlvext->unique_id_chk = fe->unique_id;
 		vatlvext->num_files = udf_rw32(context.num_files);
 		vatlvext->num_directories = udf_rw32(context.num_directories);
 		memcpy(vatlvext->logvol_id, context.logical_vol->logvol_id,128);



CVS commit: src/sbin/newfs_udf

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:40:15 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug with VAT 1.50 format


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:27:24 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
No need to use ceilf() when ceil() is already used


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:27:24 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
No need to use ceilf() when ceil() is already used


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.26 src/usr.sbin/makefs/udf.c:1.27
--- src/usr.sbin/makefs/udf.c:1.26	Tue Apr 26 13:26:30 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 13:27:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $");
 
 #include 
 #include 
@@ -1218,7 +1218,7 @@ udf_makefs(const char *image, const char
 	if (context.format_flags & FORMAT_META)
 		printf("Metadata percentage  %d%% (%d%% used)\n",
 			context.meta_perc,
-			(int) ceilf(100.0*stats.nmetadatablocks/stats.ndatablocks));
+			(int) ceil(100.0*stats.nmetadatablocks/stats.ndatablocks));
 	printf("\n");
 
 	/* prefix */



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:26:30 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug in makefs for udf


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.25 src/usr.sbin/makefs/udf.c:1.26
--- src/usr.sbin/makefs/udf.c:1.25	Sat Apr  9 10:05:35 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 13:26:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $ */
+/* $NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $");
+__RCSID("$NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $");
 
 #include 
 #include 
@@ -505,7 +505,7 @@ udf_append_file_mapping(union dscrptr *d
 	if (udf_rw16(dscr->tag.id) == TAGID_FENTRY) {
 		fe  = >fe;
 		data= fe->data;
-		l_ea= fe->l_ea;
+		l_ea= udf_rw32(fe->l_ea);
 		l_ad= udf_rw32(fe->l_ad);
 		icb = >icbtag;
 		inf_len = udf_rw64(fe->inf_len);
@@ -514,7 +514,7 @@ udf_append_file_mapping(union dscrptr *d
 	} else if (udf_rw16(dscr->tag.id) == TAGID_EXTFENTRY) {
 		efe = >efe;
 		data= efe->data;
-		l_ea= efe->l_ea;
+		l_ea= udf_rw32(efe->l_ea);
 		l_ad= udf_rw32(efe->l_ad);
 		icb = >icbtag;
 		inf_len = udf_rw64(efe->inf_len);



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:26:30 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug in makefs for udf


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/udf.c

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



CVS commit: src/sbin/newfs_udf

2022-04-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Apr 25 20:41:25 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug in logical volume creation for metadata/VAT partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.4 src/sbin/newfs_udf/udf_core.c:1.5
--- src/sbin/newfs_udf/udf_core.c:1.4	Fri Apr 22 21:22:14 2022
+++ src/sbin/newfs_udf/udf_core.c	Mon Apr 25 20:41:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.4 2022/04/22 21:22:14 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.5 2022/04/25 20:41:25 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.4 2022/04/22 21:22:14 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.5 2022/04/25 20:41:25 reinoud Exp $");
 
 #include 
 #include 
@@ -1206,7 +1206,7 @@ udf_create_base_logical_dscr(void)
 
 	/* just one fsd for now */
 	lvd->lv_fsd_loc.len = udf_rw32(sector_size);
-	lvd->lv_fsd_loc.loc.part_num = udf_rw32(context.metadata_part);
+	lvd->lv_fsd_loc.loc.part_num = udf_rw16(context.metadata_part);
 	lvd->lv_fsd_loc.loc.lb_num   = udf_rw32(layout.fsd);
 
 	crclen  = sizeof(struct logvol_desc) - 1 - UDF_DESC_TAG_LENGTH;



CVS commit: src/sbin/newfs_udf

2022-04-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Apr 25 20:41:25 UTC 2022

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian bug in logical volume creation for metadata/VAT partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/sbin/fsck_udf

2022-04-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Apr 25 15:37:14 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Relax constraints on sequential media detection by checking for VAT format.
This allows fixing images of VAT formatted media too.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_udf/main.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.12 src/sbin/fsck_udf/main.c:1.13
--- src/sbin/fsck_udf/main.c:1.12	Mon Apr 25 15:18:15 2022
+++ src/sbin/fsck_udf/main.c	Mon Apr 25 15:37:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $	*/
+/*	$NetBSD: main.c,v 1.13 2022/04/25 15:37:14 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.13 2022/04/25 15:37:14 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -2862,9 +2862,8 @@ udf_prepare_writing(void)
 	}
 
 	/* if we are not on sequential media, we're done */
-	if ((mmc_discinfo.mmc_cur & MMC_CAP_SEQUENTIAL) == 0)
+	if ((context.format_flags & FORMAT_VAT) == 0)
 		return 0;
-	assert(context.format_flags & FORMAT_VAT);
 
 	/* if the disc is full, we drop back to read only */
 	if (mmc_discinfo.disc_state == MMC_STATE_FULL)



CVS commit: src/sbin/fsck_udf

2022-04-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Apr 25 15:37:14 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Relax constraints on sequential media detection by checking for VAT format.
This allows fixing images of VAT formatted media too.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_udf/main.c

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



CVS commit: src/sbin/fsck_udf

2022-04-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Apr 25 15:18:15 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Fix endian bug in descriptor CRC length on updating a FE/EFE


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/fsck_udf/main.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.11 src/sbin/fsck_udf/main.c:1.12
--- src/sbin/fsck_udf/main.c:1.11	Sun Apr 24 15:07:08 2022
+++ src/sbin/fsck_udf/main.c	Mon Apr 25 15:18:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $	*/
+/*	$NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -3661,7 +3661,7 @@ udf_node_pass3_writeout_update(struct ud
 {
 	struct file_entry*fe  = NULL;
 	struct extfile_entry *efe = NULL;
-	int error;
+	int crc_len, error;
 
 	vat_writeout = 1;
 	if (udf_rw16(dscr->tag.id) == TAGID_FENTRY) {
@@ -3682,7 +3682,8 @@ udf_node_pass3_writeout_update(struct ud
 	}
 
 	/* fixup CRC length (if needed) */
-	dscr->tag.desc_crc_len = udf_tagsize(dscr, 1) - sizeof(struct desc_tag);
+	crc_len = udf_tagsize(dscr, 1) - sizeof(struct desc_tag);
+	dscr->tag.desc_crc_len = udf_rw16(crc_len);
 
 	pwarn("%s : updating node\n", udf_node_path(node));
 	error = udf_write_dscr_virt(dscr, udf_rw32(node->loc.loc.lb_num),



CVS commit: src/sbin/fsck_udf

2022-04-25 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Apr 25 15:18:15 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Fix endian bug in descriptor CRC length on updating a FE/EFE


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/fsck_udf/main.c

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



CVS commit: src/sbin/fsck_udf

2022-04-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 24 15:07:08 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Fix endian bug in allocation extents processing


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck_udf/main.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.10 src/sbin/fsck_udf/main.c:1.11
--- src/sbin/fsck_udf/main.c:1.10	Fri Apr 22 21:07:56 2022
+++ src/sbin/fsck_udf/main.c	Sun Apr 24 15:07:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $	*/
+/*	$NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -1088,7 +1088,7 @@ udf_process_file(union dscrptr *dscrptr,
 	lb_num, vpart_num,
 	1);
 			/* TODO check for prev_entry? */
-			l_ad = ext->l_ad;
+			l_ad = udf_rw32(ext->l_ad);
 			bpos = ext->data;
 			if (ad_type == UDF_ICB_SHORT_ALLOC)
 short_adp = (struct short_ad *) bpos;



CVS commit: src/sbin/fsck_udf

2022-04-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 24 15:07:08 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Fix endian bug in allocation extents processing


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck_udf/main.c

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



CVS commit: src/sys/compat/netbsd32

2022-04-23 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat Apr 23 17:46:23 UTC 2022

Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_fs.c

Log Message:
Implement support for mounting UDF in compat32
Fixes PR#56801


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.94 -r1.95 src/sys/compat/netbsd32/netbsd32_fs.c

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



CVS commit: src/sys/compat/netbsd32

2022-04-23 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat Apr 23 17:46:23 UTC 2022

Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_fs.c

Log Message:
Implement support for mounting UDF in compat32
Fixes PR#56801


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.94 -r1.95 src/sys/compat/netbsd32/netbsd32_fs.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/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.139 src/sys/compat/netbsd32/netbsd32.h:1.140
--- src/sys/compat/netbsd32/netbsd32.h:1.139	Thu Nov 11 17:32:46 2021
+++ src/sys/compat/netbsd32/netbsd32.h	Sat Apr 23 17:46:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.139 2021/11/11 17:32:46 martin Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.140 2022/04/23 17:46:23 reinoud Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1140,6 +1140,25 @@ struct netbsd32_msdosfs_args {
 	int	gmtoff;		/* v3: offset from UTC in seconds */
 };
 
+/* from  */
+struct netbsd32_udf_args {
+	uint32_t	 version;	/* version of this structure */
+	netbsd32_charp	 fspec;		/* mount specifier   */
+	int32_t		 sessionnr;	/* session specifier, rel of abs */
+	uint32_t	 udfmflags;	/* mount options */
+	int32_t		 gmtoff;	/* offset from UTC in seconds*/
+
+	uid_t		 anon_uid;	/* mapping of anonymous files uid*/
+	gid_t		 anon_gid;	/* mapping of anonymous files gid*/
+	uid_t		 nobody_uid;	/* nobody:nobody will map to -1:-1   */
+	gid_t		 nobody_gid;	/* nobody:nobody will map to -1:-1   */
+
+	uint32_t	 sector_size;	/* for mounting dumps/files  */
+
+	/* extendable */
+	uint8_t	 reserved[32];
+};
+
 /* from  */
 struct netbsd32_layer_args {
 	netbsd32_charp target;		/* Target of loopback  */

Index: src/sys/compat/netbsd32/netbsd32_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.94 src/sys/compat/netbsd32/netbsd32_fs.c:1.95
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.94	Sat Sep 11 10:08:55 2021
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Sat Apr 23 17:46:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.94 2021/09/11 10:08:55 riastradh Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.95 2022/04/23 17:46:23 reinoud Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.94 2021/09/11 10:08:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.95 2022/04/23 17:46:23 reinoud Exp $");
 
 #include 
 #include 
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -790,6 +791,7 @@ netbsd32___mount50(struct lwp *l, const 
 		struct netbsd32_iso_args iso_args;
 		struct netbsd32_nfs_args nfs_args;
 		struct netbsd32_msdosfs_args msdosfs_args;
+		struct netbsd32_udf_args udf_args;
 		struct netbsd32_tmpfs_args tmpfs_args;
 		struct netbsd32_null_args null_args;
 	} fs_args32;
@@ -799,6 +801,7 @@ netbsd32___mount50(struct lwp *l, const 
 		struct iso_args iso_args;
 		struct nfs_args nfs_args;
 		struct msdosfs_args msdosfs_args;
+		struct udf_args udf_args;
 		struct tmpfs_args tmpfs_args;
 		struct null_args null_args;
 	} fs_args;
@@ -925,6 +928,40 @@ netbsd32___mount50(struct lwp *l, const 
 		data_seg = UIO_SYSSPACE;
 		data = _args.msdosfs_args;
 		data_len = sizeof(fs_args.msdosfs_args);
+	} else if (strcmp(mtype, MOUNT_UDF) == 0) {
+		if (data_len != 0 && data_len < sizeof(fs_args32.udf_args))
+			return EINVAL;
+		if ((flags & MNT_GETARGS) == 0) {
+			error = copyin(data, _args32.udf_args,
+			sizeof(fs_args32.udf_args));
+			if (error)
+return error;
+			fs_args.udf_args.version =
+			fs_args32.udf_args.version;
+			fs_args.udf_args.fspec =
+			NETBSD32PTR64(fs_args32.udf_args.fspec);
+			fs_args.udf_args.sessionnr =
+			fs_args32.udf_args.sessionnr;
+			fs_args.udf_args.udfmflags =
+			fs_args32.udf_args.udfmflags;
+			fs_args.udf_args.gmtoff =
+			fs_args32.udf_args.gmtoff;
+			fs_args.udf_args.anon_uid =
+			fs_args32.udf_args.anon_uid;
+			fs_args.udf_args.anon_gid =
+			fs_args32.udf_args.anon_gid;
+			fs_args.udf_args.nobody_uid =
+			fs_args32.udf_args.nobody_uid;
+			fs_args.udf_args.nobody_gid =
+			fs_args32.udf_args.nobody_gid;
+			fs_args.udf_args.sector_size =
+			fs_args32.udf_args.sector_size;
+			memset(fs_args.udf_args.reserved, 0,
+			sizeof(fs_args.udf_args.reserved));
+		}
+		data_seg = UIO_SYSSPACE;
+		data = _args.udf_args;
+		data_len = sizeof(fs_args.udf_args);
 	} else if (strcmp(mtype, MOUNT_NFS) == 0) {
 		if (data_len != 0 && data_len < sizeof(fs_args32.nfs_args))
 			return EINVAL;
@@ -1032,6 +1069,35 @@ netbsd32___mount50(struct lwp *l, const 
 			error = copyout(_args32.iso_args, udata,
 sizeof(fs_args32.iso_args));
 			

CVS commit: src/sbin/newfs_udf

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

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian issues with UDF extended attributes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.3 src/sbin/newfs_udf/udf_core.c:1.4
--- src/sbin/newfs_udf/udf_core.c:1.3	Fri Apr 22 20:56:46 2022
+++ src/sbin/newfs_udf/udf_core.c	Fri Apr 22 21:22:14 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $ */
+/* $NetBSD: udf_core.c,v 1.4 2022/04/22 21:22:14 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.4 2022/04/22 21:22:14 reinoud Exp $");
 
 #include 
 #include 
@@ -2269,11 +2269,11 @@ udf_extattr_search_intern(union dscrptr 
 		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/sbin/newfs_udf

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

Modified Files:
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian issues with UDF extended attributes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/newfs_udf/udf_core.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-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/sbin/fsck_udf

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

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Remove the error condition for these cases; the VAT LVExtension is
missing/corrupt but fsck_udf will reconstruct them anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/fsck_udf/main.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.9 src/sbin/fsck_udf/main.c:1.10
--- src/sbin/fsck_udf/main.c:1.9	Fri Apr 22 21:00:28 2022
+++ src/sbin/fsck_udf/main.c	Fri Apr 22 21:07:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $	*/
+/*	$NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -1873,6 +1873,7 @@ udf_extract_vat(union dscrptr *dscr, uin
 		error = udf_extattr_search_intern(dscr, 2048, extstr, , _l);
 		if (error) {
 			/* VAT LVExtension extended attribute missing */
+			error = 0;
 			vat_writeout = 1;
 			goto ok;
 		}
@@ -1881,6 +1882,7 @@ udf_extract_vat(union dscrptr *dscr, uin
 		error = udf_impl_extattr_check(implext);
 		if (error) {
 			/* VAT LVExtension checksum failed */
+			error = 0;
 			vat_writeout = 1;
 			goto ok;
 		}
@@ -1888,6 +1890,7 @@ udf_extract_vat(union dscrptr *dscr, uin
 		/* paranoia */
 		if (a_l != sizeof(*implext) -2 + udf_rw32(implext->iu_l) + sizeof(lvext)) {
 			/* VAT LVExtension size doesn't compute */
+			error = 0;
 			vat_writeout = 1;
 			goto ok;
 		}



CVS commit: src/sbin/fsck_udf

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

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Remove the error condition for these cases; the VAT LVExtension is
missing/corrupt but fsck_udf will reconstruct them anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/fsck_udf/main.c

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



CVS commit: src/sbin/fsck_udf

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

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Prevent reading beyond the early_vat_location


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/fsck_udf/main.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.8 src/sbin/fsck_udf/main.c:1.9
--- src/sbin/fsck_udf/main.c:1.8	Fri Apr 22 20:56:46 2022
+++ src/sbin/fsck_udf/main.c	Fri Apr 22 21:00:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $	*/
+/*	$NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -2148,6 +2148,8 @@ udf_search_vat(union udf_pmap *mapping, 
 		} else {
 			late_vat_loc = early_vat_loc - 1;
 		}
+		if (early_vat_loc == first_possible_vat_location)
+			break;
 		early_vat_loc = first_possible_vat_location;
 		if (late_vat_loc > VAT_BLK)
 			early_vat_loc = MAX(early_vat_loc, late_vat_loc - VAT_BLK);



CVS commit: src/sbin/fsck_udf

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

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Prevent reading beyond the early_vat_location


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/fsck_udf/main.c

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



CVS commit: src/sbin

2022-04-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr 22 20:56:46 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian issues with fsck_udf/newfs_udf/makefs


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/fsck_udf/main.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_udf/udf_core.c

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



CVS commit: src/sbin

2022-04-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Apr 22 20:56:46 UTC 2022

Modified Files:
src/sbin/fsck_udf: main.c
src/sbin/newfs_udf: udf_core.c

Log Message:
Fix endian issues with fsck_udf/newfs_udf/makefs


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/fsck_udf/main.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_udf/udf_core.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.7 src/sbin/fsck_udf/main.c:1.8
--- src/sbin/fsck_udf/main.c:1.7	Fri Apr 22 19:21:08 2022
+++ src/sbin/fsck_udf/main.c	Fri Apr 22 20:56:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $	*/
+/*	$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -362,13 +362,13 @@ udf_wipe_and_reallocate(union dscrptr *d
 	/* create one short_ad or one long_ad */
 	if (ad_type == UDF_ICB_SHORT_ALLOC) {
 		short_adp = (struct short_ad *) bpos;
-		short_adp->len= udf_rw64(inf_len);
+		short_adp->len= udf_rw32(inf_len);
 		short_adp->lb_num = allocated.loc.lb_num;
 		l_ad = sizeof(struct short_ad);
 	} else {
 		long_adp  = (struct long_ad  *) bpos;
 		memcpy(long_adp, , sizeof(struct long_ad));
-		long_adp->len = udf_rw64(inf_len);
+		long_adp->len = udf_rw32(inf_len);
 		l_ad = sizeof(struct long_ad);
 	}
 	if (id == TAGID_FENTRY)
@@ -2600,7 +2600,7 @@ udf_process_vds(void) {
 			 * data file length
 			 */
 			context.part_size[log_part] =
-udf_rw32(context.meta_file->inf_len) / context.sector_size;
+udf_rw64(context.meta_file->inf_len) / context.sector_size;
 			break;
 		default:
 			break;

Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.2 src/sbin/newfs_udf/udf_core.c:1.3
--- src/sbin/newfs_udf/udf_core.c:1.2	Sat Apr  9 09:58:11 2022
+++ src/sbin/newfs_udf/udf_core.c	Fri Apr 22 20:56:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.2 2022/04/09 09:58:11 riastradh Exp $ */
+/* $NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf_core.c,v 1.2 2022/04/09 09:58:11 riastradh Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $");
 
 #include 
 #include 
@@ -2024,7 +2024,7 @@ udf_fidsize(struct fileid_desc *fid)
 	if (udf_rw16(fid->tag.id) != TAGID_FID)
 		errx(1, "internal error, bad tag in %s", __func__);
 
-	size = UDF_FID_SIZE + udf_rw16(fid->l_fi) + udf_rw16(fid->l_iu);
+	size = UDF_FID_SIZE + fid->l_fi + udf_rw16(fid->l_iu);
 	size = (size + 3) & ~3;
 
 	return size;



CVS commit: src/sbin/fsck_udf

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

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Avoid assigned but unused compiler warnings when compiling with clang


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_udf/main.c

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

Modified files:

Index: src/sbin/fsck_udf/main.c
diff -u src/sbin/fsck_udf/main.c:1.6 src/sbin/fsck_udf/main.c:1.7
--- src/sbin/fsck_udf/main.c:1.6	Sat Apr  9 09:59:16 2022
+++ src/sbin/fsck_udf/main.c	Fri Apr 22 19:21:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.6 2022/04/09 09:59:16 riastradh Exp $	*/
+/*	$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.6 2022/04/09 09:59:16 riastradh Exp $");
+__RCSID("$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $");
 #endif /* not lint */
 
 #include 
@@ -3545,6 +3545,7 @@ udf_process_node_pass1(struct udf_fsck_n
 			udf_node_path(node));
 		return EINVAL;
 	}
+	(void) fpos;
 	return 0;
 }
 
@@ -3646,6 +3647,7 @@ udf_node_pass3_repairdir(struct udf_fsck
 			_context);
 	if (error)
 		pwarn("Failed to write out directory!\n");
+	(void) fpos;
 }
 
 



CVS commit: src/sbin/fsck_udf

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

Modified Files:
src/sbin/fsck_udf: main.c

Log Message:
Avoid assigned but unused compiler warnings when compiling with clang


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_udf/main.c

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



CVS commit: src/sys/conf

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 14:47:54 UTC 2022

Modified Files:
src/sys/conf: filesystems.config

Log Message:
Keep UDF commented out by default


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/conf/filesystems.config

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

Modified files:

Index: src/sys/conf/filesystems.config
diff -u src/sys/conf/filesystems.config:1.15 src/sys/conf/filesystems.config:1.16
--- src/sys/conf/filesystems.config:1.15	Wed Apr  6 13:59:22 2022
+++ src/sys/conf/filesystems.config	Wed Apr  6 14:47:54 2022
@@ -1,4 +1,4 @@
-# $NetBSD: filesystems.config,v 1.15 2022/04/06 13:59:22 reinoud Exp $
+# $NetBSD: filesystems.config,v 1.16 2022/04/06 14:47:54 reinoud Exp $
 #file-system	ADOSFS		# AmigaDOS-compatible file system
 #options 	APPLE_UFS	# Apple UFS support in FFS
 #file-system	AUTOFS		# Automounter Filesystem
@@ -28,7 +28,7 @@ file-system	PUFFS		# Userspace file syst
 pseudo-device	putter		# for puffs and pud
 #file-system	SYSVBFS		# sysvfs
 file-system	TMPFS		# Efficient memory file-system
-file-system	UDF		# OSTA UDF CD/DVD file-system
+#file-system	UDF		# OSTA UDF CD/DVD file-system
 file-system	UMAPFS		# NULLFS + uid and gid remapping
 file-system	UNION		# union file system
 #file-system	V7FS		# 7th Edition(V7) File System



CVS commit: src/sys/conf

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 14:47:54 UTC 2022

Modified Files:
src/sys/conf: filesystems.config

Log Message:
Keep UDF commented out by default


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/conf/filesystems.config

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



CVS commit: src/distrib/sets/lists/debug

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 14:28:44 UTC 2022

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
Add fsck_udf to the debug sets


To generate a diff of this commit:
cvs rdiff -u -r1.374 -r1.375 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.374 src/distrib/sets/lists/debug/mi:1.375
--- src/distrib/sets/lists/debug/mi:1.374	Mon Mar 28 20:52:17 2022
+++ src/distrib/sets/lists/debug/mi	Wed Apr  6 14:28:44 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.374 2022/03/28 20:52:17 christos Exp $
+# $NetBSD: mi,v 1.375 2022/04/06 14:28:44 reinoud Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -360,6 +360,7 @@
 ./usr/libdata/debug/sbin/fsck_ffs.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsck_lfs.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsck_msdos.debug	comp-sysutil-debug	debug
+./usr/libdata/debug/sbin/fsck_udf.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsck_v7fs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsdb.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/fsirand.debug		comp-sysutil-debug	debug



CVS commit: src/distrib/sets/lists/debug

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 14:28:44 UTC 2022

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
Add fsck_udf to the debug sets


To generate a diff of this commit:
cvs rdiff -u -r1.374 -r1.375 src/distrib/sets/lists/debug/mi

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



CVS commit: src

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 14:20:07 UTC 2022

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/man: mi
src/sbin: Makefile

Log Message:
Add the fsck_udf(8) tool to the build and release


To generate a diff of this commit:
cvs rdiff -u -r1.1292 -r1.1293 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.1737 -r1.1738 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.135 -r1.136 src/sbin/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1292 src/distrib/sets/lists/base/mi:1.1293
--- src/distrib/sets/lists/base/mi:1.1292	Mon Mar  7 09:45:02 2022
+++ src/distrib/sets/lists/base/mi	Wed Apr  6 14:20:07 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1292 2022/03/07 09:45:02 mrg Exp $
+# $NetBSD: mi,v 1.1293 2022/04/06 14:20:07 reinoud Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -382,6 +382,7 @@
 ./sbin/fsck_ffs	base-sysutil-root
 ./sbin/fsck_lfs	base-sysutil-root
 ./sbin/fsck_msdosbase-sysutil-root
+./sbin/fsck_udf	base-sysutil-root
 ./sbin/fsck_v7fsbase-sysutil-root
 ./sbin/fsdb	base-sysutil-root
 ./sbin/fsirand	base-sysutil-root

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1737 src/distrib/sets/lists/man/mi:1.1738
--- src/distrib/sets/lists/man/mi:1.1737	Thu Mar 24 16:33:05 2022
+++ src/distrib/sets/lists/man/mi	Wed Apr  6 14:20:07 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1737 2022/03/24 16:33:05 wiz Exp $
+# $NetBSD: mi,v 1.1738 2022/04/06 14:20:07 reinoud Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2626,6 +2626,7 @@
 ./usr/share/man/cat8/fsck_ffs.0			man-sysutil-catman	.cat
 ./usr/share/man/cat8/fsck_lfs.0			man-sysutil-catman	.cat
 ./usr/share/man/cat8/fsck_msdos.0		man-sysutil-catman	.cat
+./usr/share/man/cat8/fsck_udf.0			man-sysutil-catman	.cat
 ./usr/share/man/cat8/fsck_v7fs.0		man-sysutil-catman	.cat
 ./usr/share/man/cat8/fsdb.0			man-sysutil-catman	.cat
 ./usr/share/man/cat8/fsinfo.0			man-sysutil-catman	.cat
@@ -5722,6 +5723,7 @@
 ./usr/share/man/html8/fsck_ffs.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/fsck_lfs.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/fsck_msdos.html		man-sysutil-htmlman	html
+./usr/share/man/html8/fsck_udf.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/fsck_v7fs.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/fsdb.html			man-sysutil-htmlman	html
 ./usr/share/man/html8/fsinfo.html		man-sysutil-htmlman	html
@@ -8907,6 +8909,7 @@
 ./usr/share/man/man8/fsck_ffs.8			man-sysutil-man		.man
 ./usr/share/man/man8/fsck_lfs.8			man-sysutil-man		.man
 ./usr/share/man/man8/fsck_msdos.8		man-sysutil-man		.man
+./usr/share/man/man8/fsck_udf.8			man-sysutil-man		.man
 ./usr/share/man/man8/fsck_v7fs.8		man-sysutil-man		.man
 ./usr/share/man/man8/fsdb.8			man-sysutil-man		.man
 ./usr/share/man/man8/fsinfo.8			man-sysutil-man		.man

Index: src/sbin/Makefile
diff -u src/sbin/Makefile:1.135 src/sbin/Makefile:1.136
--- src/sbin/Makefile:1.135	Thu Feb 24 03:35:32 2022
+++ src/sbin/Makefile	Wed Apr  6 14:20:07 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.135 2022/02/24 03:35:32 mrg Exp $
+#	$NetBSD: Makefile,v 1.136 2022/04/06 14:20:07 reinoud Exp $
 #	@(#)Makefile	8.5 (Berkeley) 3/31/94
 
 # Not ported: XNSrouted enpload scsiformat startslip
@@ -22,7 +22,7 @@ SUBDIR+= newfs fsck_ffs fsdb dump restor
 SUBDIR+= newfs_lfs fsck_lfs dump_lfs resize_lfs
 SUBDIR+= newfs_msdos fsck_msdos
 SUBDIR+= newfs_sysvbfs
-SUBDIR+= newfs_udf
+SUBDIR+= newfs_udf fsck_udf
 SUBDIR+= newfs_v7fs fsck_v7fs
 SUBDIR+= mount_ados
 SUBDIR+= mount_autofs



CVS commit: src

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 14:20:07 UTC 2022

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/man: mi
src/sbin: Makefile

Log Message:
Add the fsck_udf(8) tool to the build and release


To generate a diff of this commit:
cvs rdiff -u -r1.1292 -r1.1293 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.1737 -r1.1738 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.135 -r1.136 src/sbin/Makefile

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



CVS commit: src/sys/conf

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:59:22 UTC 2022

Modified Files:
src/sys/conf: filesystems.config

Log Message:
UDF has been around for more than a decade in the kernel. Now with a
fsck_udf(8) it is not making sense to keep it calling `experimental'.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/conf/filesystems.config

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



CVS commit: src/sys/conf

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:59:22 UTC 2022

Modified Files:
src/sys/conf: filesystems.config

Log Message:
UDF has been around for more than a decade in the kernel. Now with a
fsck_udf(8) it is not making sense to keep it calling `experimental'.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/conf/filesystems.config

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

Modified files:

Index: src/sys/conf/filesystems.config
diff -u src/sys/conf/filesystems.config:1.14 src/sys/conf/filesystems.config:1.15
--- src/sys/conf/filesystems.config:1.14	Sat Apr  4 15:43:22 2020
+++ src/sys/conf/filesystems.config	Wed Apr  6 13:59:22 2022
@@ -1,4 +1,4 @@
-# $NetBSD: filesystems.config,v 1.14 2020/04/04 15:43:22 jdolecek Exp $
+# $NetBSD: filesystems.config,v 1.15 2022/04/06 13:59:22 reinoud Exp $
 #file-system	ADOSFS		# AmigaDOS-compatible file system
 #options 	APPLE_UFS	# Apple UFS support in FFS
 #file-system	AUTOFS		# Automounter Filesystem
@@ -28,7 +28,7 @@ file-system	PUFFS		# Userspace file syst
 pseudo-device	putter		# for puffs and pud
 #file-system	SYSVBFS		# sysvfs
 file-system	TMPFS		# Efficient memory file-system
-#file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
+file-system	UDF		# OSTA UDF CD/DVD file-system
 file-system	UMAPFS		# NULLFS + uid and gid remapping
 file-system	UNION		# union file system
 #file-system	V7FS		# 7th Edition(V7) File System



CVS commit: src/doc

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:43:24 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Added fsck_udf(8) and upgraded newfs_udf/makefs for UDF


To generate a diff of this commit:
cvs rdiff -u -r1.2868 -r1.2869 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2868 src/doc/CHANGES:1.2869
--- src/doc/CHANGES:1.2868	Sun Apr  3 01:12:47 2022
+++ src/doc/CHANGES	Wed Apr  6 13:43:24 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2868 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2869 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -486,3 +486,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		from previously merged zones) [kre 20220320] 
 	tzcode: Updated to 2022a. [christos 20220322]
 	dhcp: Import version 4.4.3. [christos 20220402]
+	udf: Added fsck_udf(8) and upgraded newfs_udf/makefs for UDF. [reinoud 20220506]
+



CVS commit: src/doc

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:43:24 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Added fsck_udf(8) and upgraded newfs_udf/makefs for UDF


To generate a diff of this commit:
cvs rdiff -u -r1.2868 -r1.2869 src/doc/CHANGES

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



CVS commit: src/sbin/fsck_udf

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:35:50 UTC 2022

Added Files:
src/sbin/fsck_udf: Makefile fsck_udf.8 main.c

Log Message:
Initial commit of the fsck_udf(8) utility that checks and repairs UDF
filesystems on optical media as well as on disc images, harddisc partitions
and wedges.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sbin/fsck_udf/Makefile \
src/sbin/fsck_udf/fsck_udf.8 src/sbin/fsck_udf/main.c

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



CVS commit: src/sbin/fsck_udf

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:35:50 UTC 2022

Added Files:
src/sbin/fsck_udf: Makefile fsck_udf.8 main.c

Log Message:
Initial commit of the fsck_udf(8) utility that checks and repairs UDF
filesystems on optical media as well as on disc images, harddisc partitions
and wedges.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sbin/fsck_udf/Makefile \
src/sbin/fsck_udf/fsck_udf.8 src/sbin/fsck_udf/main.c

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

Added files:

Index: src/sbin/fsck_udf/Makefile
diff -u /dev/null src/sbin/fsck_udf/Makefile:1.1
--- /dev/null	Wed Apr  6 13:35:50 2022
+++ src/sbin/fsck_udf/Makefile	Wed Apr  6 13:35:50 2022
@@ -0,0 +1,23 @@
+#	$NetBSD: Makefile,v 1.1 2022/04/06 13:35:50 reinoud Exp $
+
+.include 
+
+PROG=	fsck_udf
+MAN=	fsck_udf.8
+SRCS=	main.c udf_core.c \
+	udf_osta.c fattr.c fsutil.c
+
+FSCK=	${NETBSDSRCDIR}/sbin/fsck
+NEWFS=	${NETBSDSRCDIR}/sbin/newfs_udf
+MOUNT=	${NETBSDSRCDIR}/sbin/mount
+KUDF=	${NETBSDSRCDIR}/sys/fs/udf
+CPPFLAGS+= -I${FSCK} -I${KUDF} -I${NEWFS} -I${NETBSDSRCDIR}/sys
+.PATH:	${FSCK} ${NEWFS} ${MOUNT} ${KUDF}
+
+DPADD+=${LIBUTIL}
+LDADD+=-lutil -lprop
+
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
+CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
+
+.include 
Index: src/sbin/fsck_udf/fsck_udf.8
diff -u /dev/null src/sbin/fsck_udf/fsck_udf.8:1.1
--- /dev/null	Wed Apr  6 13:35:50 2022
+++ src/sbin/fsck_udf/fsck_udf.8	Wed Apr  6 13:35:50 2022
@@ -0,0 +1,115 @@
+.\"	$NetBSD: fsck_udf.8,v 1.1 2022/04/06 13:35:50 reinoud Exp $
+.\"
+.\" Copyright (C) 2022 Reinoud Zandijk
+.\" Based on fsck_msdos(8) by
+.\" Copyright (C) 1995 Wolfgang Solfrank
+.\" Copyright (c) 1995 Martin Husemann
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"
+.Dd February 6, 2022
+.Dt FSCK_UDF 8
+.Os
+.Sh NAME
+.Nm fsck_udf
+.Nd Universal Disk Format filesystem consistency checker
+.Sh SYNOPSIS
+.Nm
+.Fl p
+.Op Fl fH
+.Ar filesystem ...
+.Nm
+.Op Fl sSynfH
+.Ar filesystem ...
+.Sh DESCRIPTION
+The
+.Nm
+utility verifies and repairs
+.Tn Universal Disk Format
+filesystems (more commonly known as
+.Tn UDF
+filesystems).
+.Pp
+The first form of
+.Nm
+preens the specified filesystems.
+It is normally started by
+.Xr fsck 8
+run from
+.Pa /etc/rc
+during automatic reboot, when an UDF filesystem is detected.
+When preening file systems,
+.Nm
+will fix common inconsistencies non-interactively.
+If more serious problems are found,
+.Nm
+does not try to fix them, indicates that it was not
+successful, and exits.
+.Pp
+The second form of
+.Nm
+checks the specified file systems and tries to repair all
+detected inconsistencies, requesting confirmation before
+making any changes.
+.Pp
+The options are as follows:
+.Bl -tag -width XXXoptions
+.It Fl f
+Force detailed checking even when file system is marked closed.
+.It Fl n
+Causes
+.Nm
+to assume no as the answer to all operator
+questions.
+.It Fl p
+Preen the specified filesystems.
+.It Fl y
+Causes
+.Nm
+to assume yes as the answer to all operator questions.
+.It Fl s Ar session
+Select session
+.Ar session
+to be checked on recordable media. This allows older sessions
+of the file system on recordable media to be recovered.
+.It Fl S
+Causes
+.Nm
+to scan for older VAT tables on recordable media. This allows older snapshots
+of the file system on recordable media to be recovered.
+.It Fl H
+Enables heuristic repair options repairing known corruptions in the wild
+caused by bugs.
+.El
+.Sh SEE ALSO
+.Xr fsck 8 ,
+.Xr fsck_

CVS commit: src

2022-04-06 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Apr  6 13:29:16 UTC 2022

Modified Files:
src/sbin/newfs_udf: Makefile newfs_udf.c newfs_udf.h
src/usr.sbin/makefs: makefs.8 udf.c
src/usr.sbin/makefs/udf: Makefile.inc
Added Files:
src/sbin/newfs_udf: udf_core.c udf_core.h
Removed Files:
src/sbin/newfs_udf: udf_create.c udf_create.h udf_write.c udf_write.h

Log Message:
Refactor and rewrite of newfs_udf(8) and makefs(8) (-t udf) with a shared
section for fsck_udf(8).

Newfs_udf and makefs support predefined disc image profiles, harddisc
partitions (disklabel and wedges on all generic block devices) and all optical
media types on CD/DVD/BD writers.

Newfs_udf and makefs now also support formatting of UDF 2.50 with a metadata
partition.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/newfs_udf/Makefile \
src/sbin/newfs_udf/newfs_udf.h
cvs rdiff -u -r1.22 -r1.23 src/sbin/newfs_udf/newfs_udf.c
cvs rdiff -u -r0 -r1.1 src/sbin/newfs_udf/udf_core.c \
src/sbin/newfs_udf/udf_core.h
cvs rdiff -u -r1.31 -r0 src/sbin/newfs_udf/udf_create.c
cvs rdiff -u -r1.7 -r0 src/sbin/newfs_udf/udf_create.h
cvs rdiff -u -r1.11 -r0 src/sbin/newfs_udf/udf_write.c
cvs rdiff -u -r1.4 -r0 src/sbin/newfs_udf/udf_write.h
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/udf/Makefile.inc

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-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/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/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/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:55:32 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add note on optical media lockup fix for UDF


To generate a diff of this commit:
cvs rdiff -u -r1.2863 -r1.2864 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2863 src/doc/CHANGES:1.2864
--- src/doc/CHANGES:1.2863	Wed Mar  9 22:52:28 2022
+++ src/doc/CHANGES	Wed Mar  9 22:55:32 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2863 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2864 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -462,7 +462,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		Motor Driver [brad 20211207]
 	acpi(4): Updated ACPICA to 20211217. [christos 20211218]
 	udf: Fix corruption when writing to Microsoft Windows 10 formatted
-		recordables [reinoud 20211216]
+		recordables. [reinoud 20211216]
 	mcommphy(4): Add driver for Motorcomm YT8511 GbE PHY.
 		[jmcneill 20220103]
 	eqos(4): Add driver for DesignWare Ethernet Quality-of-Service
@@ -478,5 +478,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	expat: Import 2.4.6 (security fixes). [christos 20220223]
 	OpenSSH: Import 8.9. [christos 20220223]
 	udf: Be bugcompatible with Microsoft Windows 10 so it can read our
-		updated recordable media [reinoud 20220309]
+		updated recordable media. [reinoud 20220309]
+	udf: Fix locking up CD/DVD burner issue that would lockup the FS.
+		[reinoud 20220309]
 



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:55:32 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add note on optical media lockup fix for UDF


To generate a diff of this commit:
cvs rdiff -u -r1.2863 -r1.2864 src/doc/CHANGES

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



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:52:28 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add notes on various UDF fixes concerning Windows10 interoperationability with
recordable media.


To generate a diff of this commit:
cvs rdiff -u -r1.2862 -r1.2863 src/doc/CHANGES

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



CVS commit: src/doc

2022-03-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Mar  9 22:52:28 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
Add notes on various UDF fixes concerning Windows10 interoperationability with
recordable media.


To generate a diff of this commit:
cvs rdiff -u -r1.2862 -r1.2863 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2862 src/doc/CHANGES:1.2863
--- src/doc/CHANGES:1.2862	Wed Feb 23 19:08:48 2022
+++ src/doc/CHANGES	Wed Mar  9 22:52:28 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2862 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2863 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -461,6 +461,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	scmd: Driver and userland utility for the Sparkfun Serial Controlled
 		Motor Driver [brad 20211207]
 	acpi(4): Updated ACPICA to 20211217. [christos 20211218]
+	udf: Fix corruption when writing to Microsoft Windows 10 formatted
+		recordables [reinoud 20211216]
 	mcommphy(4): Add driver for Motorcomm YT8511 GbE PHY.
 		[jmcneill 20220103]
 	eqos(4): Add driver for DesignWare Ethernet Quality-of-Service
@@ -475,3 +477,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	blkdiscard(8): Add tool to access fdiscard(2). [mrg 20220207]
 	expat: Import 2.4.6 (security fixes). [christos 20220223]
 	OpenSSH: Import 8.9. [christos 20220223]
+	udf: Be bugcompatible with Microsoft Windows 10 so it can read our
+		updated recordable media [reinoud 20220309]
+



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-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 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-02-11 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Feb 11 16:33:18 UTC 2022

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

Log Message:
Translate 254/255 compID values used for deleted entries as per UDF spec. This
allows the printing of the names of deleted file entries.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/fs/udf/udf_osta.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_osta.c
diff -u src/sys/fs/udf/udf_osta.c:1.10 src/sys/fs/udf/udf_osta.c:1.11
--- src/sys/fs/udf/udf_osta.c:1.10	Mon Aug  5 17:02:54 2013
+++ src/sys/fs/udf/udf_osta.c	Fri Feb 11 16:33:18 2022
@@ -1,10 +1,10 @@
-/* $NetBSD: udf_osta.c,v 1.10 2013/08/05 17:02:54 joerg Exp $ */
+/* $NetBSD: udf_osta.c,v 1.11 2022/02/11 16:33:18 reinoud Exp $ */
 #if HAVE_NBTOOL_CONFIG_H
 #include "nbtool_config.h"
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udf_osta.c,v 1.10 2013/08/05 17:02:54 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_osta.c,v 1.11 2022/02/11 16:33:18 reinoud Exp $");
 
 /*
  * Various routines from the OSTA 2.01 specs.  Copyrights are included with
@@ -54,6 +54,12 @@ udf_UncompressUnicode(
 	/* Use UDFCompressed to store current byte being read. */
 	compID = UDFCompressed[0];
 
+	/* Translate 254/255 compID values used for deleted entries */
+	if (compID == 254)
+		compID = 8;
+	if (compID == 255)
+		compID = 16;
+
 	/* First check for valid compID. */
 	if (compID != 8 && compID != 16) {
 		returnValue = -1;



CVS commit: src/sys/fs/udf

2022-02-11 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Feb 11 16:33:18 UTC 2022

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

Log Message:
Translate 254/255 compID values used for deleted entries as per UDF spec. This
allows the printing of the names of deleted file entries.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/fs/udf/udf_osta.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 *) _map, 4,
 		ump->vat_offset + lb_num *4);
 	ump->vat_last_free_lb = lb_num;



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-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 *) _map, 4,
 		ump->vat_offset + lb_num *4);
 	ump->vat_last_free_lb = lb_num;



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

2021-12-16 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Dec 16 22:24:11 UTC 2021

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

Log Message:
Fix typo: reader -> header


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 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.161 src/sys/fs/udf/udf_subr.c:1.162
--- src/sys/fs/udf/udf_subr.c:1.161	Thu Dec 16 22:19:08 2021
+++ src/sys/fs/udf/udf_subr.c	Thu Dec 16 22:24:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.161 2021/12/16 22:19:08 reinoud Exp $ */
+/* $NetBSD: udf_subr.c,v 1.162 2021/12/16 22:24: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.161 2021/12/16 22:19:08 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.162 2021/12/16 22:24:10 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -614,7 +614,7 @@ udf_search_writing_tracks(struct udf_mou
 
 /*
  * Check if the blob starts with a good UDF tag. Tags are protected by a
- * checksum over the reader except one byte at position 4 that is the checksum
+ * checksum over the header except one byte at position 4 that is the checksum
  * itself.
  */
 



CVS commit: src/sys/fs/udf

2021-12-16 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Dec 16 22:24:11 UTC 2021

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

Log Message:
Fix typo: reader -> header


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



  1   2   >