]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: rename and move function
authorKarel Zak <kzak@redhat.com>
Wed, 26 Nov 2014 16:33:07 +0000 (17:33 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 26 Nov 2014 16:33:07 +0000 (17:33 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/cfdisk.c
disk-utils/fdisk-menu.c
disk-utils/sfdisk.c
libfdisk/src/ask.c
libfdisk/src/context.c
libfdisk/src/label.c
libfdisk/src/libfdisk.h.in
libfdisk/src/libfdisk.sym

index efbd97d56d058358aa8b24ce4c5ca58c1f9865a0..14a75c5542d7a0fc238e1ec36fd6b9caa5646a03 100644 (file)
@@ -1906,7 +1906,7 @@ static int main_menu_action(struct cfdisk *cf, int key)
                int fl = fdisk_is_label(cf->cxt, DOS) ? DOS_FLAG_ACTIVE :
                         fdisk_is_label(cf->cxt, SGI) ? SGI_FLAG_BOOT : 0;
 
-               if (fl && fdisk_partition_toggle_flag(cf->cxt, n, fl))
+               if (fl && fdisk_toggle_partition_flag(cf->cxt, n, fl))
                        warn = _("Could not toggle the flag.");
                else if (fl)
                        ref = 1;
index f920ad01c5845dda251fc1f229d125d2ffa028f2..a8af7b837f8c9b6985faf4b7ac9946ece097177b 100644 (file)
@@ -702,16 +702,16 @@ static int gpt_menu_cb(struct fdisk_context **cxt0,
                        }
                        break;
                case 'A':
-                       rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_LEGACYBOOT);
+                       rc = fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_LEGACYBOOT);
                        break;
                case 'B':
-                       rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_NOBLOCK);
+                       rc = fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_NOBLOCK);
                        break;
                case 'R':
-                       rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_REQUIRED);
+                       rc = fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_REQUIRED);
                        break;
                case 'S':
-                       rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC);
+                       rc = fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC);
                        break;
                }
        }
@@ -740,7 +740,7 @@ static int dos_menu_cb(struct fdisk_context **cxt0,
                        size_t n;
                        rc = fdisk_ask_partnum(cxt, &n, FALSE);
                        if (!rc)
-                               rc = fdisk_partition_toggle_flag(cxt, n, DOS_FLAG_ACTIVE);
+                               rc = fdisk_toggle_partition_flag(cxt, n, DOS_FLAG_ACTIVE);
                        break;
                }
                case 'b':
@@ -817,10 +817,10 @@ static int sun_menu_cb(struct fdisk_context **cxt0,
                        return rc;
                switch (ent->key) {
                case 'a':
-                       rc = fdisk_partition_toggle_flag(cxt, n, SUN_FLAG_RONLY);
+                       rc = fdisk_toggle_partition_flag(cxt, n, SUN_FLAG_RONLY);
                        break;
                case 'c':
-                       rc = fdisk_partition_toggle_flag(cxt, n, SUN_FLAG_UNMNT);
+                       rc = fdisk_toggle_partition_flag(cxt, n, SUN_FLAG_UNMNT);
                        break;
                }
                return rc;
@@ -868,7 +868,7 @@ static int sgi_menu_cb(struct fdisk_context **cxt0,
        case 'a':
                rc = fdisk_ask_partnum(cxt, &n, FALSE);
                if (!rc)
-                       rc = fdisk_partition_toggle_flag(cxt, n, SGI_FLAG_BOOT);
+                       rc = fdisk_toggle_partition_flag(cxt, n, SGI_FLAG_BOOT);
                break;
        case 'b':
                fdisk_sgi_set_bootfile(cxt);
@@ -876,7 +876,7 @@ static int sgi_menu_cb(struct fdisk_context **cxt0,
        case 'c':
                rc = fdisk_ask_partnum(cxt, &n, FALSE);
                if (!rc)
-                       rc = fdisk_partition_toggle_flag(cxt, n, SGI_FLAG_SWAP);
+                       rc = fdisk_toggle_partition_flag(cxt, n, SGI_FLAG_SWAP);
                break;
        case 'i':
                rc = fdisk_sgi_create_info(cxt);
index b22ee40ae7f23676eadea90b9f26207aeb1d901d..cff8664f5011dd2f21e490539d280e47b937cb82 100644 (file)
@@ -578,14 +578,14 @@ static int command_activate(struct sfdisk *sf, int argc, char **argv)
 
                /* deactivate all active partitions */
                } else if (fdisk_partition_is_bootable(pa))
-                       fdisk_partition_toggle_flag(sf->cxt, i, DOS_FLAG_ACTIVE);
+                       fdisk_toggle_partition_flag(sf->cxt, i, DOS_FLAG_ACTIVE);
        }
 
        /* sfdisk --activate <partno> [..] */
        for (i = 1; i < argc; i++) {
                int n = strtou32_or_err(argv[i], _("failed to parse partition number"));
 
-               rc = fdisk_partition_toggle_flag(sf->cxt, n - 1, DOS_FLAG_ACTIVE);
+               rc = fdisk_toggle_partition_flag(sf->cxt, n - 1, DOS_FLAG_ACTIVE);
                if (rc)
                        errx(EXIT_FAILURE,
                                _("%s: partition %d: failed to toggle bootable flag"),
index 0ec3543c55a702ab6ca1d782baaf1e5146557d99..57c01ae235c5bd7cf4147114af64412343ae1195 100644 (file)
 
 static void fdisk_ask_menu_reset_items(struct fdisk_ask *ask);
 
+
+/**
+ * fdisk_set_ask:
+ * @cxt: context
+ * @ask_cb: callback
+ * @data: callback data
+ *
+ * Set callback for dialog driven partitioning and library warnings/errors.
+ *
+ * Returns: 0 on success, < 0 on error.
+ */
+int fdisk_set_ask(struct fdisk_context *cxt,
+               int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *),
+               void *data)
+{
+       assert(cxt);
+
+       cxt->ask_cb = ask_cb;
+       cxt->ask_data = data;
+       return 0;
+}
+
 struct fdisk_ask *fdisk_new_ask(void)
 {
        struct fdisk_ask *ask = calloc(1, sizeof(struct fdisk_ask));
index 698e71d939b02c3855a05ca6248eb8f148d8e6e8..3e82f071b37fd2735906e0e60db1d944669d1aba 100644 (file)
@@ -633,26 +633,6 @@ void fdisk_unref_context(struct fdisk_context *cxt)
        }
 }
 
-/**
- * fdisk_set_ask:
- * @cxt: context
- * @ask_cb: callback
- * @data: callback data
- *
- * Set callback for dialog driven partitioning and library warnings/errors.
- *
- * Returns: 0 on success, < 0 on error.
- */
-int fdisk_set_ask(struct fdisk_context *cxt,
-               int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *),
-               void *data)
-{
-       assert(cxt);
-
-       cxt->ask_cb = ask_cb;
-       cxt->ask_data = data;
-       return 0;
-}
 
 /**
  * fdisk_enable_details:
index 8acc0f8f6c587a5c4c05385b1f139c41f0988f73..ff3b4896756590b09d38be18f167962f8875e892 100644 (file)
@@ -456,14 +456,14 @@ int fdisk_set_partition_type(struct fdisk_context *cxt,
 
 
 /**
- * fdisk_partition_taggle_flag:
+ * fdisk_toggle_partition_flag:
  * @cxt: fdisk context
  * @partnum: partition number
  * @status: flags
  *
  * Returns 0 on success, otherwise, a corresponding error.
  */
