]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (sgi) remove magic strings
authorKarel Zak <kzak@redhat.com>
Wed, 29 May 2013 12:23:56 +0000 (14:23 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:46:57 +0000 (16:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisksgilabel.c
include/pt-sgi.h

index b07448d9a2b277ca31dac8013eb546463fbf668c..8dab615227202181a9bfabf08024ee780011242a 100644 (file)
@@ -43,8 +43,6 @@ struct fdisk_sgi_label {
        struct fdisk_label      head;           /* generic part */
 };
 
-static  short volumes=1;
-
 static sgiinfo *fill_sgiinfo(void);
 
 /*
@@ -155,7 +153,6 @@ sgi_probe_label(struct fdisk_context *cxt)
 
        cxt->label->nparts_max = SGI_MAXPARTITIONS;
        cxt->label->nparts_cur = count_used_partitions(cxt);
-       volumes = 15;
        return 1;
 }
 
@@ -216,7 +213,7 @@ sgi_list_table(struct fdisk_context *cxt, int xtra) {
        printf(_("----- Bootinfo -----\nBootfile: %s\n"
                 "----- Directory Entries -----\n"),
               sgilabel->boot_file);
-       for (i = 0 ; i < (size_t) volumes; i++) {
+       for (i = 0 ; i < SGI_MAXVOLUMES; i++) {
                if (sgilabel->volume[i].num_bytes) {
                        uint32_t start = be32_to_cpu(sgilabel->volume[i].block_num);
                        uint32_t len = be32_to_cpu(sgilabel->volume[i].num_bytes);
@@ -860,10 +857,11 @@ static int sgi_create_disklabel(struct fdisk_context *cxt)
        sgilabel->devparam.xylogics_readgate    = cpu_to_be16(0);
        sgilabel->devparam.xylogics_writecont   = cpu_to_be16(0);
 
-       memset(&(sgilabel->volume), 0, sizeof(struct sgi_volume) * 15);
-       memset(&(sgilabel->partitions), 0, sizeof(struct sgi_partition)*16);
-       cxt->label->nparts_max = 16;
-       volumes    = 15;
+       memset(&(sgilabel->volume), 0,
+                       sizeof(struct sgi_volume) * SGI_MAXVOLUMES);
+       memset(&(sgilabel->partitions), 0,
+                       sizeof(struct sgi_partition) * SGI_MAXPARTITIONS);
+       cxt->label->nparts_max = SGI_MAXPARTITIONS;
        sgi_set_entire(cxt);
        sgi_set_volhdr(cxt);
 
index ec48b7e39b429d949887bea61d8f725f029e4534..aef33859ee1484db7d5654cf22f79f473fad0c28 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdint.h>
 
 #define SGI_MAXPARTITIONS      16
+#define SGI_MAXVOLUMES         15
 
 /* partition types */
 enum {
@@ -64,7 +65,7 @@ struct sgi_disklabel {
                unsigned char name[8];  /* name of volume */
                uint32_t block_num;     /* logical block number */
                uint32_t num_bytes;     /* how big, in bytes */
-       } __attribute__((packed)) volume[15];
+       } __attribute__((packed)) volume[SGI_MAXVOLUMES];
 
        struct sgi_partition {
                uint32_t num_blocks;    /* size in logical blocks */