Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2023 22:27:48 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f0bef3d20eb6 - main - makefs: #define Apple Partition bits
Message-ID:  <202303302227.32UMRmVG052454@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0bef3d20eb6e28cf66a42c6d34fdfe80a784365

commit f0bef3d20eb6e28cf66a42c6d34fdfe80a784365
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-03-30 16:45:18 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-03-30 22:27:30 +0000

    makefs: #define Apple Partition bits
    
    NetBSD defines these in sys/bootblock.h, which we don't have.  Add local
    defintions in cd9660_eltorito.c (as OpenBSD did) to reduce diffs between
    the three makefs implementations.
    
    Obtained from:  OpenBSD
    Sponsored by:   The FreeBSD Foundation
---
 usr.sbin/makefs/cd9660/cd9660_eltorito.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
index 0a57c91a659e..6d7a32378b64 100644
--- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c
+++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
@@ -41,6 +41,14 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+/*
+ * Partition Status Information from Apple Tech Note 1189
+ */
+#define	APPLE_PS_VALID		0x00000001	/* Entry is valid */
+#define	APPLE_PS_ALLOCATED	0x00000002	/* Entry is allocated */
+#define	APPLE_PS_READABLE	0x00000010	/* Entry is readable */
+#define	APPLE_PS_WRITABLE	0x00000020	/* Entry is writable */
+
 #ifdef DEBUG
 #define	ELTORITO_DPRINTF(__x)	printf __x
 #else
@@ -574,15 +582,8 @@ cd9660_write_apm_partition_entry(FILE *fd, int idx, int total_partitions,
 	uint32_t apm32, part_status;
 	uint16_t apm16;
 
-	/* See Apple Tech Note 1189 for the details about the pmPartStatus
-	 * flags.
-	 * Below the flags which are default:
-	 * - IsValid     0x01
-	 * - IsAllocated 0x02
-	 * - IsReadable  0x10
-	 * - IsWritable  0x20
-	 */
-	part_status = 0x01 | 0x02 | 0x10 | 0x20;
+	part_status = APPLE_PS_VALID | APPLE_PS_ALLOCATED | APPLE_PS_READABLE |
+	    APPLE_PS_WRITABLE;
 
 	if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1)
 		err(1, "fseeko");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303302227.32UMRmVG052454>