Skip to contentSkip to conversation

multipath-tools/kpartx - mac partition support

PATCH In review Bastian Blank 2 participants 2 messages Feb 9, 2006 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath-tools/kpartx - mac partition support

This patch adds mac partition table support to kpartx.

You can also pull this changes from
http://137.250.31.225/rsync/git/linux/storage/multipath-tools.git.

Bastian

[kpartx] Add support for mac partition table

---
commit c2fbbb7907b589374f186ad57a9b3beba8578632
tree e6d05387a2c8c98f478d229678d454ce8e756161
parent 2f6c4c8ae93d599bf1c2630c97cc675e92fbea90
author Bastian Blank <[email protected]> Thu, 09 Feb 2006 17:22:18 +0000 committer Bastian Blank <[email protected]> Thu, 09 Feb 2006 17:22:18 +0000

 kpartx/Makefile    |    4 ++--
 kpartx/byteorder.h |    6 ++++++
 kpartx/kpartx.c    |    1 +
 kpartx/kpartx.h    |    1 +
 kpartx/mac.c       |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 kpartx/mac.h       |   30 ++++++++++++++++++++++++++++++
 6 files changed, 87 insertions(+), 2 deletions(-)
kpartx/Makefile +2 -2
index 1b68ca6..bf6e6c1 100644
@@ -10,12 +10,12 @@ CFLAGS += -I. -D_LARGEFILE64_SOURCE
 
 ifeq ($(strip $(BUILD)),klibc)
 	OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o gpt.o crc32.o \
-	       lopart.o xstrncpy.o devmapper.o dasd.o \
+	       lopart.o xstrncpy.o devmapper.o dasd.o mac.o \
 	       $(MULTIPATHLIB)-$(BUILD).a $(libdm)
 else
 	LDFLAGS = -ldevmapper
 	OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o \
-	       gpt.o crc32.o lopart.o xstrncpy.o devmapper.o
+	       gpt.o mac.o crc32.o lopart.o xstrncpy.o devmapper.o
 endif
 
 EXEC = kpartx
kpartx/byteorder.h +6 -0
index 6d2588b..21962d6 100644
@@ -9,9 +9,15 @@
 #endif
 
 #if BYTE_ORDER == LITTLE_ENDIAN
+#  define le16_to_cpu(x) (x)
+#  define be16_to_cpu(x) bswap_16(x)
 #  define le32_to_cpu(x) (x)
+#  define be32_to_cpu(x) bswap_32(x)
 #elif BYTE_ORDER == BIG_ENDIAN
+#  define le16_to_cpu(x) bswap_16(x)
+#  define be16_to_cpu(x) (x)
 #  define le32_to_cpu(x) bswap_32(x)
+#  define be32_to_cpu(x) (x)
 #else
 #  error unsupported
 #endif
kpartx/kpartx.c +1 -0
index c1c2fae..2198302 100644
@@ -78,6 +78,7 @@ initpts(void)
 	addpts("solaris", read_solaris_pt);
 	addpts("unixware", read_unixware_pt);
 	addpts("dasd", read_dasd_pt);
+	addpts("mac", read_mac_pt);
 }
 
 static char short_opts[] = "ladgvnp:t:";
kpartx/kpartx.h +1 -0
index 9819268..6a715de 100644
@@ -32,6 +32,7 @@ extern ptreader read_solaris_pt;
 extern ptreader read_unixware_pt;
 extern ptreader read_gpt_pt;
 extern ptreader read_dasd_pt;
+extern ptreader read_mac_pt;
 
 char *getblock(int fd, unsigned int secnr);
 
kpartx/mac.c new file +47 -0

47 lines not on this page · raw message

kpartx/mac.h new file +30 -0
new file mode 100644
index 0000000..3c712ba
@@ -0,0 +1,30 @@
+#ifndef MAC_H
+#define MAC_H
+
+#include <stdint.h>
+
+#define MAC_PARTITION_MAGIC     0x504d
+
+/* type field value for A/UX or other Unix partitions */
+#define APPLE_AUX_TYPE  "Apple_UNIX_SVR2"
+
+struct mac_partition {
+        uint16_t  signature;      /* expected to be MAC_PARTITION_MAGIC */
+        uint16_t  res1;
+        uint32_t  map_count;      /* # blocks in partition map */
+        uint32_t  start_block;    /* absolute starting block # of partition */
+        uint32_t  block_count;    /* number of blocks in partition */
+        /* there is more stuff after this that we don't need */
+};
+
+#define MAC_DRIVER_MAGIC        0x4552
+
+/* Driver descriptor structure, in block 0 */
+struct mac_driver_desc {
+        uint16_t  signature;      /* expected to be MAC_DRIVER_MAGIC */
+        uint16_t  block_size;
+        uint32_t  block_count;
+    /* ... more stuff */
+};
+
+#endif
Signature · 1 line
Captain's Log, star date 21:34.5...