sbin/hammer: Cleanup prototypes
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 12 Apr 2017 16:14:26 +0000 (19:14 +0300)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 12 Apr 2017 21:50:12 +0000 (00:50 +0300)
sbin/hammer/hammer.c
sbin/hammer/hammer.h
sbin/hammer/hammer_util.h

index 4dff7d2..e4e9162 100644 (file)
@@ -369,6 +369,10 @@ main(int ac, char **av)
                hammer_cmd_softprune(av + 1, ac - 1, 0);
                exit(0);
        }
+       if (strcmp(av[0], "prune-everything") == 0) {
+               hammer_cmd_softprune(av + 1, ac - 1, 1);
+               exit(0);
+       }
        if (strcmp(av[0], "config") == 0) {
                hammer_cmd_config(av + 1, ac - 1);
                exit(0);
@@ -389,10 +393,6 @@ main(int ac, char **av)
                hammer_cmd_info(av + 1, ac - 1);
                exit(0);
        }
-       if (strcmp(av[0], "prune-everything") == 0) {
-               hammer_cmd_softprune(av + 1, ac - 1, 1);
-               exit(0);
-       }
        if (strcmp(av[0], "ssh-remote") == 0) {
                if (ac != 3) {
                        usage(1);
index e1ff473..3e08082 100644 (file)
@@ -96,47 +96,47 @@ extern const char *CyclePath;
 extern const char *ScoreBoardFile;
 extern const char *RestrictTarget;
 
-void hammer_cmd_show(const char *arg, int filter, int obfuscate, int indent);
-void hammer_cmd_show_undo(void);
-void hammer_cmd_sshremote(const char *cmd, const char *target);
-void hammer_cmd_recover(char **av, int ac);
-void hammer_cmd_blockmap(void);
-void hammer_cmd_checkmap(void);
-void hammer_cmd_softprune(char **av, int ac, int everything_opt);
-void hammer_cmd_bstats(char **av, int ac);
-void hammer_cmd_iostats(char **av, int ac);
-void hammer_cmd_stats(char **av, int ac);
 void hammer_cmd_synctid(char **av, int ac);
-void hammer_cmd_mirror_read(char **av, int ac, int streaming);
-void hammer_cmd_mirror_write(char **av, int ac);
-void hammer_cmd_mirror_copy(char **av, int ac, int streaming);
-void hammer_cmd_mirror_dump(char **av, int ac);
-void hammer_cmd_history(const char *offset_str, char **av, int ac);
-void hammer_cmd_reblock(char **av, int ac, int flags);
-void hammer_cmd_rebalance(char **av, int ac);
 void hammer_cmd_pseudofs_status(char **av, int ac);
 void hammer_cmd_pseudofs_create(char **av, int ac, int is_slave);
 void hammer_cmd_pseudofs_update(char **av, int ac);
-void hammer_cmd_pseudofs_destroy(char **av, int ac);
 void hammer_cmd_pseudofs_upgrade(char **av, int ac);
 void hammer_cmd_pseudofs_downgrade(char **av, int ac);
-void hammer_cmd_snapshot(char **av, int ac);
-void hammer_cmd_snap(char **av, int ac, int tostdout, int fsbase);
-void hammer_cmd_snapls(char **av, int ac);
-void hammer_cmd_snaprm(char **av, int ac);
-void hammer_cmd_cleanup(char **av, int ac);
+void hammer_cmd_pseudofs_destroy(char **av, int ac);
+void hammer_cmd_softprune(char **av, int ac, int everything_opt);
 void hammer_cmd_config(char **av, int ac);
 void hammer_cmd_viconfig(char **av, int ac);
+void hammer_cmd_cleanup(char **av, int ac);
+void hammer_cmd_abort_cleanup(char **av, int ac);
 void hammer_cmd_info(char **av, int ac);
+void hammer_cmd_sshremote(const char *cmd, const char *target);
+void hammer_cmd_snap(char **av, int ac, int tostdout, int fsbase);
+void hammer_cmd_snapls(char **av, int ac);
+void hammer_cmd_snaprm(char **av, int ac);
+void hammer_cmd_snapshot(char **av, int ac);
+void hammer_cmd_bstats(char **av, int ac);
+void hammer_cmd_iostats(char **av, int ac);
+void hammer_cmd_stats(char **av, int ac);
+void hammer_cmd_history(const char *offset_str, char **av, int ac);
+void hammer_cmd_rebalance(char **av, int ac);
+void hammer_cmd_reblock(char **av, int ac, int flags);
+void hammer_cmd_mirror_read(char **av, int ac, int streaming);
+void hammer_cmd_mirror_write(char **av, int ac);
+void hammer_cmd_mirror_copy(char **av, int ac, int streaming);
+void hammer_cmd_mirror_dump(char **av, int ac);
+void hammer_cmd_dedup_simulate(char **av, int ac);
+void hammer_cmd_dedup(char **av, int ac);
 void hammer_cmd_get_version(char **av, int ac);
 void hammer_cmd_set_version(char **av, int ac);
 void hammer_cmd_volume_add(char **av, int ac);
 void hammer_cmd_volume_del(char **av, int ac);
 void hammer_cmd_volume_list(char **av, int ac);
 void hammer_cmd_volume_blkdevs(char **av, int ac);
-void hammer_cmd_dedup_simulate(char **av, int ac);
-void hammer_cmd_dedup(char **av, int ac);
-void hammer_cmd_abort_cleanup(char **av, int ac);
+void hammer_cmd_show(const char *arg, int filter, int obfuscate, int indent);
+void hammer_cmd_show_undo(void);
+void hammer_cmd_recover(char **av, int ac);
+void hammer_cmd_blockmap(void);
+void hammer_cmd_checkmap(void);
 void hammer_cmd_strip(void);
 
 void hammer_get_cycle(hammer_base_elm_t base, hammer_tid_t *tidp);
index 921f059..c28de77 100644 (file)
 #include <vfs/hammer/hammer_crc.h>
 #include <uuid.h>
 
-struct cache_info {
-       TAILQ_ENTRY(cache_info) entry;
-       int refs;       /* structural references */
-       int modified;   /* ondisk modified flag */
-       int delete;     /* delete flag - delete on last ref */
-};
-
 #define HAMMER_BUFLISTS                64
 #define HAMMER_BUFLISTMASK     (HAMMER_BUFLISTS - 1)
 
@@ -93,6 +86,13 @@ struct volume_info {
        TAILQ_HEAD(, buffer_info) buffer_lists[HAMMER_BUFLISTS];
 };
 
+struct cache_info {
+       TAILQ_ENTRY(cache_info) entry;
+       int                     refs;           /* structural references */
+       int                     modified;       /* ondisk modified flag */
+       int                     delete;         /* delete flag - delete on last ref */
+};
+
 struct buffer_info {
        struct cache_info       cache;          /* must be at offset 0 */
        TAILQ_ENTRY(buffer_info) entry;
@@ -119,45 +119,43 @@ extern int DebugOpt;
 extern uint32_t HammerVersion;
 extern const char *zone_labels[];
 
-struct volume_info *init_volume(const char *filename, int oflags, int32_t vol_no);
+struct volume_info *init_volume(const char *filename, int oflags,
+                       int32_t vol_no);
 struct volume_info *load_volume(const char *filename, int oflags, int verify);
 int is_regfile(struct volume_info *volume);
 void assert_volume_offset(struct volume_info *volume);
 struct volume_info *get_volume(int32_t vol_no);
 struct volume_info *get_root_volume(void);
-void *get_buffer_data(hammer_off_t buf_offset, struct buffer_info **bufferp,
-                               int isnew);
 void rel_buffer(struct buffer_info *buffer);
-
-hammer_off_t bootstrap_bigblock(struct volume_info *volume);
-hammer_off_t alloc_undo_bigblock(struct volume_info *volume);
-void *alloc_blockmap(int zone, int bytes, hammer_off_t *result_offp,
-              struct buffer_info **bufferp);
-hammer_off_t blockmap_lookup(hammer_off_t bmap_off, int *errorp);
-hammer_off_t blockmap_lookup_save(hammer_off_t bmap_off,
-                               hammer_blockmap_layer1_t layer1,
-                               hammer_blockmap_layer2_t layer2,
-                               int *errorp);
-void format_undomap(struct volume_info *root_vol, int64_t *undo_buffer_size);
-
+void *get_buffer_data(hammer_off_t buf_offset, struct buffer_info **bufferp,
+                       int isnew);
 hammer_node_ondisk_t alloc_btree_node(hammer_off_t *offp,
-                        struct buffer_info **data_bufferp);
+                       struct buffer_info **data_bufferp);
 void *alloc_meta_element(hammer_off_t *offp, int32_t data_len,
-                        struct buffer_info **data_bufferp);
-
-void format_blockmap(struct volume_info *root_vol, int zone, hammer_off_t offset);
+                       struct buffer_info **data_bufferp);
+void format_blockmap(struct volume_info *root_vol, int zone,
+                       hammer_off_t offset);
 void format_freemap(struct volume_info *root_vol);
 int64_t initialize_freemap(struct volume_info *volume);
 int64_t count_freemap(struct volume_info *volume);
+void format_undomap(struct volume_info *root_vol, int64_t *undo_buffer_size);
 void print_blockmap(const struct volume_info *volume);
-
 void flush_all_volumes(void);
 void flush_volume(struct volume_info *volume);
 void flush_buffer(struct buffer_info *buffer);
-
 int64_t init_boot_area_size(int64_t value, off_t avg_vol_size);
 int64_t init_memory_log_size(int64_t value, off_t avg_vol_size);
 
+hammer_off_t bootstrap_bigblock(struct volume_info *volume);
+hammer_off_t alloc_undo_bigblock(struct volume_info *volume);
+void *alloc_blockmap(int zone, int bytes, hammer_off_t *result_offp,
+                       struct buffer_info **bufferp);
+hammer_off_t blockmap_lookup(hammer_off_t bmap_off, int *errorp);
+hammer_off_t blockmap_lookup_save(hammer_off_t bmap_off,
+                               hammer_blockmap_layer1_t layer1,
+                               hammer_blockmap_layer2_t layer2,
+                               int *errorp);
+
 int hammer_parse_cache_size(const char *arg);
 void hammer_cache_add(struct cache_info *cache);
 void hammer_cache_del(struct cache_info *cache);
@@ -170,7 +168,6 @@ int getyn(void);
 const char *sizetostr(off_t size);
 int hammer_fs_to_vol(const char *fs, struct hammer_ioc_volume_list *iocp);
 int hammer_fs_to_rootvol(const char *fs, char *buf, int len);
-
 struct zone_stat *hammer_init_zone_stat(void);
 struct zone_stat *hammer_init_zone_stat_bits(void);
 void hammer_cleanup_zone_stat(struct zone_stat *stats);