summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/label.c
diff options
context:
space:
mode:
authorKarel Zak2013-10-09 16:02:33 +0200
committerKarel Zak2013-10-09 16:02:33 +0200
commit7a188aedbf4468e9753200716ec845a00dd8b30e (patch)
treecbdf161b040688bc81cd1d6b1369d311a25569c6 /libfdisk/src/label.c
parentcytune: fix glush typo in cytune (diff)
downloadkernel-qcow2-util-linux-7a188aedbf4468e9753200716ec845a00dd8b30e.tar.gz
kernel-qcow2-util-linux-7a188aedbf4468e9753200716ec845a00dd8b30e.tar.xz
kernel-qcow2-util-linux-7a188aedbf4468e9753200716ec845a00dd8b30e.zip
libfdisk: add API to disable specified label
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r--libfdisk/src/label.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c
index aba2790cc..7f9c7d0e3 100644
--- a/libfdisk/src/label.c
+++ b/libfdisk/src/label.c
@@ -17,7 +17,10 @@ int fdisk_probe_labels(struct fdisk_context *cxt)
if (!lb->op->probe)
continue;
-
+ if (lb->disabled) {
+ DBG(LABEL, dbgprint("%s disabled -- ignore", lb->name));
+ continue;
+ }
DBG(LABEL, dbgprint("probing for %s", lb->name));
cxt->label = lb;
@@ -230,7 +233,7 @@ int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name)
}
lb = fdisk_context_get_label(cxt, name);
- if (!lb)
+ if (!lb || lb->disabled)
return -EINVAL;
if (!lb->op->create)
return -ENOSYS;
@@ -436,3 +439,19 @@ int fdisk_label_is_changed(struct fdisk_label *lb)
assert(lb);
return lb ? lb->changed : 0;
}
+
+void fdisk_label_set_disabled(struct fdisk_label *lb, int disabled)
+{
+ assert(lb);
+
+ DBG(LABEL, dbgprint("%s label %s",
+ lb->name,
+ disabled ? "DISABLED" : "ENABLED"));
+ lb->disabled = disabled ? 1 : 0;
+}
+
+int fdisk_label_is_disabled(struct fdisk_label *lb)
+{
+ assert(lb);
+ return lb ? lb->disabled : 0;
+}