OSDN Git Service

partitions: Add X68000 partitions.
authorYoshinori Sato <ysato@users.sourceforge.jp>
Mon, 7 Mar 2016 12:35:41 +0000 (21:35 +0900)
committerYoshinori Sato <yo-satoh@sios.com>
Thu, 23 Jan 2020 03:39:36 +0000 (12:39 +0900)
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
block/partitions/Kconfig
block/partitions/Makefile
block/partitions/check.c
block/partitions/x68k.c [new file with mode: 0644]
block/partitions/x68k.h [new file with mode: 0644]

index 702689a..46691d9 100644 (file)
@@ -262,6 +262,12 @@ config SYSV68_PARTITION
          sysv68).
          Otherwise, say N.
 
+config X68K_PARTITION
+       bool "X68000 partition support" if PARTITION_ADVANCED
+       default y if X68000
+       help
+         Support hard disks partitioned under X68000.
+
 config CMDLINE_PARTITION
        bool "Command line partition support" if PARTITION_ADVANCED
        select BLK_CMDLINE_PARSER
index 2f276b6..5232ab9 100644 (file)
@@ -21,3 +21,4 @@ obj-$(CONFIG_IBM_PARTITION) += ibm.o
 obj-$(CONFIG_EFI_PARTITION) += efi.o
 obj-$(CONFIG_KARMA_PARTITION) += karma.o
 obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o
+obj-$(CONFIG_X68K_PARTITION) += x68k.o
index ffe408f..9df0cb6 100644 (file)
@@ -35,6 +35,7 @@
 #include "efi.h"
 #include "karma.h"
 #include "sysv68.h"
+#include "x68k.h"
 #include "cmdline.h"
 
 int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/
@@ -109,6 +110,9 @@ static int (*check_part[])(struct parsed_partitions *) = {
 #ifdef CONFIG_SYSV68_PARTITION
        sysv68_partition,
 #endif
+#ifdef CONFIG_X68K_PARTITION
+       x68k_partition,
+#endif
        NULL
 };
 
diff --git a/block/partitions/x68k.c b/block/partitions/x68k.c
new file mode 100644 (file)
index 0000000..1a814bc
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ *  fs/partitions/x68k.c
+ */
+
+#include <linux/ctype.h>
+#include "check.h"
+#include "x68k.h"
+
+int x68k_partition(struct parsed_partitions *state)
+{
+       Sector sect;
+       struct x68k_rootsector *rs;
+       struct x68k_partition_info *pi;
+       int slot;
+
+       rs = read_part_sector(state, 4, &sect);
+       if (!rs)
+               return -1;
+
+       if (memcmp(rs->head.sig, "X68K", 4)) {
+               put_dev_sector(sect);
+               return 0;
+       }
+
+       pi = &rs->partition[0];
+       for (slot = 1; slot < 16; slot++, pi++) {
+               if (pi->start >= 0x01000000 || !pi->start)
+                       continue;
+               put_partition(state, slot,
+                             be32_to_cpu(pi->start) * 2,
+                             be32_to_cpu(pi->length) * 2);
+       }
+       strlcat(state->pp_buf, "\n", PAGE_SIZE);
+
+       return 1;
+}
diff --git a/block/partitions/x68k.h b/block/partitions/x68k.h
new file mode 100644 (file)
index 0000000..6b8db8d
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ *  fs/partitions/x68k.h
+ */
+
+#include <linux/compiler.h>
+
+struct x68k_drive_info
+{
+       char sig[4];
+       __be32 max;
+       __be32 alt;
+       __be32 shipping;
+};
+
+struct x68k_partition_info
+{
+       char system[8];
+       __be32 start;
+       __be32 length;
+};
+
+struct x68k_rootsector
+{
+       struct x68k_drive_info head;
+       struct x68k_partition_info partition[15];
+} __packed;
+
+int x68k_partition(struct parsed_partitions *state);