Module Name:    src
Committed By:   tsutsui
Date:           Fri May 31 20:23:34 UTC 2024

Modified Files:
        src/external/gpl2/mkhybrid/dist: apple.c apple.h mkisofs.c mkisofs.h

Log Message:
Pull changes from mkisofs-1.12.1 to avoid statvfs(2).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/gpl2/mkhybrid/dist/apple.c \
    src/external/gpl2/mkhybrid/dist/apple.h \
    src/external/gpl2/mkhybrid/dist/mkisofs.c \
    src/external/gpl2/mkhybrid/dist/mkisofs.h

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

Modified files:

Index: src/external/gpl2/mkhybrid/dist/apple.c
diff -u src/external/gpl2/mkhybrid/dist/apple.c:1.1 src/external/gpl2/mkhybrid/dist/apple.c:1.2
--- src/external/gpl2/mkhybrid/dist/apple.c:1.1	Fri May 31 19:49:02 2024
+++ src/external/gpl2/mkhybrid/dist/apple.c	Fri May 31 20:23:33 2024
@@ -872,11 +872,6 @@ struct hfs_info *
 get_hfs_fe_info(struct hfs_info *hfs_info, char *name)
 {
 	FILE	*fp;
-#ifdef __svr4__
-	struct statvfs fsbuf;
-#else
-	struct statfs fsbuf;
-#endif /* __svr4__ */
 	int	fe_num, fe_pad;
 	fe_info info;
 	int	c = 0;
@@ -889,30 +884,15 @@ get_hfs_fe_info(struct hfs_info *hfs_inf
 	if ((fp = fopen(name, "rb")) == NULL)
 	    return(NULL);
 
-	/* The FAT cluster size may have been given on the command line
-	   - if not they try and find *guess* it */
-	if (!bsize) {
-	    /* FINDER.DAT layout depends on the FAT cluster size - assume
-	       this is mapped to the "fundamental file system block size"
-	       For SVR4 we use statvfs(), others use statfs() */
-#ifdef __svr4__
-	    if (statvfs(name, &fsbuf) < 0)
-		return(NULL);
-
-	    bsize = fsbuf.f_frsize;
-#else
-	    if (statfs(name, &fsbuf) < 0)
-		return(NULL);
-
-	    bsize = fsbuf.f_bsize;
-#endif /* __svr4__ */
-	}
-
-	if (bsize <= 0)
+	/*
+	 * no longer attempt to find out FAT cluster
+	 * - rely on command line parameter
+	 */
+	if (afe_size <= 0)
 	    return(NULL);
 
-	fe_num = bsize/FE_SIZE;
-	fe_pad = bsize%FE_SIZE;
+	fe_num = afe_size / FE_SIZE;
+	fe_pad = afe_size % FE_SIZE;
 
 	while(fread(&info, 1, FE_SIZE, fp) != 0) {
 
Index: src/external/gpl2/mkhybrid/dist/apple.h
diff -u src/external/gpl2/mkhybrid/dist/apple.h:1.1 src/external/gpl2/mkhybrid/dist/apple.h:1.2
--- src/external/gpl2/mkhybrid/dist/apple.h:1.1	Fri May 31 19:49:02 2024
+++ src/external/gpl2/mkhybrid/dist/apple.h	Fri May 31 20:23:33 2024
@@ -10,20 +10,6 @@
 #define __svr4__	/* maybe there's a "configure" solution ? */
 #endif /* __sgi */
 
-#ifdef __svr4__
-#include <sys/statvfs.h>
-#else
-#if defined(__FreeBSD__) || defined(__bsdi__) || defined(__OpenBSD__)
-#include <sys/mount.h>
-#else
-#if defined(_IBMR2)
-#include <sys/statfs.h>
-#else
-#include <sys/vfs.h>
-#endif /* _IBMR2 */
-#endif /* __FreeBSD__ || __bsdi__ */
-#endif /* __svr4__ */
-
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif /* O_BINARY */
Index: src/external/gpl2/mkhybrid/dist/mkisofs.c
diff -u src/external/gpl2/mkhybrid/dist/mkisofs.c:1.1 src/external/gpl2/mkhybrid/dist/mkisofs.c:1.2
--- src/external/gpl2/mkhybrid/dist/mkisofs.c:1.1	Fri May 31 19:49:02 2024
+++ src/external/gpl2/mkhybrid/dist/mkisofs.c	Fri May 31 20:23:33 2024
@@ -138,7 +138,7 @@ int	probe = 0;		/* search files for HFS/
 int	nomacfiles = 0;		/* don't look for Mac/Unix files */
 int	hfs_select = 0;		/* Mac/Unix types to select */
 int	create_dt = 1;		/* create the Desktp files */
-int	bsize = 0;		/* Apple File Exchange block size */
+int	afe_size = 0;		/* Apple File Exchange block size */
 int	hfs_last = MAG_LAST;	/* process magic file after map file */
 char	*deftype = DEFTYPE;	/* default Apple TYPE */
 char	*defcreator = DEFCREATOR; /* default Apple CREATOR */
@@ -1068,7 +1068,9 @@ int FDECL2(main, int, argc, char **, arg
 	/* gen_pt = 1; */
 	break;
       case OPTION_BSIZE:
-	bsize = atoi(optarg);
+	afe_size = atoi(optarg);
+	hfs_select |= DO_FEU;
+	hfs_select |= DO_FEL;
 	break;
       case OPTION_HFS_VOLID:
 	hfs_volume_id = optarg;
@@ -1164,7 +1166,7 @@ parse_input_files:
   /* if -probe, -macname, any hfs selection and/or mapping file is given,
      but no HFS option, then select apple_hyb */
   if (!apple_hyb && !apple_ext) {
-    if (*afpfile || probe || mac_name || nomacfiles || hfs_select || hfs_boot_file || magic_file || hfs_ishidden() || gen_pt || autoname || bsize)
+    if (*afpfile || probe || mac_name || nomacfiles || hfs_select || hfs_boot_file || magic_file || hfs_ishidden() || gen_pt || autoname || afe_size)
 	apple_hyb = 1;
   }
 
@@ -1181,6 +1183,12 @@ parse_input_files:
   if (apple_hyb || apple_ext)
     apple_both = 1;
 
+  if (apple_both && verbose && !afe_size &&
+      (hfs_select & (DO_FEU | DO_FEL))) {
+    fprintf(stderr,
+    "Warning: assuming PC Exchange cluster size of 512 bytes\n");
+    afe_size = 512;
+  }
   if (apple_both) {
     /* set up the TYPE/CREATOR mappings */
     hfs_init(afpfile, 0, probe, nomacfiles, hfs_select);
Index: src/external/gpl2/mkhybrid/dist/mkisofs.h
diff -u src/external/gpl2/mkhybrid/dist/mkisofs.h:1.1 src/external/gpl2/mkhybrid/dist/mkisofs.h:1.2
--- src/external/gpl2/mkhybrid/dist/mkisofs.h:1.1	Fri May 31 19:49:02 2024
+++ src/external/gpl2/mkhybrid/dist/mkisofs.h	Fri May 31 20:23:33 2024
@@ -316,7 +316,7 @@ extern char *defcreator;	/* default Appl
 extern char *trans_tbl;		/* translation table name */
 extern int gen_pt;		/* generate HFS partition table */
 extern char *autoname;		/* Autostart filename */
-extern int bsize;		/* Apple File Exchange block size */
+extern int afe_size;		/* Apple File Exchange block size */
 extern char *hfs_volume_id;	/* HFS volume ID */
 #define ASSOC_FLAG	4       /* ISO flag for "associated" file */
 #define MAP_LAST	1	/* process magic then map file */

Reply via email to