diff options
author | Karel Zak | 2014-08-13 23:57:54 +0200 |
---|---|---|
committer | Karel Zak | 2014-08-13 23:57:54 +0200 |
commit | aa36c2cf2cb331c06c1ac5950b3b70ccbf7b0111 (patch) | |
tree | 1f89cf65567e0b6037984c27c35f64788b796514 /libfdisk | |
parent | libfdisk: clean up API (alignment.c) (diff) | |
download | kernel-qcow2-util-linux-aa36c2cf2cb331c06c1ac5950b3b70ccbf7b0111.tar.gz kernel-qcow2-util-linux-aa36c2cf2cb331c06c1ac5950b3b70ccbf7b0111.tar.xz kernel-qcow2-util-linux-aa36c2cf2cb331c06c1ac5950b3b70ccbf7b0111.zip |
libfdisk: cleanup fdisk_is_label stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/bsd.c | 10 | ||||
-rw-r--r-- | libfdisk/src/context.c | 29 | ||||
-rw-r--r-- | libfdisk/src/dos.c | 40 | ||||
-rw-r--r-- | libfdisk/src/gpt.c | 36 | ||||
-rw-r--r-- | libfdisk/src/label.c | 25 | ||||
-rw-r--r-- | libfdisk/src/libfdisk.h | 11 | ||||
-rw-r--r-- | libfdisk/src/sgi.c | 20 | ||||
-rw-r--r-- | libfdisk/src/sun.c | 26 |
8 files changed, 107 insertions, 90 deletions
diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c index 8df5707fd..55996cc25 100644 --- a/libfdisk/src/bsd.c +++ b/libfdisk/src/bsd.c @@ -91,7 +91,7 @@ static inline struct fdisk_bsd_label *self_label(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, BSD)); + assert(fdisk_is_label(cxt, BSD)); return (struct fdisk_bsd_label *) cxt->label; } @@ -100,7 +100,7 @@ static inline struct bsd_disklabel *self_disklabel(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, BSD)); + assert(fdisk_is_label(cxt, BSD)); return &((struct fdisk_bsd_label *) cxt->label)->bsd; } @@ -363,7 +363,7 @@ static int bsd_list_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, BSD)); + assert(fdisk_is_label(cxt, BSD)); if (fdisk_is_details(cxt)) { fdisk_info(cxt, "# %s:", cxt->dev_path); @@ -409,7 +409,7 @@ static int bsd_get_partition(struct fdisk_context *cxt, size_t n, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, BSD)); + assert(fdisk_is_label(cxt, BSD)); if (n >= d->d_npartitions) return -EINVAL; @@ -795,7 +795,7 @@ int fdisk_bsd_link_partition(struct fdisk_context *cxt) struct dos_partition *p; struct bsd_disklabel *d = self_disklabel(cxt); - if (!cxt->parent || !fdisk_is_disklabel(cxt->parent, DOS)) { + if (!cxt->parent || !fdisk_is_label(cxt->parent, DOS)) { fdisk_warnx(cxt, _("BSD label is not nested within a DOS partition.")); return -EINVAL; } diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index fec49c7db..03f358639 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -209,6 +209,28 @@ int fdisk_switch_label(struct fdisk_context *cxt, const char *name) return __fdisk_switch_label(cxt, fdisk_get_label(cxt, name)); } +/** + * fdisk_has_label: + * @cxt: fdisk context + * + * Returns: return 1 if there is label on the device. + */ +int fdisk_has_label(struct fdisk_context *cxt) +{ + return cxt && cxt->label; +} + +/** + * fdisk_is_labeltype: + * @cxt: fdisk context + * @l: disklabel type + * + * Returns: return 1 if there is @l disklabel on the device. + */ +int fdisk_is_labeltype(struct fdisk_context *cxt, enum fdisk_labeltype l) +{ + return cxt && cxt->label && cxt->label->id == l; +} static void reset_context(struct fdisk_context *cxt) { @@ -254,7 +276,7 @@ static int warn_wipe(struct fdisk_context *cxt) assert(cxt); - if (fdisk_dev_has_disklabel(cxt) || cxt->dev_fd < 0) + if (fdisk_has_label(cxt) || cxt->dev_fd < 0) return -EINVAL; #ifdef HAVE_LIBBLKID DBG(CXT, ul_debugobj(cxt, "wipe check: initialize libblkid prober")); @@ -337,7 +359,7 @@ int fdisk_assign_device(struct fdisk_context *cxt, /* warn about obsolete stuff on the device if we aren't in * list-only mode and there is not PT yet */ - if (!fdisk_is_listonly(cxt) && !fdisk_dev_has_disklabel(cxt)) + if (!fdisk_is_listonly(cxt) && !fdisk_has_label(cxt)) warn_wipe(cxt); DBG(CXT, ul_debugobj(cxt, "initialized for %s [%s]", @@ -666,3 +688,6 @@ const char *fdisk_get_devname(struct fdisk_context *cxt) assert(cxt); return cxt->dev_path; } + + + diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index d1fd28f60..2533f0c9b 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -79,7 +79,7 @@ static struct fdisk_parttype dos_parttypes[] = { #define alignment_required(_x) ((_x)->grain != (_x)->sector_size) #define is_dos_compatible(_x) \ - (fdisk_is_disklabel(_x, DOS) && \ + (fdisk_is_label(_x, DOS) && \ fdisk_dos_is_compatible(fdisk_get_label(_x, NULL))) #define cround(c, n) fdisk_cround(c, n) @@ -89,7 +89,7 @@ static inline struct fdisk_dos_label *self_label(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); return (struct fdisk_dos_label *) cxt->label; } @@ -118,7 +118,7 @@ struct dos_partition *fdisk_dos_get_partition( { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); return self_partition(cxt, i); } @@ -283,7 +283,7 @@ static void dos_init(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); DBG(LABEL, ul_debug("DOS: initialize, first sector buffer %p", cxt->firstsector)); @@ -373,7 +373,7 @@ static int dos_delete_partition(struct fdisk_context *cxt, size_t partnum) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); pe = self_pte(cxt, partnum); if (!pe) @@ -573,7 +573,7 @@ static int dos_get_disklabel_id(struct fdisk_context *cxt, char **id) assert(cxt); assert(id); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); num = mbr_get_id(cxt->firstsector); if (asprintf(id, "0x%08x", num) > 0) @@ -589,7 +589,7 @@ static int dos_create_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); DBG(LABEL, ul_debug("DOS: creating new disklabel")); @@ -623,7 +623,7 @@ static int dos_set_disklabel_id(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); DBG(LABEL, ul_debug("DOS: setting Id")); @@ -688,7 +688,7 @@ static int dos_reset_alignment(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); /* overwrite necessary stuff by DOS deprecated stuff */ if (is_dos_compatible(cxt)) { @@ -713,7 +713,7 @@ static int dos_probe_label(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); /* ignore disks with AIX magic number */ if (memcmp(cxt->firstsector, AIX_MAGIC_STRING, AIX_MAGIC_STRLEN) == 0) @@ -940,7 +940,7 @@ static int add_partition(struct fdisk_context *cxt, size_t n, } fill_bounds(cxt, first, last); if (n < 4) { - if (cxt->parent && fdisk_is_disklabel(cxt->parent, GPT)) + if (cxt->parent && fdisk_is_label(cxt->parent, GPT)) start = 1; /* Bad boy modifies hybrid MBR */ else start = cxt->first_lba; @@ -1265,7 +1265,7 @@ static int dos_verify_disklabel(struct fdisk_context *cxt) struct dos_partition *p; struct fdisk_dos_label *l = self_label(cxt); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); fill_bounds(cxt, first, last); for (i = 0; i < cxt->label->nparts_max; i++) { @@ -1353,7 +1353,7 @@ static int dos_add_partition(struct fdisk_context *cxt, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); l = self_label(cxt); ext_pe = l->ext_offset ? self_pte(cxt, l->ext_index) : NULL; @@ -1495,7 +1495,7 @@ static int dos_write_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); mbr_changed = l->non_pt_changed; @@ -1585,7 +1585,7 @@ static int dos_set_parttype( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); if (partnum >= cxt->label->nparts_max || !t || t->type > UINT8_MAX) return -EINVAL; @@ -1653,7 +1653,7 @@ static int dos_list_disklabel(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); return 0; } @@ -1668,7 +1668,7 @@ static int dos_get_partition(struct fdisk_context *cxt, size_t n, assert(cxt); assert(pa); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); lb = self_label(cxt); pe = self_pte(cxt, n); @@ -1870,7 +1870,7 @@ int fdisk_dos_move_begin(struct fdisk_context *cxt, size_t i) int rc; assert(cxt); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); pe = self_pte(cxt, i); p = pe->pt_entry; @@ -1933,7 +1933,7 @@ static int dos_partition_is_used( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); if (i >= cxt->label->nparts_max) return 0; @@ -1952,7 +1952,7 @@ static int dos_toggle_partition_flag( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, DOS)); + assert(fdisk_is_label(cxt, DOS)); if (i >= cxt->label->nparts_max) return -EINVAL; diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 27331ca4e..c1aa1e774 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -1168,7 +1168,7 @@ static int gpt_probe_label(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); @@ -1338,7 +1338,7 @@ static int gpt_get_partition(struct fdisk_context *cxt, size_t n, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); @@ -1385,7 +1385,7 @@ static int gpt_list_disklabel(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); if (fdisk_is_details(cxt)) { struct gpt_header *h = self_label(cxt)->pheader; @@ -1499,7 +1499,7 @@ static int gpt_write_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); mbr_type = valid_pmbr(cxt); @@ -1570,7 +1570,7 @@ static int gpt_verify_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); @@ -1687,7 +1687,7 @@ static int gpt_delete_partition(struct fdisk_context *cxt, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); @@ -1730,7 +1730,7 @@ static int gpt_create_new_partition(struct fdisk_context *cxt, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); DBG(LABEL, ul_debug("GPT new partition: partno=%zu, start=%ju, end=%ju", partnum, fsect, lsect)); @@ -1783,7 +1783,7 @@ static int gpt_add_partition( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); pheader = gpt->pheader; @@ -1940,7 +1940,7 @@ static int gpt_create_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); @@ -2007,7 +2007,7 @@ static int gpt_get_disklabel_id(struct fdisk_context *cxt, char **id) assert(cxt); assert(id); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); guid_to_string(&gpt->pheader->disk_guid, str); @@ -2027,7 +2027,7 @@ static int gpt_set_disklabel_id(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); if (fdisk_ask_string(cxt, @@ -2071,7 +2071,7 @@ static int gpt_set_partition_type( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); if ((uint32_t) i >= le32_to_cpu(gpt->pheader->npartition_entries) @@ -2093,7 +2093,7 @@ static int gpt_part_is_used(struct fdisk_context *cxt, size_t i) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); @@ -2114,7 +2114,7 @@ int fdisk_gpt_partition_set_uuid(struct fdisk_context *cxt, size_t i) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); DBG(LABEL, ul_debug("UUID change requested partno=%zu", i)); @@ -2160,7 +2160,7 @@ int fdisk_gpt_partition_set_name(struct fdisk_context *cxt, size_t i) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); DBG(LABEL, ul_debug("NAME change requested partno=%zu", i)); @@ -2218,7 +2218,7 @@ static int gpt_toggle_partition_flag( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); DBG(LABEL, ul_debug("GPT entry attribute change requested partno=%zu", i)); gpt = self_label(cxt); @@ -2304,7 +2304,7 @@ static int gpt_reorder(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); nparts = le32_to_cpu(gpt->pheader->npartition_entries); @@ -2327,7 +2327,7 @@ static int gpt_reset_alignment(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, GPT)); + assert(fdisk_is_label(cxt, GPT)); gpt = self_label(cxt); h = gpt ? gpt->pheader : NULL; diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c index 65a5cde25..36e4688d9 100644 --- a/libfdisk/src/label.c +++ b/libfdisk/src/label.c @@ -1,6 +1,7 @@ #include "fdiskP.h" + /* * Don't use this function derectly */ @@ -12,7 +13,7 @@ int fdisk_probe_labels(struct fdisk_context *cxt) for (i = 0; i < cxt->nlabels; i++) { struct fdisk_label *lb = cxt->labels[i]; - struct fdisk_label *org = cxt->label; + struct fdisk_label *org = fdisk_get_label(cxt, NULL); int rc; if (!lb->op->probe) @@ -41,29 +42,17 @@ int fdisk_probe_labels(struct fdisk_context *cxt) return 1; /* not found */ } - /** - * fdisk_dev_has_disklabel: - * @cxt: fdisk context + * fdisk_label_get_name: + * @lb: label * - * Returns: return 1 if there is label on the device. + * Returns: label name */ -int fdisk_dev_has_disklabel(struct fdisk_context *cxt) +const char *fdisk_label_get_name(struct fdisk_label *lb) { - return cxt && cxt->label; + return lb ? lb->name : NULL; } -/** - * fdisk_dev_is_disklabel: - * @cxt: fdisk context - * @l: disklabel type - * - * Returns: return 1 if there is @l disklabel on the device. - */ -int fdisk_dev_is_disklabel(struct fdisk_context *cxt, enum fdisk_labeltype l) -{ - return cxt && cxt->label && cxt->label->id == l; -} /** * fdisk_write_disklabel: diff --git a/libfdisk/src/libfdisk.h b/libfdisk/src/libfdisk.h index e244e372c..8caf60ef7 100644 --- a/libfdisk/src/libfdisk.h +++ b/libfdisk/src/libfdisk.h @@ -85,6 +85,11 @@ int fdisk_next_label(struct fdisk_context *cxt, struct fdisk_label **lb); size_t fdisk_get_nlabels(struct fdisk_context *cxt); int fdisk_switch_label(struct fdisk_context *cxt, const char *name); +int fdisk_has_label(struct fdisk_context *cxt); +int fdisk_is_labeltype(struct fdisk_context *cxt, enum fdisk_labeltype l); +#define fdisk_is_label(c, x) fdisk_is_labeltype(c, FDISK_DISKLABEL_ ## x) + + int fdisk_assign_device(struct fdisk_context *cxt, const char *fname, int readonly); int fdisk_deassign_device(struct fdisk_context *cxt, int nosync); @@ -154,13 +159,11 @@ enum { FDISK_FIELD_UUID, }; +const char *fdisk_label_get_name(struct fdisk_label *lb); + extern int fdisk_require_geometry(struct fdisk_context *cxt); extern int fdisk_missing_geometry(struct fdisk_context *cxt); -extern int fdisk_dev_has_disklabel(struct fdisk_context *cxt); - -extern int fdisk_dev_is_disklabel(struct fdisk_context *cxt, enum fdisk_labeltype l); -#define fdisk_is_disklabel(c, x) fdisk_dev_is_disklabel(c, FDISK_DISKLABEL_ ## x) extern int fdisk_write_disklabel(struct fdisk_context *cxt); extern int fdisk_verify_disklabel(struct fdisk_context *cxt); diff --git a/libfdisk/src/sgi.c b/libfdisk/src/sgi.c index 83d25c558..fef9234cb 100644 --- a/libfdisk/src/sgi.c +++ b/libfdisk/src/sgi.c @@ -68,7 +68,7 @@ static inline struct sgi_disklabel *self_disklabel(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); return ((struct fdisk_sgi_label *) cxt->label)->header; } @@ -78,7 +78,7 @@ static inline struct fdisk_sgi_label *self_label(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); return (struct fdisk_sgi_label *) cxt->label; } @@ -222,7 +222,7 @@ static int sgi_probe_label(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); assert(sizeof(struct sgi_disklabel) <= 512); /* map first sector to header */ @@ -417,7 +417,7 @@ static int sgi_write_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); sgilabel = self_disklabel(cxt); sgilabel->csum = 0; @@ -533,7 +533,7 @@ static int verify_disklabel(struct fdisk_context *cxt, int verbose) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); clear_freelist(cxt); memset(Index, 0, sizeof(Index)); @@ -695,7 +695,7 @@ static int sgi_set_partition(struct fdisk_context *cxt, size_t i, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); sgilabel = self_disklabel(cxt); sgilabel->partitions[i].type = cpu_to_be32(sys); @@ -770,7 +770,7 @@ static int sgi_add_partition(struct fdisk_context *cxt, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); rc = fdisk_partition_next_partno(pa, cxt, &n); if (rc) @@ -911,7 +911,7 @@ static int sgi_create_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); #ifdef HDIO_GETGEO if (cxt->geom.heads && cxt->geom.sectors) { @@ -1041,7 +1041,7 @@ static int sgi_partition_is_used( size_t i) { assert(cxt); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); if (i >= cxt->label->nparts_max) return 0; @@ -1053,7 +1053,7 @@ static int sgi_toggle_partition_flag(struct fdisk_context *cxt, size_t i, unsign struct sgi_disklabel *sgilabel; assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SGI)); + assert(fdisk_is_label(cxt, SGI)); if (i >= cxt->label->nparts_max) return -EINVAL; diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c index 60c4cec6d..7ea399378 100644 --- a/libfdisk/src/sun.c +++ b/libfdisk/src/sun.c @@ -53,7 +53,7 @@ static inline struct sun_disklabel *self_disklabel(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); return ((struct fdisk_sun_label *) cxt->label)->header; } @@ -63,7 +63,7 @@ static inline struct fdisk_sun_label *self_label(struct fdisk_context *cxt) { assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); return (struct fdisk_sun_label *) cxt->label; } @@ -108,7 +108,7 @@ static int sun_probe_label(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); /* map first sector to header */ sun = (struct fdisk_sun_label *) cxt->label; @@ -197,7 +197,7 @@ static int sun_create_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); /* map first sector to header */ rc = fdisk_init_firstsector_buffer(cxt); @@ -294,7 +294,7 @@ static int sun_toggle_partition_flag(struct fdisk_context *cxt, size_t i, unsign assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); if (i >= cxt->label->nparts_max) return -EINVAL; @@ -331,7 +331,7 @@ static void fetch_sun(struct fdisk_context *cxt, assert(cxt); assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); sunlabel = self_disklabel(cxt); @@ -390,7 +390,7 @@ static int sun_verify_disklabel(struct fdisk_context *cxt) #endif assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); fetch_sun(cxt, starts, lens, &start, &stop); @@ -693,7 +693,7 @@ static int sun_delete_partition(struct fdisk_context *cxt, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); sunlabel = self_disklabel(cxt); part = &sunlabel->partitions[partnum]; @@ -722,7 +722,7 @@ static int sun_list_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); sunlabel = self_disklabel(cxt); @@ -768,7 +768,7 @@ static int sun_get_partition(struct fdisk_context *cxt, size_t n, assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); if (n >= cxt->label->nparts_max) return -EINVAL; @@ -889,7 +889,7 @@ static int sun_write_disklabel(struct fdisk_context *cxt) assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); sunlabel = self_disklabel(cxt); @@ -925,7 +925,7 @@ static int sun_set_parttype( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); sunlabel = self_disklabel(cxt); @@ -983,7 +983,7 @@ static int sun_partition_is_used( assert(cxt); assert(cxt->label); - assert(fdisk_is_disklabel(cxt, SUN)); + assert(fdisk_is_label(cxt, SUN)); if (i >= cxt->label->nparts_max) return 0; |