summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2013-05-29 14:23:56 +0200
committerKarel Zak2013-09-16 16:46:57 +0200
commit5105f75f6765cf8de2770caf9ae0d3b4851ebd0e (patch)
tree6474068073dedd2b3627062537e484b39cc9cd7c
parentfdisk: (sgi) use cpu_to_beXX() and beXX_to_cpu() (diff)
downloadkernel-qcow2-util-linux-5105f75f6765cf8de2770caf9ae0d3b4851ebd0e.tar.gz
kernel-qcow2-util-linux-5105f75f6765cf8de2770caf9ae0d3b4851ebd0e.tar.xz
kernel-qcow2-util-linux-5105f75f6765cf8de2770caf9ae0d3b4851ebd0e.zip
fdisk: (sgi) remove magic strings
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--fdisks/fdisksgilabel.c14
-rw-r--r--include/pt-sgi.h3
2 files changed, 8 insertions, 9 deletions
diff --git a/fdisks/fdisksgilabel.c b/fdisks/fdisksgilabel.c
index b07448d9a..8dab61522 100644
--- a/fdisks/fdisksgilabel.c
+++ b/fdisks/fdisksgilabel.c
@@ -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);
diff --git a/include/pt-sgi.h b/include/pt-sgi.h
index ec48b7e39..aef33859e 100644
--- a/include/pt-sgi.h
+++ b/include/pt-sgi.h
@@ -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 */