diff options
author | Davidlohr Bueso | 2012-07-24 09:54:52 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-24 09:54:52 +0200 |
commit | 2ca61a61e13cc61bc8782f8dde0f8fece6a4eca6 (patch) | |
tree | 9a24bf5a06a3ba848ebad9ab6239ddc8d780e91b /fdisks/fdisksgilabel.c | |
parent | fdisk: API: add new partition to label operations (diff) | |
download | kernel-qcow2-util-linux-2ca61a61e13cc61bc8782f8dde0f8fece6a4eca6.tar.gz kernel-qcow2-util-linux-2ca61a61e13cc61bc8782f8dde0f8fece6a4eca6.tar.xz kernel-qcow2-util-linux-2ca61a61e13cc61bc8782f8dde0f8fece6a4eca6.zip |
fdisk: API: add verify to label operations
[kzak@redhat.com: - rename some functions]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisksgilabel.c')
-rw-r--r-- | fdisks/fdisksgilabel.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/fdisks/fdisksgilabel.c b/fdisks/fdisksgilabel.c index 62fae99df..65f6dde64 100644 --- a/fdisks/fdisksgilabel.c +++ b/fdisks/fdisksgilabel.c @@ -391,17 +391,6 @@ compare_start(struct fdisk_context *cxt, const void *x, const void *y) { return (a > b) ? 1 : -1; } -static int -sgi_gaps(struct fdisk_context *cxt) { - /* - * returned value is: - * = 0 : disk is properly filled to the rim - * < 0 : there is an overlap - * > 0 : there is still some vacant space - */ - return verify_sgi(cxt, 0); -} - static void generic_swap(void *a, void *b, int size) { char t; @@ -450,13 +439,11 @@ static void sort(void *base, size_t num, size_t size, struct fdisk_context *cxt, } } - -int -verify_sgi(struct fdisk_context *cxt, int verbose) +static int sgi_verify_disklabel(struct fdisk_context *cxt) { int Index[16]; /* list of valid partitions */ int sortcount = 0; /* number of used partitions, i.e. non-zero lengths */ - int entire = 0, i = 0; + int entire = 0, i = 0, verbose = 1; unsigned int start = 0; long long gap = 0; /* count unused blocks */ unsigned int lastblock = sgi_get_lastblock(cxt); @@ -575,6 +562,17 @@ verify_sgi(struct fdisk_context *cxt, int verbose) return (gap > 0) ? 1 : (gap == 0) ? 0 : -1; } +static int +sgi_gaps(struct fdisk_context *cxt) { + /* + * returned value is: + * = 0 : disk is properly filled to the rim + * < 0 : there is an overlap + * > 0 : there is still some vacant space + */ + return sgi_verify_disklabel(cxt); +} + int sgi_change_sysid(struct fdisk_context *cxt, int i, int sys) { @@ -902,6 +900,7 @@ const struct fdisk_label sgi_label = .name = "sgi", .probe = sgi_probe_label, .write = sgi_write_disklabel, + .verify = sgi_verify_disklabel, .part_add = sgi_add_partition, .part_delete = sgi_delete_partition, }; |