]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: remove Mac code
authorKarel Zak <kzak@redhat.com>
Tue, 11 Jun 2013 08:17:57 +0000 (10:17 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:46:59 +0000 (16:46 +0200)
The code has been used only to detect magic strings, nothing else.

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/Makemodule.am
fdisks/fdisk.c
fdisks/fdiskmaclabel.c [deleted file]
fdisks/fdiskmaclabel.h [deleted file]
libfdisk/src/ask.c
libfdisk/src/context.c
libfdisk/src/fdiskP.h
libfdisk/src/libfdisk.h
libfdisk/src/utils.c

index 99cf93fbfa45bc71e9ce129873fadcdbebdddb3a..3c07461583f1bf9844124ceb76559688c7edd6be 100644 (file)
@@ -13,8 +13,6 @@ fdisk_SOURCES = \
        fdisks/fdiskbsdlabel.h \
        fdisks/fdiskdoslabel.c \
        fdisks/fdiskdoslabel.h \
-       fdisks/fdiskmaclabel.c \
-       fdisks/fdiskmaclabel.h \
        fdisks/fdisk-menu.c \
        fdisks/partname.c \
        fdisks/common.h
index 7a40f7a037f1180df060a10d98dd18bffe435037..cf6db69f3f531fc115980c40a60f9fde1edd51ab 100644 (file)
@@ -36,7 +36,6 @@
 #include "closestream.h"
 
 #include "pt-sun.h"            /* to toggle flags */
-#include "fdiskmaclabel.h"
 #include "fdiskdoslabel.h"
 #include "fdiskbsdlabel.h"
 
diff --git a/fdisks/fdiskmaclabel.c b/fdisks/fdiskmaclabel.c
deleted file mode 100644 (file)
index a91cabc..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-  Changes:
-  Sat Mar 20 09:51:38 EST 1999 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
-       Internationalization
-*/
-#include <stdio.h>              /* stderr */
-#include <string.h>             /* strstr */
-#include <unistd.h>             /* write */
-
-#include <endian.h>
-
-#include "common.h"
-#include "fdisk.h"
-#include "fdiskmaclabel.h"
-#include "nls.h"
-
-#define MAC_BITMASK 0xffff0000
-
-/*
- * in-memory fdisk mac stuff
- */
-struct fdisk_mac_label {
-       struct fdisk_label      head;           /* generic part */
-};
-
-
-static int     other_endian = 0;
-static  short  volumes=1;
-
-/*
- * only dealing with free blocks here
- */
-
-static void
-mac_info( void ) {
-    puts(
-       _("\n\tThere is a valid Mac label on this disk.\n"
-       "\tUnfortunately fdisk(1) cannot handle these disks.\n"
-       "\tUse either pdisk or parted to modify the partition table.\n"
-       "\tNevertheless some advice:\n"
-       "\t1. fdisk will destroy its contents on write.\n"
-       "\t2. Be sure that this disk is NOT a still vital\n"
-       "\t   part of a volume group. (Otherwise you may\n"
-       "\t   erase the other disks as well, if unmirrored.)\n")
-    );
-}
-
-void
-mac_nolabel(struct fdisk_context *cxt)
-{
-    struct mac_partition *maclabel = (struct mac_partition *) cxt->firstsector;
-
-    maclabel->magic = 0;
-    fdisk_zeroize_firstsector(cxt);
-    return;
-}
-
-static int
-mac_probe_label(struct fdisk_context *cxt)
-{
-       struct mac_partition *maclabel = (struct mac_partition *) cxt->firstsector;
-
-       /*
-       Conversion: only 16 bit should compared
-       e.g.: HFS Label is only 16bit long
-       */
-       int magic_masked = 0 ;
-       magic_masked =  maclabel->magic & MAC_BITMASK ;
-
-       switch (magic_masked) {
-               case MAC_LABEL_MAGIC :
-               case MAC_LABEL_MAGIC_2:
-               case MAC_LABEL_MAGIC_3:
-                       goto IS_MAC;
-                       break;
-               default:
-                       other_endian = 0;
-                       return 0;
-
-
-       }
-
-IS_MAC:
-    other_endian = (maclabel->magic == MAC_LABEL_MAGIC_SWAPPED); // =?
-    volumes = 15;      // =?
-    mac_info();
-    mac_nolabel(cxt);          /* %% */
-    return 1;
-}
-
-static int mac_add_partition(
-               struct fdisk_context *cxt __attribute__ ((__unused__)),
-               size_t partnum __attribute__ ((__unused__)),
-               struct fdisk_parttype *t __attribute__ ((__unused__)))
-{
-       printf(_("\tSorry - this fdisk cannot handle Mac disk labels."
-                "\n\tIf you want to add DOS-type partitions, create"
-                "\n\ta new empty DOS partition table first. (Use o.)"
-                "\n\tWARNING: "
-                "This will destroy the present disk contents.\n"));
-
-       return -ENOSYS;
-}
-
-static const struct fdisk_label_operations mac_operations =
-{
-       .probe          = mac_probe_label,
-       .part_add       = mac_add_partition
-};
-
-
-/*
- * allocates MAC label driver
- */
-struct fdisk_label *fdisk_new_mac_label(struct fdisk_context *cxt)
-{
-       struct fdisk_label *lb;
-       struct fdisk_mac_label *mac;
-
-       assert(cxt);
-
-       mac = calloc(1, sizeof(*mac));
-       if (!mac)
-               return NULL;
-
-       /* initialize generic part of the driver */
-       lb = (struct fdisk_label *) mac;
-       lb->name = "mac";
-       lb->id = FDISK_DISKLABEL_MAC;
-       lb->op = &mac_operations;
-
-       return lb;
-}
diff --git a/fdisks/fdiskmaclabel.h b/fdisks/fdiskmaclabel.h
deleted file mode 100644 (file)
index 4e6fef1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef FDISK_MAC_LABEL_H
-#define FDISK_MAC_LABEL_H
-
-#include <sys/types.h>
-/*
- * Copyright (C) Andreas Neuper, Sep 1998.
- *     This file may be redistributed under
- *     the terms of the GNU Public License.
- */
-
-struct mac_partition {
-       unsigned int  magic;        /* expect MAC_LABEL_MAGIC */
-       unsigned int  fillbytes1[124];
-       unsigned int  physical_volume_id;
-       unsigned int  fillbytes2[124];
-};
-
-/* MAC magic number only 16bits, do I always know that there are 0200
- * following? Problem, after magic the uint16_t res1; follows, I donnno know
- * about the 200k */
-#define        MAC_LABEL_MAGIC         0x45520000
-#define        MAC_LABEL_MAGIC_2       0x50530000
-#define        MAC_LABEL_MAGIC_3       0x504d0000
-
-#define        MAC_LABEL_MAGIC_SWAPPED         0x00002554
-
-#define        MAC_LABEL_MAGIC_2_SWAPPED       0x00003505
-#define        MAC_LABEL_MAGIC_3_SWAPPED       0x0000d405
-
-/* fdiskmaclabel.c */
-extern void    mac_nolabel(struct fdisk_context *cxt);
-
-#endif /* FDISK_MAC_LABEL_H */
index 4cd9b534630f7684dfb19dba600e2e1075367b73..c0d52e88825c7862843a9d164205436a91f741ed 100644 (file)
@@ -596,8 +596,6 @@ int fdisk_info_new_partition(
 #ifdef TEST_PROGRAM
 struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt) { return NULL; }
 struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_mac_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_sgi_label(struct fdisk_context *cxt) { return NULL; }
 
 int test_ranges(struct fdisk_test *ts, int argc, char *argv[])
 {
index f2b0f7871093a9473af3d3c491e2fa11749f0613..4c8bfdc1cde5382fe338240f9890b90d586ff82e 100644 (file)
@@ -21,7 +21,6 @@ struct fdisk_context *fdisk_new_context(void)
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_gpt_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_dos_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_bsd_label(cxt);
-       cxt->labels[ cxt->nlabels++ ] = fdisk_new_mac_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_sgi_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_sun_label(cxt);
 
index 9434f3213e6ca5b44d8441a5e1e685d17022047b..adaa7c0e748d6cdb9a7e6e2e8d5b7e3b552913f3 100644 (file)
@@ -209,7 +209,6 @@ enum {
 extern struct fdisk_label *fdisk_new_gpt_label(struct fdisk_context *cxt);
 extern struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt);
 extern struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt);
-extern struct fdisk_label *fdisk_new_mac_label(struct fdisk_context *cxt);
 extern struct fdisk_label *fdisk_new_sgi_label(struct fdisk_context *cxt);
 extern struct fdisk_label *fdisk_new_sun_label(struct fdisk_context *cxt);
 
index b5bd245e492181e33d4c9bce84335bb955de5db3..cfcc62b812a09f2c9d3eeea9d00100e35ee98104 100644 (file)
@@ -42,7 +42,6 @@ enum fdisk_labeltype {
        FDISK_DISKLABEL_SUN = 2,
        FDISK_DISKLABEL_SGI = 4,
        FDISK_DISKLABEL_OSF = 8,
-       FDISK_DISKLABEL_MAC = 16,
        FDISK_DISKLABEL_GPT = 32,
        FDISK_DISKLABEL_ANY = -1
 };
index 9a95ba24c94050690f6cfba33032f150592dc222..20b8cf7bb23ee97cf94c2649f567901d2495ea84 100644 (file)
@@ -88,9 +88,6 @@ char *fdisk_partname(const char *dev, size_t partno)
 #ifdef TEST_PROGRAM
 struct fdisk_label *fdisk_new_dos_label(struct fdisk_context *cxt) { return NULL; }
 struct fdisk_label *fdisk_new_bsd_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_mac_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_sgi_label(struct fdisk_context *cxt) { return NULL; }
-struct fdisk_label *fdisk_new_sun_label(struct fdisk_context *cxt) { return NULL; }
 
 int test_partnames(struct fdisk_test *ts, int argc, char *argv[])
 {