]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: rename try() and tryprocpt() functions
authorFrancesco Cosoleto <cosoleto@gmail.com>
Thu, 15 Dec 2011 19:02:41 +0000 (20:02 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 16 Dec 2011 13:04:02 +0000 (14:04 +0100)
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
fdisk/fdisk.c

index 1ecab17800fe7975648dfa03489d9dab9c262102..a8a18009ac0090069f85f0cea088b8355a423919 100644 (file)
@@ -2799,8 +2799,10 @@ gpt_warning(char *dev)
                        "The util fdisk doesn't support GPT. Use GNU Parted.\n\n"), dev);
 }
 
+/* Print disk geometry and partition table of a specified device (-l option) */
+
 static void
-try(char *device)
+print_partition_table_from_option(char *device)
 {
        int gb;
 
@@ -2837,7 +2839,8 @@ try(char *device)
  * try all things in /proc/partitions that look like a full disk
  */
 static void
-tryprocpt(void) {
+print_all_partition_table_from_option(void)
+{
        FILE *procpt;
        char line[128], ptname[128], devname[256];
        int ma, mi;
@@ -2857,7 +2860,7 @@ tryprocpt(void) {
                if (is_whole_disk(devname)) {
                        char *cn = canonicalize_path(devname);
                        if (cn) {
-                               try(cn);
+                               print_partition_table_from_option(cn);
                                free(cn);
                        }
                }
@@ -3078,12 +3081,9 @@ main(int argc, char **argv) {
                        listing = 1;
                        for (k = optind; k < argc; k++)
                                if (!is_ide_cdrom_or_tape(argv[k]))
-                                       try(argv[k]);
-               } else {
-                       /* we no longer have default device names */
-                       /* but we can use /proc/partitions instead */
-                       tryprocpt();
-               }
+                                       print_partition_table_from_option(argv[k]);
+               } else
+                       print_all_partition_table_from_option();
                exit(0);
        }