]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: cleanup the rest of fdisks/utils.c stuff
authorKarel Zak <kzak@redhat.com>
Thu, 6 Dec 2012 14:22:43 +0000 (15:22 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 11:47:28 +0000 (12:47 +0100)
 - remove obsolete code
 - move fdisk_{set,get}_partition_type() to label.c (this is label
   driver operation)

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.h
libfdisk/src/label.c
libfdisk/src/libfdisk.h
libfdisk/src/parttype.c

index ec20837df203f7be551e4d7adaede4c09690daf8..4196d7bda5f0493100680ac0ce85f504515aa4ad 100644 (file)
@@ -60,13 +60,6 @@ enum failure {
        unable_to_write
 };
 
-/*
- * labels
- */
-extern struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum);
-extern int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
-                            struct fdisk_parttype *t);
-
 /* prototypes for fdisk.c */
 extern char *line_ptr;
 extern int partitions;
index fa7218c0f8587f1026a6c434721a3c2248bf3273..5d0eb3ef8a60f68142f5b9e1e259b1aabc8af07c 100644 (file)
@@ -194,3 +194,51 @@ int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name)
 
        return cxt->label->create(cxt);
 }
+
+/**
+ * fdisk_get_partition_type:
+ * @cxt: fdisk context
+ * @partnum: partition number
+ *
+ * Returns partition type or NULL upon failure.
+ */
+struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum)
+{
+       if (!cxt || !cxt->label || !cxt->label->part_get_type)
+               return NULL;
+
+       DBG(LABEL, dbgprint("partition: %d: get type", partnum));
+       return cxt->label->part_get_type(cxt, partnum);
+}
+
+/**
+ * fdisk_set_partition_type:
+ * @cxt: fdisk context
+ * @partnum: partition number
+ * @t: new type
+ *
+ * Returns 0 on success, < 0 on error.
+ */
+int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
+                            struct fdisk_parttype *t)
+{
+       if (!cxt || !cxt->label || !cxt->label->part_set_type)
+               return -EINVAL;
+
+       DBG(LABEL, dbgprint("partition: %d: set type", partnum));
+       return cxt->label->part_set_type(cxt, partnum, t);
+}
+
+/**
+ * fdisk_get_nparttypes:
+ * @cxt: fdisk context
+ *
+ * Returns: number of partition types supported by the current label
+ */
+size_t fdisk_get_nparttypes(struct fdisk_context *cxt)
+{
+       if (!cxt || !cxt->label)
+               return 0;
+
+       return cxt->label->nparttypes;
+}
index 276f79b83e25833b54c503d0471d31c34ed0ecf5..d719a5c8d3917bf7576acf88528f94212f45785f 100644 (file)
@@ -69,10 +69,15 @@ extern int fdisk_dev_is_disklabel(struct fdisk_context *cxt, enum fdisk_labeltyp
 
 extern int fdisk_write_disklabel(struct fdisk_context *cxt);
 extern int fdisk_verify_disklabel(struct fdisk_context *cxt);
+extern int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name);
 
 extern int fdisk_add_partition(struct fdisk_context *cxt, int partnum, struct fdisk_parttype *t);
 extern int fdisk_delete_partition(struct fdisk_context *cxt, int partnum);
 
+extern struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum);
+extern int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
+                            struct fdisk_parttype *t);
+
 /* alignment.c */
 extern int fdisk_reset_alignment(struct fdisk_context *cxt);
 
index 1d9f4e802752cfc8a8f64942c1207e23c7881f3a..e78b355943d1a3dd8dc863b69fd6bffc5b09e0a6 100644 (file)
@@ -165,50 +165,4 @@ void fdisk_free_parttype(struct fdisk_parttype *t)
        }
 }
 
-/**
- * fdisk_get_partition_type:
- * @cxt: fdisk context
- * @partnum: partition number
- *
- * Returns partition type or NULL upon failure.
- */
-struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum)
-{
-       if (!cxt || !cxt->label || !cxt->label->part_get_type)
-               return NULL;
-
-       DBG(LABEL, dbgprint("partition: %d: get type", partnum));
-       return cxt->label->part_get_type(cxt, partnum);
-}
-
-/**
- * fdisk_set_partition_type:
- * @cxt: fdisk context
- * @partnum: partition number
- * @t: new type
- *
- * Returns 0 on success, < 0 on error.
- */
-int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum,
-                            struct fdisk_parttype *t)
-{
-       if (!cxt || !cxt->label || !cxt->label->part_set_type)
-               return -EINVAL;
-
-       DBG(LABEL, dbgprint("partition: %d: set type", partnum));
-       return cxt->label->part_set_type(cxt, partnum, t);
-}
-
-/**
- * fdisk_get_nparttypes:
- * @cxt: fdisk context
- *
- * Returns: number of partition types supported by the current label
- */
-size_t fdisk_get_nparttypes(struct fdisk_context *cxt)
-{
-       if (!cxt || !cxt->label)
-               return 0;
 
-       return cxt->label->nparttypes;
-}