]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: remove unused code, coding style changes
authorKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:26:52 +0000 (16:26 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:47:10 +0000 (16:47 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk-menu.c
fdisks/fdisk.c
fdisks/fdisk.h
libfdisk/src/alignment.c

index e381c34f3a38007182884d92b76e437e8af835f2..10450cc65d6286514bc41e798ccdd4952a8fd4df 100644 (file)
@@ -312,7 +312,7 @@ static int menu_detect_collisions(struct fdisk_context *cxt)
        return 0;
 }
 
-int print_fdisk_menu(struct fdisk_context *cxt)
+static int print_fdisk_menu(struct fdisk_context *cxt)
 {
        struct menu_context mc = MENU_CXT_EMPTY;
        const struct menu_entry *e;
index 3ee32d28bdee02a005f506ae175814a60b441499..8bd6c4edb094e925142ac4dd2c8b2835e0c7884a 100644 (file)
@@ -53,8 +53,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
 
        fprintf(out,
              _(" %1$s [options] <disk>    change partition table\n"
-               " %1$s [options] -l <disk> list partition table(s)\n"
-               " %1$s -s <partition>      give partition size(s) in blocks (deprecated)\n"),
+               " %1$s [options] -l <disk> list partition table(s)\n"),
               program_invocation_short_name);
 
        fputs(USAGE_OPTIONS, out);
@@ -162,7 +161,7 @@ void toggle_dos_compatibility_flag(struct fdisk_context *cxt)
 void change_partition_type(struct fdisk_context *cxt)
 {
        size_t i;
-       struct fdisk_parttype *t, *org_t;
+       struct fdisk_parttype *t = NULL, *org_t = NULL;
 
        assert(cxt);
        assert(cxt->label);
@@ -173,25 +172,22 @@ void change_partition_type(struct fdisk_context *cxt)
        org_t = t = fdisk_get_partition_type(cxt, i);
        if (!t)
                 fdisk_warnx(cxt, _("Partition %zu does not exist yet!"), i + 1);
+        else {
+               do {
+                       t = ask_partition_type(cxt);
+               } while (!t);
 
-        else do {
-               t = ask_partition_type(cxt);
-               if (!t)
-                       continue;
-
-               if (fdisk_set_partition_type(cxt, i, t) == 0) {
+               if (fdisk_set_partition_type(cxt, i, t) == 0)
                        fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
                                _("Changed type of partition '%s' to '%s'."),
                                org_t ? org_t->name : _("Unknown"),
                                    t ?     t->name : _("Unknown"));
-               } else {
+               else
                        fdisk_info(cxt,
                                _("Type of partition %zu is unchanged: %s."),
                                i + 1,
                                org_t ? org_t->name : _("Unknown"));
-               }
-               break;
-        } while (1);
+        }
 
        fdisk_free_parttype(t);
        fdisk_free_parttype(org_t);
index c97bf9435a3216ce09e8f43d2b102e55e038bc8a..15df8e41d6a3d7a717ee9f4e56018e870b43d41c 100644 (file)
 #include "blkdev.h"
 #include "colors.h"
 
-extern void toggle_units(struct fdisk_context *cxt);
-
-static inline unsigned long
-scround(struct fdisk_context *cxt, unsigned long num)
-{
-       unsigned long un = fdisk_context_get_units_per_sector(cxt);
-       return (num + un - 1) / un;
-}
-
-
 extern int get_user_reply(struct fdisk_context *cxt,
                          const char *prompt,
                          char *buf, size_t bufsz);
-extern int print_fdisk_menu(struct fdisk_context *cxt);
 extern int process_fdisk_menu(struct fdisk_context **cxt);
 
 extern int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
@@ -40,11 +29,7 @@ extern void list_partition_types(struct fdisk_context *cxt);
 extern void list_disk_geometry(struct fdisk_context *cxt);
 extern void change_partition_type(struct fdisk_context *cxt);
 extern struct fdisk_parttype *ask_partition_type(struct fdisk_context *cxt);
-extern void reread_partition_table(struct fdisk_context *cxt, int leave);
 
-extern char *partition_type(struct fdisk_context *cxt, unsigned char type);
-extern int warn_geometry(struct fdisk_context *cxt);
 extern void toggle_dos_compatibility_flag(struct fdisk_context *cxt);
-extern void warn_limits(struct fdisk_context *cxt);
 
 #endif /* UTIL_LINUX_FDISK_H */
index 9c29767f859ea0a003fb9b51b8eade7fe1636565..ae6d30cef7bd218c65aa2e0d4c2b68937699bd90 100644 (file)
@@ -301,7 +301,7 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)
                cxt->total_sectors = (nsects / (cxt->sector_size >> 9));
 
        /* what the kernel/bios thinks the geometry is */
-       blkdev_get_geometry(cxt->dev_fd, &cxt->geom.heads, &cxt->geom.sectors);
+       blkdev_get_geometry(cxt->dev_fd, &cxt->geom.heads, (unsigned int *) &cxt->geom.sectors);
 
        /* obtained heads and sectors */
        recount_geometry(cxt);