diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-24 01:38:33 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-24 01:38:33 +0000 |
commit | 87ffd358f5ddf0426914ee99d24d9477cb04f766 (patch) | |
tree | 53772500a81463def2ba1c9b3cca63a97e18c203 | |
parent | d491f9d4cc61f44209579ac6dc99acfa55a8f51c (diff) |
Whitespace fixes.
-rw-r--r-- | sbin/pdisk/dpme.h | 4 | ||||
-rw-r--r-- | sbin/pdisk/dump.c | 37 | ||||
-rw-r--r-- | sbin/pdisk/dump.h | 12 | ||||
-rw-r--r-- | sbin/pdisk/io.c | 12 | ||||
-rw-r--r-- | sbin/pdisk/io.h | 22 | ||||
-rw-r--r-- | sbin/pdisk/partition_map.c | 50 | ||||
-rw-r--r-- | sbin/pdisk/partition_map.h | 36 | ||||
-rw-r--r-- | sbin/pdisk/pdisk.c | 48 | ||||
-rw-r--r-- | sbin/pdisk/validate.c | 10 | ||||
-rw-r--r-- | sbin/pdisk/validate.h | 4 |
10 files changed, 122 insertions, 113 deletions
diff --git a/sbin/pdisk/dpme.h b/sbin/pdisk/dpme.h index e7f7eab4022..e2df488138b 100644 --- a/sbin/pdisk/dpme.h +++ b/sbin/pdisk/dpme.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dpme.h,v 1.18 2016/01/23 14:10:05 krw Exp $ */ +/* $OpenBSD: dpme.h,v 1.19 2016/01/24 01:38:32 krw Exp $ */ /* * dpme.h - Disk Partition Map Entry (dpme) @@ -43,9 +43,9 @@ #define __dpme__ #define BLOCK0_SIGNATURE 0x4552 /* i.e. 'ER' */ +#define DPME_SIGNATURE 0x504D /* i.e. 'PM' */ #define DPISTRLEN 32 -#define DPME_SIGNATURE 0x504D /* i.e. 'PM' */ /* * Since block0 is assumed to be the same size as the physical sector size, diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c index 3864287da76..8cac84de7a7 100644 --- a/sbin/pdisk/dump.c +++ b/sbin/pdisk/dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.c,v 1.47 2016/01/23 23:25:58 krw Exp $ */ +/* $OpenBSD: dump.c,v 1.48 2016/01/24 01:38:32 krw Exp $ */ /* * dump.c - dumping partition maps @@ -39,18 +39,18 @@ #define get_align_long(x) (*(x)) -void adjust_value_and_compute_prefix(double *, int *); -void dump_block_zero(struct partition_map_header *); -void dump_partition_entry(struct partition_map *, int, int, int); -int get_max_base_or_length(struct partition_map_header *); -int get_max_name_string_length(struct partition_map_header *); -int get_max_type_string_length(struct partition_map_header *); +void adjust_value_and_compute_prefix(double *, int *); +void dump_block_zero(struct partition_map_header *); +void dump_partition_entry(struct partition_map *, int, int, int); +int get_max_base_or_length(struct partition_map_header *); +int get_max_name_string_length(struct partition_map_header *); +int get_max_type_string_length(struct partition_map_header *); void -dump_block_zero(struct partition_map_header * map) +dump_block_zero(struct partition_map_header *map) { - struct block0 *p; - struct ddmap *m; + struct block0 *p; + struct ddmap *m; double value; long t; int i, prefix; @@ -88,7 +88,7 @@ dump_block_zero(struct partition_map_header * map) void -dump_partition_map(struct partition_map_header * map) +dump_partition_map(struct partition_map_header *map) { struct partition_map *entry; int digits, max_type_length, max_name_length; @@ -123,7 +123,8 @@ dump_partition_map(struct partition_map_header * map) void -dump_partition_entry(struct partition_map * entry, int type_length, int name_length, int digits) +dump_partition_entry(struct partition_map *entry, int type_length, + int name_length, int digits) { struct partition_map_header *map; struct dpme *p; @@ -170,7 +171,7 @@ dump_partition_entry(struct partition_map * entry, int type_length, int name_len void -show_data_structures(struct partition_map_header * map) +show_data_structures(struct partition_map_header *map) { struct partition_map *entry; struct block0 *zp; @@ -262,7 +263,7 @@ show_data_structures(struct partition_map_header * map) void -full_dump_partition_entry(struct partition_map_header * map, int ix) +full_dump_partition_entry(struct partition_map_header *map, int ix) { struct partition_map *cur; struct dpme *p; @@ -369,7 +370,7 @@ dump_block(unsigned char *addr, int len) } void -full_dump_block_zero(struct partition_map_header * map) +full_dump_block_zero(struct partition_map_header *map) { struct block0 *zp; struct ddmap *m; @@ -403,7 +404,7 @@ full_dump_block_zero(struct partition_map_header * map) } int -get_max_type_string_length(struct partition_map_header * map) +get_max_type_string_length(struct partition_map_header *map) { struct partition_map *entry; int max, length; @@ -421,7 +422,7 @@ get_max_type_string_length(struct partition_map_header * map) } int -get_max_name_string_length(struct partition_map_header * map) +get_max_name_string_length(struct partition_map_header *map) { struct partition_map *entry; int max, length; @@ -440,7 +441,7 @@ get_max_name_string_length(struct partition_map_header * map) } int -get_max_base_or_length(struct partition_map_header * map) +get_max_base_or_length(struct partition_map_header *map) { struct partition_map *entry; int max; diff --git a/sbin/pdisk/dump.h b/sbin/pdisk/dump.h index 3661a477aa2..b770f3ebc98 100644 --- a/sbin/pdisk/dump.h +++ b/sbin/pdisk/dump.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.h,v 1.14 2016/01/23 23:25:58 krw Exp $ */ +/* $OpenBSD: dump.h,v 1.15 2016/01/24 01:38:32 krw Exp $ */ /* * dump.h - dumping partition maps @@ -30,10 +30,10 @@ #ifndef __dump__ #define __dump__ -void dump_block(unsigned char *, int); -void dump_partition_map(struct partition_map_header *); -void full_dump_partition_entry(struct partition_map_header *, int); -void full_dump_block_zero(struct partition_map_header *); -void show_data_structures(struct partition_map_header *); +void dump_block(unsigned char *, int); +void dump_partition_map(struct partition_map_header *); +void full_dump_partition_entry(struct partition_map_header *, int); +void full_dump_block_zero(struct partition_map_header *); +void show_data_structures(struct partition_map_header *); #endif /* __dump__ */ diff --git a/sbin/pdisk/io.c b/sbin/pdisk/io.c index 2d27e60c012..c12a7707165 100644 --- a/sbin/pdisk/io.c +++ b/sbin/pdisk/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.21 2016/01/23 22:55:23 krw Exp $ */ +/* $OpenBSD: io.c,v 1.22 2016/01/24 01:38:32 krw Exp $ */ /* * io.c - simple io and input parsing routines @@ -39,12 +39,12 @@ #define STRING_CHUNK 16 #define UNGET_MAX_COUNT 10 -short unget_buf[UNGET_MAX_COUNT + 1]; -int unget_count; +short unget_buf[UNGET_MAX_COUNT + 1]; +int unget_count; -long get_number(int); -char *get_string(int); -int my_getch (void); +long get_number(int); +char *get_string(int); +int my_getch (void); int my_getch() diff --git a/sbin/pdisk/io.h b/sbin/pdisk/io.h index af01b14f6ca..f09dbaf5d41 100644 --- a/sbin/pdisk/io.h +++ b/sbin/pdisk/io.h @@ -1,4 +1,4 @@ -/* $OpenBSD: io.h,v 1.10 2016/01/23 22:55:23 krw Exp $ */ +/* $OpenBSD: io.h,v 1.11 2016/01/24 01:38:32 krw Exp $ */ /* * io.h - simple io and input parsing routines @@ -30,15 +30,15 @@ #ifndef __io__ #define __io__ -void bad_input(const char *, ...); -void flush_to_newline(int); -int get_command(const char *, int, int *); -unsigned long get_multiplier(long); -int get_number_argument(const char *, long *); -int get_okay(const char *, int); -int get_partition_modifier(void); -int get_string_argument(const char *, char **); -int number_of_digits(unsigned long); -void my_ungetch(int); +unsigned long get_multiplier(long); +void bad_input(const char *, ...); +void flush_to_newline(int); +void my_ungetch(int); +int get_command(const char *, int, int *); +int get_number_argument(const char *, long *); +int get_okay(const char *, int); +int get_partition_modifier(void); +int get_string_argument(const char *, char **); +int number_of_digits(unsigned long); #endif /* __io__ */ diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c index ca743cdb1c2..eef0808fae3 100644 --- a/sbin/pdisk/partition_map.c +++ b/sbin/pdisk/partition_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: partition_map.c,v 1.60 2016/01/24 01:09:08 krw Exp $ */ +/* $OpenBSD: partition_map.c,v 1.61 2016/01/24 01:38:32 krw Exp $ */ /* * partition_map.c - partition map routines @@ -135,7 +135,7 @@ open_partition_map(int fd, char *name, uint64_t mediasz, uint32_t sectorsz) void -free_partition_map(struct partition_map_header * map) +free_partition_map(struct partition_map_header *map) { struct partition_map *entry, *next; @@ -151,7 +151,7 @@ free_partition_map(struct partition_map_header * map) } int -read_partition_map(struct partition_map_header * map) +read_partition_map(struct partition_map_header *map) { struct dpme *dpme; double d; @@ -227,7 +227,7 @@ read_partition_map(struct partition_map_header * map) void -write_partition_map(struct partition_map_header * map) +write_partition_map(struct partition_map_header *map) { struct partition_map *entry; int result; @@ -250,7 +250,7 @@ write_partition_map(struct partition_map_header * map) int -add_data_to_map(struct dpme * dpme, long ix, struct partition_map_header * map) +add_data_to_map(struct dpme *dpme, long ix, struct partition_map_header *map) { struct partition_map *entry; @@ -341,7 +341,7 @@ create_partition_map(int fd, char *name, u_int64_t mediasz, uint32_t sectorsz) int -coerce_block0(struct partition_map_header * map) +coerce_block0(struct partition_map_header *map) { struct block0 *p; @@ -361,7 +361,7 @@ coerce_block0(struct partition_map_header * map) int add_partition_to_map(const char *name, const char *dptype, uint32_t base, - uint32_t length, struct partition_map_header * map) + uint32_t length, struct partition_map_header *map) { struct partition_map *cur; struct dpme *dpme; @@ -530,7 +530,7 @@ create_dpme(const char *name, const char *dptype, uint32_t base, } void -dpme_init_flags(struct dpme * dpme) +dpme_init_flags(struct dpme *dpme) { if (strncasecmp(dpme->dpme_type, kHFSType, DPISTRLEN) == 0) { /* XXX this is gross, fix it! */ @@ -542,7 +542,7 @@ dpme_init_flags(struct dpme * dpme) } void -renumber_disk_addresses(struct partition_map_header * map) +renumber_disk_addresses(struct partition_map_header *map) { struct partition_map *cur; long ix; @@ -558,7 +558,7 @@ renumber_disk_addresses(struct partition_map_header * map) } void -delete_partition_from_map(struct partition_map * entry) +delete_partition_from_map(struct partition_map *entry) { struct partition_map_header *map; struct dpme *dpme; @@ -606,7 +606,7 @@ delete_partition_from_map(struct partition_map * entry) int -contains_driver(struct partition_map * entry) +contains_driver(struct partition_map *entry) { struct partition_map_header *map; struct block0 *p; @@ -641,7 +641,7 @@ contains_driver(struct partition_map * entry) void -combine_entry(struct partition_map * entry) +combine_entry(struct partition_map *entry) { struct partition_map *p; uint32_t end; @@ -652,7 +652,8 @@ combine_entry(struct partition_map * entry) } if (entry->next_by_base != NULL) { p = entry->next_by_base; - if (strncasecmp(p->dpme->dpme_type, kFreeType, DPISTRLEN) != 0) { + if (strncasecmp(p->dpme->dpme_type, kFreeType, DPISTRLEN) != + 0) { /* next is not free */ } else if (entry->dpme->dpme_pblock_start + entry->dpme->dpme_pblocks != @@ -678,7 +679,8 @@ combine_entry(struct partition_map * entry) } if (entry->prev_by_base != NULL) { p = entry->prev_by_base; - if (strncasecmp(p->dpme->dpme_type, kFreeType, DPISTRLEN) != 0) { + if (strncasecmp(p->dpme->dpme_type, kFreeType, DPISTRLEN) != + 0) { /* previous is not free */ } else if (p->dpme->dpme_pblock_start + p->dpme->dpme_pblocks != entry->dpme->dpme_pblock_start) { @@ -712,7 +714,7 @@ combine_entry(struct partition_map * entry) void -delete_entry(struct partition_map * entry) +delete_entry(struct partition_map *entry) { struct partition_map_header *map; struct partition_map *p; @@ -738,7 +740,7 @@ delete_entry(struct partition_map * entry) struct partition_map * -find_entry_by_disk_address(long ix, struct partition_map_header * map) +find_entry_by_disk_address(long ix, struct partition_map_header *map) { struct partition_map *cur; @@ -754,7 +756,7 @@ find_entry_by_disk_address(long ix, struct partition_map_header * map) struct partition_map * -find_entry_by_type(const char *type_name, struct partition_map_header * map) +find_entry_by_type(const char *type_name, struct partition_map_header *map) { struct partition_map *cur; @@ -770,7 +772,7 @@ find_entry_by_type(const char *type_name, struct partition_map_header * map) } struct partition_map * -find_entry_by_base(uint32_t base, struct partition_map_header * map) +find_entry_by_base(uint32_t base, struct partition_map_header *map) { struct partition_map *cur; @@ -786,7 +788,7 @@ find_entry_by_base(uint32_t base, struct partition_map_header * map) void -move_entry_in_map(long old_index, long ix, struct partition_map_header * map) +move_entry_in_map(long old_index, long ix, struct partition_map_header *map) { struct partition_map *cur; @@ -804,7 +806,7 @@ move_entry_in_map(long old_index, long ix, struct partition_map_header * map) void -remove_from_disk_order(struct partition_map * entry) +remove_from_disk_order(struct partition_map *entry) { struct partition_map_header *map; struct partition_map *p; @@ -826,7 +828,7 @@ remove_from_disk_order(struct partition_map * entry) void -insert_in_disk_order(struct partition_map * entry) +insert_in_disk_order(struct partition_map *entry) { struct partition_map_header *map; struct partition_map *cur; @@ -863,7 +865,7 @@ insert_in_disk_order(struct partition_map * entry) void -insert_in_base_order(struct partition_map * entry) +insert_in_base_order(struct partition_map *entry) { struct partition_map_header *map; struct partition_map *cur; @@ -902,7 +904,7 @@ insert_in_base_order(struct partition_map * entry) void -resize_map(long new_size, struct partition_map_header * map) +resize_map(long new_size, struct partition_map_header *map) { struct partition_map *entry; struct partition_map *next; @@ -958,7 +960,7 @@ doit: void -remove_driver(struct partition_map * entry) +remove_driver(struct partition_map *entry) { struct partition_map_header *map; struct block0 *p; diff --git a/sbin/pdisk/partition_map.h b/sbin/pdisk/partition_map.h index 8f09419e8aa..158cda6f057 100644 --- a/sbin/pdisk/partition_map.h +++ b/sbin/pdisk/partition_map.h @@ -1,4 +1,4 @@ -/* $OpenBSD: partition_map.h,v 1.28 2016/01/23 23:25:58 krw Exp $ */ +/* $OpenBSD: partition_map.h,v 1.29 2016/01/24 01:38:32 krw Exp $ */ /* * partition_map.h - partition map routines @@ -66,21 +66,27 @@ extern int dflag; extern int lflag; extern int rflag; -int add_partition_to_map(const char *, const char *, uint32_t, uint32_t, struct partition_map_header *); -void free_partition_map(struct partition_map_header *); -struct partition_map_header* create_partition_map(int, char *, uint64_t, +struct partition_map_header *init_partition_map(char *); +struct partition_map_header *create_partition_map(int, char *, uint64_t, uint32_t); -void delete_partition_from_map(struct partition_map *); -struct partition_map* find_entry_by_disk_address(long, struct partition_map_header *); -struct partition_map* find_entry_by_type(const char *, struct partition_map_header *); -struct partition_map* find_entry_by_base(uint32_t, struct partition_map_header *); -struct partition_map_header* init_partition_map(char *); -void move_entry_in_map(long, long, struct partition_map_header *); -struct partition_map_header* open_partition_map(int, char *, uint64_t, +struct partition_map_header *open_partition_map(int, char *, uint64_t, uint32_t); -void resize_map(long new_size, struct partition_map_header *); -void write_partition_map(struct partition_map_header *); -void dpme_init_flags(struct dpme *); -void sync_device_size(struct partition_map_header *); + +struct partition_map *find_entry_by_disk_address(long, + struct partition_map_header *); +struct partition_map *find_entry_by_type(const char *, + struct partition_map_header *); +struct partition_map *find_entry_by_base(uint32_t, + struct partition_map_header *); + +int add_partition_to_map(const char *, const char *, uint32_t, uint32_t, + struct partition_map_header *); +void free_partition_map(struct partition_map_header *); +void delete_partition_from_map(struct partition_map *); +void move_entry_in_map(long, long, struct partition_map_header *); +void resize_map(long new_size, struct partition_map_header *); +void write_partition_map(struct partition_map_header *); +void dpme_init_flags(struct dpme *); +void sync_device_size(struct partition_map_header *); #endif /* __partition_map__ */ diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c index 8eeef92ae72..2671537dadf 100644 --- a/sbin/pdisk/pdisk.c +++ b/sbin/pdisk/pdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdisk.c,v 1.65 2016/01/23 23:25:58 krw Exp $ */ +/* $OpenBSD: pdisk.c,v 1.66 2016/01/24 01:38:32 krw Exp $ */ /* * pdisk - an editor for Apple format partition tables @@ -50,22 +50,22 @@ #include "validate.h" #include "file_media.h" -int lflag; /* list the device */ -int rflag; /* open device read Only */ +int lflag; /* list the device */ +int rflag; /* open device read Only */ static int first_get = 1; -void do_change_map_size(struct partition_map_header *); -void do_create_partition(struct partition_map_header *, int); -void do_delete_partition(struct partition_map_header *); -void do_display_entry(struct partition_map_header *); -void do_rename_partition(struct partition_map_header *); -void do_change_type(struct partition_map_header *); -void do_reorder(struct partition_map_header *); -void do_write_partition_map(struct partition_map_header *); -void edit(struct partition_map_header **); -int get_base_argument(long *, struct partition_map_header *); -int get_size_argument(long *, struct partition_map_header *); +void do_change_map_size(struct partition_map_header *); +void do_create_partition(struct partition_map_header *, int); +void do_delete_partition(struct partition_map_header *); +void do_display_entry(struct partition_map_header *); +void do_rename_partition(struct partition_map_header *); +void do_change_type(struct partition_map_header *); +void do_reorder(struct partition_map_header *); +void do_write_partition_map(struct partition_map_header *); +void edit(struct partition_map_header **); +int get_base_argument(long *, struct partition_map_header *); +int get_size_argument(long *, struct partition_map_header *); __dead static void usage(void); @@ -248,7 +248,7 @@ edit(struct partition_map_header **mapp) } void -do_create_partition(struct partition_map_header * map, int get_type) +do_create_partition(struct partition_map_header *map, int get_type) { long base, length; char *name = NULL; @@ -295,7 +295,7 @@ xit1: } int -get_base_argument(long *number, struct partition_map_header * map) +get_base_argument(long *number, struct partition_map_header *map) { struct partition_map *entry; int result = 0; @@ -319,7 +319,7 @@ get_base_argument(long *number, struct partition_map_header * map) int -get_size_argument(long *number, struct partition_map_header * map) +get_size_argument(long *number, struct partition_map_header *map) { struct partition_map *entry; unsigned long multiple; @@ -351,7 +351,7 @@ get_size_argument(long *number, struct partition_map_header * map) void -do_rename_partition(struct partition_map_header * map) +do_rename_partition(struct partition_map_header *map) { struct partition_map *entry; char *name; @@ -383,7 +383,7 @@ do_rename_partition(struct partition_map_header * map) } void -do_change_type(struct partition_map_header * map) +do_change_type(struct partition_map_header *map) { struct partition_map *entry; char *type = NULL; @@ -418,7 +418,7 @@ out: void -do_delete_partition(struct partition_map_header * map) +do_delete_partition(struct partition_map_header *map) { struct partition_map *cur; long ix; @@ -442,7 +442,7 @@ do_delete_partition(struct partition_map_header * map) void -do_reorder(struct partition_map_header * map) +do_reorder(struct partition_map_header *map) { long ix, old_index; @@ -463,7 +463,7 @@ do_reorder(struct partition_map_header * map) void -do_write_partition_map(struct partition_map_header * map) +do_write_partition_map(struct partition_map_header *map) { if (map == NULL) { bad_input("No partition map exists"); @@ -488,7 +488,7 @@ do_write_partition_map(struct partition_map_header * map) void -do_change_map_size(struct partition_map_header * map) +do_change_map_size(struct partition_map_header *map) { long size; @@ -501,7 +501,7 @@ do_change_map_size(struct partition_map_header * map) void -do_display_entry(struct partition_map_header * map) +do_display_entry(struct partition_map_header *map) { long number; diff --git a/sbin/pdisk/validate.c b/sbin/pdisk/validate.c index 3963e28d753..f624a71c810 100644 --- a/sbin/pdisk/validate.c +++ b/sbin/pdisk/validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: validate.c,v 1.36 2016/01/24 01:16:20 krw Exp $ */ +/* $OpenBSD: validate.c,v 1.37 2016/01/24 01:38:32 krw Exp $ */ /* * validate.c - @@ -78,7 +78,7 @@ new_range_list_item(enum range_state state, int valid, uint32_t low, uint32_t hi void -initialize_list(struct range_list ** list) +initialize_list(struct range_list **list) { struct range_list *item; @@ -162,7 +162,7 @@ add_range(struct range_list **list, uint32_t base, uint32_t len, int allocate) void -coalesce_list(struct range_list * list) +coalesce_list(struct range_list *list) { struct range_list *cur, *item; @@ -187,7 +187,7 @@ coalesce_list(struct range_list * list) void -print_range_list(struct range_list * list) +print_range_list(struct range_list *list) { struct range_list *cur; const char *s = NULL; @@ -236,7 +236,7 @@ print_range_list(struct range_list * list) void -validate_map(struct partition_map_header * map) +validate_map(struct partition_map_header *map) { struct partition_map *entry; struct range_list *list; diff --git a/sbin/pdisk/validate.h b/sbin/pdisk/validate.h index 758ee92de1c..1b703612ca5 100644 --- a/sbin/pdisk/validate.h +++ b/sbin/pdisk/validate.h @@ -1,4 +1,4 @@ -/* $OpenBSD: validate.h,v 1.9 2016/01/23 23:25:58 krw Exp $ */ +/* $OpenBSD: validate.h,v 1.10 2016/01/24 01:38:32 krw Exp $ */ /* * validate.h - @@ -30,6 +30,6 @@ #ifndef __validate__ #define __validate__ -void validate_map(struct partition_map_header *); +void validate_map(struct partition_map_header *); #endif /* __validate__ */ |