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 <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 *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(&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;