summaryrefslogtreecommitdiff
path: root/cmds-fi-disk_usage.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-04-23 19:00:22 +0200
committerDavid Sterba <dsterba@suse.cz>2014-12-04 16:48:10 +0100
commitf4e73c060d5de4f809b8cfaeee7491c35ecd3c4b (patch)
treed0d84426ff35b2b799780988f9632553d3973bfb /cmds-fi-disk_usage.h
parent84bd55c9cf1770c5cbcfbbe3c91bf13c8d75d0d4 (diff)
btrfs-progs: move device usage to cmds-device, more cleanups
Move the command definitions where they belong, keep common 'usage' functions in cmds-fi-disk_usage.c and add exports. Rename structures containing 'disk' to 'device'. Fix whitespace in the modified code. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-fi-disk_usage.h')
-rw-r--r--cmds-fi-disk_usage.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/cmds-fi-disk_usage.h b/cmds-fi-disk_usage.h
index 95cf4aab..787b4eb5 100644
--- a/cmds-fi-disk_usage.h
+++ b/cmds-fi-disk_usage.h
@@ -19,10 +19,36 @@
#ifndef __CMDS_FI_DISK_USAGE__
#define __CMDS_FI_DISK_USAGE__
+#define DF_HUMAN_UNIT (1<<0)
+
extern const char * const cmd_filesystem_usage_usage[];
int cmd_filesystem_usage(int argc, char **argv);
-extern const char * const cmd_device_disk_usage_usage[];
-int cmd_device_disk_usage(int argc, char **argv);
+struct device_info {
+ u64 devid;
+ char path[BTRFS_DEVICE_PATH_NAME_MAX];
+ u64 size;
+};
+
+/*
+ * To store the size information about the chunks:
+ * the chunks info are grouped by the tuple (type, devid, num_stripes),
+ * i.e. if two chunks are of the same type (RAID1, DUP...), are on the
+ * same disk, have the same stripes then their sizes are grouped
+ */
+struct chunk_info {
+ u64 type;
+ u64 size;
+ u64 devid;
+ u64 num_stripes;
+};
+
+int load_device_info(int fd, struct device_info **device_info_ptr,
+ int *device_info_count);
+int load_chunk_info(int fd, struct chunk_info **info_ptr, int *info_count);
+char *df_pretty_sizes(u64 size, int mode);
+void print_device_chunks(int fd, u64 devid, u64 total_size,
+ struct chunk_info *chunks_info_ptr,
+ int chunks_info_count, int mode);
#endif