]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: add label->changed flag
authorKarel Zak <kzak@redhat.com>
Fri, 18 Jan 2013 15:11:08 +0000 (16:11 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 11:47:30 +0000 (12:47 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/fdiskP.h
libfdisk/src/label.c
libfdisk/src/libfdisk.h

index 39e76da309cae401135208de6f32b4dfacdb0d2e..8f9905d81d347fcf9932d479839b40cba98c0e08 100644 (file)
@@ -167,6 +167,8 @@ struct fdisk_label {
        size_t                  nparts_max;     /* maximal number of partitions */
        size_t                  nparts_cur;     /* number of currently used partitions */
 
+       unsigned int            changed:1;      /* label has been modified */
+
        const struct fdisk_label_operations *op;
 };
 
index 02298498da30182b683ee92a66edee8adff4c4e1..cd2b38cc782b55bfe7c4e1e2249d2e9d2df0d98e 100644 (file)
@@ -238,3 +238,16 @@ void fdisk_deinit_label(struct fdisk_label *lb)
        if (lb->op->deinit)
                lb->op->deinit(lb);
 }
+
+void fdisk_label_set_changed(struct fdisk_label *lb, int changed)
+{
+       assert(lb);
+
+       lb->changed = changed ? 1 : 0;
+}
+
+int fdisk_label_is_changed(struct fdisk_label *lb)
+{
+       assert(lb);
+       return lb ? lb->changed : 0;
+}
index 7fcd3d74e3e8a9a34252b72c255e274eb46c0852..379fb4d47a6f3eae52907ca1baa9f53c2a5c890f 100644 (file)
@@ -87,6 +87,10 @@ extern struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt
 extern int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
                             struct fdisk_parttype *t);
 
+extern void fdisk_label_set_changed(struct fdisk_label *lb, int changed);
+extern int fdisk_label_is_changed(struct fdisk_label *lb);
+
+
 /* alignment.c */
 extern int fdisk_reset_alignment(struct fdisk_context *cxt);