OSDN Git Service

maint: remove now-unused <partition_table_type>_clobber functions
authorJim Meyering <meyering@redhat.com>
Sat, 20 Feb 2010 11:44:47 +0000 (12:44 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 20 Feb 2010 11:44:47 +0000 (12:44 +0100)
All of these functions were rendered unused by commit 376b143045,
"ped_disk_clobber: change semantics" on 2009-11-13.
Also, Update each <...>_disk_ops "clobber:" member to be NULL.
* libparted/labels/aix.c (aix_clobber): Remove function.
* libparted/labels/bsd.c (bsd_clobber): Likewise.
* libparted/labels/dasd.c (dasd_clobber): Likewise.
* libparted/labels/dos.c (msdos_clobber): Likewise.
* libparted/labels/dvh.c (dvh_clobber): Likewise.
* libparted/labels/gpt.c (gpt_clobber): Likewise.
* libparted/labels/loop.c (loop_clobber): Likewise.
* libparted/labels/mac.c (_clobber_part_map, mac_clobber): Likewise.
* libparted/labels/pc98.c (pc98_clobber): Likewise.
* libparted/labels/rdb.c (amiga_clobber): Likewise.
* libparted/labels/sun.c (sun_clobber): Likewise.
Suggested by Hans De Goede.

libparted/labels/aix.c
libparted/labels/bsd.c
libparted/labels/dasd.c
libparted/labels/dos.c
libparted/labels/dvh.c
libparted/labels/gpt.c
libparted/labels/loop.c
libparted/labels/mac.c
libparted/labels/pc98.c
libparted/labels/rdb.c
libparted/labels/sun.c

index 6a39202..804e8c2 100644 (file)
@@ -64,26 +64,6 @@ aix_probe (const PedDevice *dev)
        return magic == AIX_LABEL_MAGIC;
 }
 
