Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/udf For bug-compatibility with Windows, the last VAT ...



details:   https://anonhg.NetBSD.org/src/rev/b7803b72bb25
branches:  trunk
changeset: 363384:b7803b72bb25
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Tue Mar 08 18:30:43 2022 +0000

description:
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.

diffstat:

 sys/fs/udf/udf_subr.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (51 lines):

diff -r ad3462a66648 -r b7803b72bb25 sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Tue Mar 08 10:52:43 2022 +0000
+++ b/sys/fs/udf/udf_subr.c     Tue Mar 08 18:30:43 2022 +0000
@@ -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 <sys/cdefs.h>
 #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 @@
 {
        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 @@
                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
                /*



Home | Main Index | Thread Index | Old Index