diff options
| author | reinoud <reinoud@NetBSD.org> | 2022-05-07 08:54:02 +0000 |
|---|---|---|
| committer | reinoud <reinoud@NetBSD.org> | 2022-05-07 08:54:02 +0000 |
| commit | b6e1237757df22ba8cddf126629de03fda8b3496 (patch) | |
| tree | 9715c2b8a495597afd153d4c92ae93d964d76a15 | |
| parent | de9f4dfe6256ecbd3945f1c7bfa3f7ab47b32665 (diff) | |
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.
| -rw-r--r-- | usr.sbin/makefs/makefs.h | 4 | ||||
| -rw-r--r-- | usr.sbin/makefs/udf.c | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h index 74399acdaee..7084764c538 100644 --- a/usr.sbin/makefs/makefs.h +++ b/usr.sbin/makefs/makefs.h @@ -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 --git a/usr.sbin/makefs/udf.c b/usr.sbin/makefs/udf.c index f6b3ad70e71..2d4aa1bd15d 100644 --- a/usr.sbin/makefs/udf.c +++ b/usr.sbin/makefs/udf.c @@ -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 @@ udf_enumerate_and_estimate(const char *dir, fsnode *root, fsinfo_t *fsopts, 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; |