-#ifndef DISCOVER_ONLY
-static int
-aix_clobber (PedDevice* dev)
-{
-       PED_ASSERT (dev != NULL, return 0);
-
-       if (!aix_probe (dev))
-               return 0;
-
-       void *label;
-       if (!ptt_read_sector (dev, 0, &label))
-               return 0;
-
-       aix_label_magic_set (label, 0);
-       int result = ped_device_write (dev, label, 0, 1);
-       free (label);
-       return result;
-}
-#endif /* !DISCOVER_ONLY */
-
 static PedDisk*
 aix_alloc (const PedDevice* dev)
 {
@@ -239,7 +219,7 @@ aix_alloc_metadata (PedDisk* disk)
 PT_define_limit_functions (aix)
 
 static PedDiskOps aix_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (aix_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (aix_write),
 
        partition_set_name:             NULL,
index e1b57e5..0f9eb62 100644 (file)
@@ -254,20 +254,6 @@ bsd_free (PedDisk* disk)
        _ped_disk_free (disk);
 }
 
-#ifndef DISCOVER_ONLY
-static int
-bsd_clobber (PedDevice* dev)
-{
-       void *label;
-       if (!ptt_read_sector (dev, 0, &label))
-               return 0;
-       BSDRawLabel *rawlabel
-         = (BSDRawLabel *) ((char *) label + BSD_LABEL_OFFSET);
-       rawlabel->d_magic = 0;
-       return ped_device_write (dev, label, 0, 1);
-}
-#endif /* !DISCOVER_ONLY */
-
 static int
 bsd_read (PedDisk* disk)
 {
@@ -641,7 +627,7 @@ error:
 PT_define_limit_functions (bsd)
 
 static PedDiskOps bsd_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (bsd_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (bsd_write),
 
        partition_set_name:     NULL,
index 516d189..275a55a 100644 (file)
@@ -75,7 +75,6 @@ typedef struct {
 } DasdDiskSpecific;
 
 static int dasd_probe (const PedDevice *dev);
-static int dasd_clobber (PedDevice* dev);
 static int dasd_read (PedDisk* disk);
 static int dasd_write (const PedDisk* disk);
 
@@ -111,7 +110,7 @@ static int dasd_alloc_metadata (PedDisk* disk);
 PT_define_limit_functions (dasd)
 
 static PedDiskOps dasd_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (dasd_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (dasd_write),
 
        partition_set_name:     NULL,
@@ -243,27 +242,6 @@ dasd_probe (const PedDevice *dev)
 }
 
 static int
-dasd_clobber (PedDevice* dev)
-{
-       LinuxSpecific* arch_specific;
-       struct fdasd_anchor anchor;
-
-       PED_ASSERT(dev != NULL, return 0);
-
-       arch_specific = LINUX_SPECIFIC(dev);
-
-       fdasd_initialize_anchor(&anchor);
-       fdasd_get_geometry(dev, &anchor, arch_specific->fd);
-
-       fdasd_recreate_vtoc(&anchor);
-       fdasd_write_labels(&anchor, arch_specific->fd);
-
-       fdasd_cleanup(&anchor);
-
-       return 1;
-}
-
-static int
 dasd_read (PedDisk* disk)
 {
        int i;
index 339acf4..dce35b2 100644 (file)
@@ -306,25 +306,6 @@ msdos_disk_is_flag_available (const PedDisk *disk, PedDiskFlag flag)
         }
 }
 
-#ifndef DISCOVER_ONLY
-static int
-msdos_clobber (PedDevice* dev)
-{
-       PED_ASSERT (dev != NULL, return 0);
-       PED_ASSERT (msdos_probe (dev), return 0);
-
-       void *label;
-       if (!ptt_read_sector (dev, 0, &label))
-               return 0;
-
-       DosRawTable *table = label;
-       table->magic = 0;
-        int write_ok = ped_device_write (dev, (void*) table, 0, 1);
-        free (label);
-       return write_ok;
-}
-#endif /* !DISCOVER_ONLY */
-
 static int
 chs_get_cylinder (const RawCHS* chs)
 {
@@ -2338,7 +2319,7 @@ msdos_get_max_supported_partition_count(const PedDisk* disk, int *max_n)
 PT_define_limit_functions (msdos)
 
 static PedDiskOps msdos_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (msdos_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (msdos_write),
 
        disk_set_flag:          msdos_disk_set_flag,
index 55654d9..c96741a 100644 (file)
@@ -95,14 +95,6 @@ dvh_probe (const PedDevice *dev)
        return found;
 }
 
-#ifndef DISCOVER_ONLY
-static int
-dvh_clobber (PedDevice* dev)
-{
-       return ptt_clear_sectors (dev, 0, 1);
-}
-#endif /* !DISCOVER_ONLY */
-
 static PedDisk*
 dvh_alloc (const PedDevice* dev)
 {
@@ -892,7 +884,7 @@ error:
 PT_define_limit_functions (dvh)
 
 static PedDiskOps dvh_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (dvh_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (dvh_write),
 
        partition_set_name:     dvh_partition_set_name,
index 40ee0c1..4793315 100644 (file)
@@ -494,20 +494,6 @@ gpt_probe (const PedDevice *dev)
   return ok;
 }
 
-#ifndef DISCOVER_ONLY
-/* writes zeros to the PMBR and the primary GPTH, and to the final sector */
-static int
-gpt_clobber (PedDevice *dev)
-{
-  PED_ASSERT (dev != NULL, return 0);
-
-  return (ptt_clear_sectors (dev, GPT_PMBR_LBA, GPT_PMBR_SECTORS)
-          && ptt_clear_sectors (dev, GPT_PRIMARY_HEADER_LBA, GPT_HEADER_SECTORS)
-          && ptt_clear_sectors (dev, dev->length - GPT_HEADER_SECTORS,
-                                GPT_HEADER_SECTORS));
-}
-#endif /* !DISCOVER_ONLY */
-
 static PedDisk *
 gpt_alloc (const PedDevice *dev)
 {
@@ -1736,7 +1722,7 @@ PT_define_limit_functions (gpt)
 
 static PedDiskOps gpt_disk_ops =
 {
-  clobber:                     NULL_IF_DISCOVER_ONLY (gpt_clobber),
+  clobber:                     NULL,
   write:                       NULL_IF_DISCOVER_ONLY (gpt_write),
 
   partition_set_name:          gpt_partition_set_name,
index d225cdf..17cdf4e 100644 (file)
@@ -73,15 +73,6 @@ error:
        return 0;
 }
 
-#ifndef DISCOVER_ONLY
-static int
-loop_clobber (PedDevice* dev)
-{
-       PED_ASSERT (dev != NULL, return 0);
-        return ptt_clear_sectors (dev, 0, 1);
-}
-#endif /* !DISCOVER_ONLY */
-
 static PedDisk*
 loop_alloc (const PedDevice* dev)
 {
@@ -297,7 +288,7 @@ loop_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 PT_define_limit_functions (loop)
 
 static PedDiskOps loop_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (loop_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (loop_write),
 
        partition_set_name:     NULL,
index 19de261..49a236e 100644 (file)
@@ -353,57 +353,6 @@ mac_free (PedDisk* disk)
        free (mac_disk_data);
 }
 
-#ifndef DISCOVER_ONLY
-static int
-_clobber_part_map (PedDevice* dev)
-{
-        void *buf = ped_malloc (dev->sector_size);
-        if (!buf)
-                return 0;
-
-        int ok = 1;
-       PedSector sector;
-       for (sector=1; 1; sector++) {
-                if (!ped_device_read (dev, buf, sector, 1)) {
-                        ok = 0;
-                        break;
-                }
-               if (!_rawpart_check_signature (buf)) {
-                        ok = 1;
-                        break;
-                }
-               memset (buf, 0, dev->sector_size);
-               if (!ped_device_write (dev, buf, sector, 1)) {
-                        ok = 0;
-                        break;
-                }
-       }
-        free (buf);
-        return ok;
-}
-
-static int
-mac_clobber (PedDevice* dev)
-{
-       void *buf;
-       if (!ptt_read_sector (dev, 0, &buf))
-               return 0;
-
-       if (!_check_signature (buf)) {
-                free (buf);
-               return 0;
-        }
-
-        memset (buf, 0, dev->sector_size);
-        int ok = ped_device_write (dev, buf, 0, 1);
-        free (buf);
-        if (!ok)
-               return 0;
-
-       return _clobber_part_map (dev);
-}
-#endif /* !DISCOVER_ONLY */
-
 static int
 _rawpart_cmp_type (const MacRawPartition* raw_part, const char* type)
 {
@@ -1634,7 +1583,7 @@ mac_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 PT_define_limit_functions (mac)
 
 static PedDiskOps mac_disk_ops = {
-       clobber: NULL_IF_DISCOVER_ONLY (mac_clobber),
+       clobber: NULL,
         /* FIXME: remove this cast, once mac_write is fixed not to
            modify its *DISK parameter.  */
        write:  NULL_IF_DISCOVER_ONLY ((int (*) (const PedDisk*)) mac_write),
index 2f9e5cd..4b34480 100644 (file)
@@ -218,30 +218,6 @@ pc98_probe (const PedDevice *dev)
        return 1;
 }
 
-#ifndef DISCOVER_ONLY
-static int
-pc98_clobber (PedDevice* dev)
-{
-       PC98RawTable    table;
-
-       PED_ASSERT (dev != NULL, return 0);
-       PED_ASSERT (pc98_probe (dev), return 0);
-
-       if (!ped_device_read (dev, &table, 0, 1))
-               return 0;
-
-       memset (table.partitions, 0, sizeof (table.partitions));
-       table.magic = PED_CPU_TO_LE16(0);
-
-       if (pc98_check_ipl_signature (&table))
-               memset (table.boot_code, 0, sizeof (table.boot_code));
-
-       if (!ped_device_write (dev, (void*) &table, 0, 1))
-               return 0;
-       return ped_device_sync (dev);
-}
-#endif /* !DISCOVER_ONLY */
-
 static PedDisk*
 pc98_alloc (const PedDevice* dev)
 {
@@ -857,7 +833,7 @@ pc98_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 PT_define_limit_functions (pc98)
 
 static PedDiskOps pc98_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (pc98_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (pc98_write),
 
        partition_set_name:     pc98_partition_set_name,
index 71b3458..43bb7a7 100644 (file)
@@ -449,29 +449,6 @@ amiga_free (PedDisk* disk)
        _ped_disk_free (disk);
 }
 
-#ifndef DISCOVER_ONLY
-static int
-amiga_clobber (PedDevice* dev)
-{
-       struct RigidDiskBlock *rdb;
-       uint32_t i;
-       int result = 0;
-       PED_ASSERT(dev != NULL, return 0);
-
-       if ((rdb=RDSK(ped_malloc(dev->sector_size)))==NULL)
-               return 0;
-
-       while ((i = _amiga_find_rdb (dev, rdb)) != AMIGA_RDB_NOT_FOUND) {
-               rdb->rdb_ID = PED_CPU_TO_BE32 (0);
-               result = ped_device_write (dev, (void*) rdb, i, 1);
-       }
-
-       free (rdb);
-
-       return result;
-}
-#endif /* !DISCOVER_ONLY */
-
 static int
 _amiga_loop_check (uint32_t block, uint32_t * blocklist, uint32_t max)
 {
@@ -1150,7 +1127,7 @@ amiga_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
 PT_define_limit_functions (amiga)
 
 static PedDiskOps amiga_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (amiga_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (amiga_write),
 
        partition_set_name:     amiga_partition_set_name,
index 0528e2c..9aeddcf 100644 (file)
@@ -157,25 +157,6 @@ sun_probe (const PedDevice *dev)
        return ok;
 }
 
-#ifndef DISCOVER_ONLY
-static int
-sun_clobber (PedDevice* dev)
-{
-       PED_ASSERT (dev != NULL, return 0);
-       PED_ASSERT (sun_probe (dev), return 0);
-
-       void *s0;
-       if (!ptt_read_sector (dev, 0, &s0))
-               return 0;
-
-       SunRawLabel *table = s0;
-       table->magic = 0;
-       int write_ok = ped_device_write (dev, (void*) table, 0, 1);
-       free (s0);
-       return write_ok;
-}
-#endif /* !DISCOVER_ONLY */
-
 static PedDisk*
 sun_alloc (const PedDevice* dev)
 {
@@ -921,7 +902,7 @@ error:
 PT_define_limit_functions (sun)
 
 static PedDiskOps sun_disk_ops = {
-       clobber:                NULL_IF_DISCOVER_ONLY (sun_clobber),
+       clobber:                NULL,
        write:                  NULL_IF_DISCOVER_ONLY (sun_write),
 
        disk_set_flag:          sun_disk_set_flag,