-int fdisk_partition_toggle_flag(struct fdisk_context *cxt,
+int fdisk_toggle_partition_flag(struct fdisk_context *cxt,
                               size_t partnum,
                               unsigned long flag)
 {
index ae1d03899964c526fc3749488ff320002d3681ba..a7c7d03e63619d23b198a9e4c081c40628c054a4 100644 (file)
@@ -162,10 +162,6 @@ int fdisk_assign_device(struct fdisk_context *cxt,
 int fdisk_deassign_device(struct fdisk_context *cxt, int nosync);
 int fdisk_is_readonly(struct fdisk_context *cxt);
 
-int fdisk_set_ask(struct fdisk_context *cxt,
-               int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *),
-               void *data);
-
 int fdisk_enable_details(struct fdisk_context *cxt, int enable);
 int fdisk_is_details(struct fdisk_context *cxt);
 
@@ -307,7 +303,7 @@ extern int fdisk_label_is_disabled(const struct fdisk_label *lb);
 
 extern int fdisk_is_partition_used(struct fdisk_context *cxt, size_t n);
 
-extern int fdisk_partition_toggle_flag(struct fdisk_context *cxt, size_t partnum, unsigned long flag);
+extern int fdisk_toggle_partition_flag(struct fdisk_context *cxt, size_t partnum, unsigned long flag);
 
 extern struct fdisk_partition *fdisk_new_partition(void);
 extern void fdisk_reset_partition(struct fdisk_partition *pa);
@@ -478,10 +474,10 @@ enum {
         * dialog, then use the bit number (in range 48..63). For example:
         *
         * // start dialog to ask for bit number
-        * fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC);
+        * fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC);
         *
         * // toggle bit 60
-        * fdisk_partition_toggle_flag(cxt, n, 60);
+        * fdisk_toggle_partition_flag(cxt, n, 60);
         */
        GPT_FLAG_GUIDSPECIFIC
 };
@@ -516,6 +512,11 @@ int fdisk_apply_script(struct fdisk_context *cxt, struct fdisk_script *dp);
 /* ask.c */
 #define fdisk_is_ask(a, x) (fdisk_ask_get_type(a) == FDISK_ASKTYPE_ ## x)
 
+int fdisk_set_ask(struct fdisk_context *cxt,
+               int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *),
+               void *data);
+
+
 void fdisk_ref_ask(struct fdisk_ask *ask);
 void fdisk_unref_ask(struct fdisk_ask *ask);
 const char *fdisk_ask_get_query(struct fdisk_ask *ask);
index 7928322b89246b18ad291b6595bf5e2b36e4ce16..ee0b9bcfc7066122c2143696ff10a7ba27915f09 100644 (file)
@@ -157,7 +157,7 @@ global:
        fdisk_partition_size_explicit;
        fdisk_partition_start_follow_default;
        fdisk_partition_start_is_default;
-       fdisk_partition_toggle_flag;
+       fdisk_toggle_partition_flag;
        fdisk_partition_to_string;
        fdisk_partition_unset_partno;
        fdisk_partition_unset_size;