Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makefs When creating disc images, keep the proposed...



details:   https://anonhg.NetBSD.org/src/rev/24cbc3281b97
branches:  trunk
changeset: 365981:24cbc3281b97
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sat May 07 08:54:02 2022 +0000

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

diffstat:

 usr.sbin/makefs/makefs.h |   4 ++--
 usr.sbin/makefs/udf.c    |  21 +++++++++++++++++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r 0f6a17ee6f9a -r 24cbc3281b97 usr.sbin/makefs/makefs.h
--- a/usr.sbin/makefs/makefs.h  Sat May 07 08:51:32 2022 +0000
+++ b/usr.sbin/makefs/makefs.h  Sat May 07 08:54:02 2022 +0000
@@ -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
diff -r 0f6a17ee6f9a -r 24cbc3281b97 usr.sbin/makefs/udf.c
--- a/usr.sbin/makefs/udf.c     Sat May 07 08:51:32 2022 +0000
+++ b/usr.sbin/makefs/udf.c     Sat May 07 08:54:02 2022 +0000
@@ -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 <sys/cdefs.h>
-__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 <stdio.h>
 #include <stdlib.h>
@@ -1130,7 +1130,24 @@
                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(&ti);
+               assert(!error);
+               blockingnr = udf_get_blockingnr(&ti);
+               nblk = UDF_ROUNDUP(nblk, blockingnr);
+       }
+
        proposed_size = (off_t) nblk * fsopts->sectorsize;
+
        /* sanity size */
        if (proposed_size < 512*1024)
                proposed_size = 512*1024;



Home | Main Index | Thread Index | Old Index