Mark many functions as static, and remove any resulting dead code.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
return ret;
}
-struct btrfs_root *link_subvol(struct btrfs_root *root, const char *base,
- u64 root_objectid)
+static struct btrfs_root * link_subvol(struct btrfs_root *root,
+ const char *base, u64 root_objectid)
{
struct btrfs_trans_handle *trans;
struct btrfs_fs_info *fs_info = root->fs_info;
return ret;
}
-int do_convert(const char *devname, int datacsum, int packing, int noxattr)
+static int do_convert(const char *devname, int datacsum, int packing,
+ int noxattr)
{
int i, ret;
int fd = -1;
return -1;
}
-int do_rollback(const char *devname, int force)
+static int do_rollback(const char *devname, int force)
{
int fd = -1;
int ret;
"[ -g search_generation ] [ -l search_level ] <device>\n");
}
-int csum_block(void *buf, u32 len)
+static int csum_block(void *buf, u32 len)
{
char *result;
u32 crc = ~(u32)0;
struct rb_root root;
};
-struct {
+static struct {
char *name;
char *column_name;
int need_print;
free(comp_set);
}
-int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
- enum btrfs_list_comp_enum comparer,
- int is_descending)
+static int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
+ enum btrfs_list_comp_enum comparer, int is_descending)
{
struct btrfs_list_comparer_set *set = *comp_set;
int size;
* simple string builder, returning a new string with both
* dirid and name
*/
-char *build_name(char *dirid, char *name)
+static char *build_name(char *dirid, char *name)
{
char *full;
if (!dirid)
}
}
-int btrfs_list_subvols(int fd, struct root_lookup *root_lookup)
+static int btrfs_list_subvols(int fd, struct root_lookup *root_lookup)
{
int ret;
return 0;
}
-char *strdup_or_null(const char *s)
+static char *strdup_or_null(const char *s)
{
if (!s)
return NULL;
enum btrfs_list_filter_enum filter, u64 data);
struct btrfs_list_comparer_set *btrfs_list_alloc_comparer_set(void);
void btrfs_list_free_comparer_set(struct btrfs_list_comparer_set *comp_set);
-int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
- enum btrfs_list_comp_enum comparer,
- int is_descending);
int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set,
struct btrfs_list_comparer_set *comp_set,
* */
static FILE *info_file;
-struct extent_buffer *debug_read_block(struct btrfs_root *root, u64 bytenr,
- u32 blocksize, int copy)
+static struct extent_buffer * debug_read_block(struct btrfs_root *root,
+ u64 bytenr, u32 blocksize, int copy)
{
int ret;
struct extent_buffer *eb;
return cmd;
}
-void handle_help_options_next_level(const struct cmd_struct *cmd,
- int argc, char **argv)
+static void handle_help_options_next_level(const struct cmd_struct *cmd,
+ int argc, char **argv)
{
if (argc < 2)
return;
static char *device;
-int update_seeding_flag(struct btrfs_root *root, int set_flag)
+static int update_seeding_flag(struct btrfs_root *root, int set_flag)
{
struct btrfs_trans_handle *trans;
struct btrfs_super_block *disk_super;
return 0;
}
-int enable_extrefs_flag(struct btrfs_root *root)
+static int enable_extrefs_flag(struct btrfs_root *root)
{
struct btrfs_trans_handle *trans;
struct btrfs_super_block *disk_super;
return 0;
}
-int enable_skinny_metadata(struct btrfs_root *root)
+static int enable_skinny_metadata(struct btrfs_root *root)
{
struct btrfs_trans_handle *trans;
struct btrfs_super_block *disk_super;
return ret;
}
-void init_recover_control(struct recover_control *rc, int verbose, int yes)
+static void init_recover_control(struct recover_control *rc, int verbose,
+ int yes)
{
memset(rc, 0, sizeof(struct recover_control));
cache_tree_init(&rc->chunk);
rc->yes = yes;
}
-void free_recover_control(struct recover_control *rc)
+static void free_recover_control(struct recover_control *rc)
{
free_block_group_tree(&rc->bg);
free_chunk_cache_tree(&rc->chunk);
return 0;
}
-void print_qgroup_info(u64 objectid, struct btrfs_qgroup_info_item *info)
+static void print_qgroup_info(u64 objectid, struct btrfs_qgroup_info_item *info)
{
printf("%llu/%llu %lld %lld\n", objectid >> 48,
objectid & ((1ll << 48) - 1),
btrfs_stack_qgroup_info_exclusive(info));
}
-int list_qgroups(int fd)
+static int list_qgroups(int fd)
{
int ret;
struct btrfs_ioctl_search_args args;
NULL
};
-int quota_ctl(int cmd, int argc, char **argv)
+static int quota_ctl(int cmd, int argc, char **argv)
{
int ret = 0;
int fd;
}
-struct btrfs_send_ops send_ops = {
+static struct btrfs_send_ops send_ops = {
.subvol = process_subvol,
.snapshot = process_snapshot,
.mkfile = process_mkfile,
.utimes = process_utimes,
};
-int do_receive(struct btrfs_receive *r, const char *tomnt, int r_fd)
+static int do_receive(struct btrfs_receive *r, const char *tomnt, int r_fd)
{
int ret;
char *dest_dir_full_path;
return -1;
}
-int next_leaf(struct btrfs_root *root, struct btrfs_path *path)
+static int next_leaf(struct btrfs_root *root, struct btrfs_path *path)
{
int slot;
int level = 1;
return NULL;
}
-int mkdir_p(char *path)
+static int mkdir_p(char *path)
{
int i;
int ret;
#include "kerncompat.h"
#include "ioctl.h"
-unsigned long ioctls[] = {
+static unsigned long ioctls[] = {
BTRFS_IOC_SNAP_CREATE,
BTRFS_IOC_DEFRAG,
BTRFS_IOC_RESIZE,
#include "transaction.h"
/* for testing only */
-int next_key(int i, int max_key) {
+static int next_key(int i, int max_key) {
return rand() % max_key;
// return i;
}
return 0;
}
-struct btrfs_send_ops send_ops_print = {
+static struct btrfs_send_ops send_ops_print = {
.subvol = print_subvol,
.snapshot = print_snapshot,
.mkfile = print_mkfile,
}
/* checks if a device is a loop device */
-int is_loop_device (const char* device) {
+static int is_loop_device (const char* device) {
struct stat statbuf;
if(stat(device, &statbuf) < 0)
/* Takes a loop device path (e.g. /dev/loop0) and returns
* the associated file (e.g. /images/my_btrfs.img) */
-int resolve_loop_device(const char* loop_dev, char* loop_file, int max_len)
+static int resolve_loop_device(const char* loop_dev, char* loop_file,
+ int max_len)
{
int ret;
FILE *f;
/* Checks whether a and b are identical or device
* files associated with the same block device
*/
-int is_same_blk_file(const char* a, const char* b)
+static int is_same_blk_file(const char* a, const char* b)
{
struct stat st_buf_a, st_buf_b;
char real_a[PATH_MAX];
* if one file is a loop device that uses the other
* file.
*/
-int is_same_loop_file(const char* a, const char* b)
+static int is_same_loop_file(const char* a, const char* b)
{
char res_a[PATH_MAX];
char res_b[PATH_MAX];
}
/* Checks if a file exists and is a block or regular file*/
-int is_existing_blk_or_reg_file(const char* filename)
+static int is_existing_blk_or_reg_file(const char* filename)
{
struct stat st_buf;
/* Checks if a file is used (directly or indirectly via a loop device)
* by a device in fs_devices
*/
-int blk_file_in_dev_list(struct btrfs_fs_devices* fs_devices, const char* file)
+static int blk_file_in_dev_list(struct btrfs_fs_devices* fs_devices,
+ const char* file)
{
int ret;
struct list_head *head;
close(fd);
}
-int get_device_info(int fd, u64 devid,
- struct btrfs_ioctl_dev_info_args *di_args)
+static int get_device_info(int fd, u64 devid,
+ struct btrfs_ioctl_dev_info_args *di_args)
{
int ret;
* Checks if the swap device.
* Returns 1 if swap device, < 0 on error or 0 if not swap device.
*/
-int is_swap_device(const char *file)
+static int is_swap_device(const char *file)
{
FILE *f;
struct stat st_buf;
u64 parse_size(char *s);
int open_file_or_dir(const char *fname, DIR **dirstream);
void close_file_or_dir(int fd, DIR *dirstream);
-int get_device_info(int fd, u64 devid,
- struct btrfs_ioctl_dev_info_args *di_args);
int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args,
struct btrfs_ioctl_dev_info_args **di_ret);
int get_label(const char *btrfs_dev);
char *__strncpy__null(char *dest, const char *src, size_t n);
int is_block_device(const char *file);
int open_path_or_dev_mnt(const char *path, DIR **dirstream);
-int is_swap_device(const char *file);
u64 btrfs_device_size(int fd, struct stat *st);
/* Helper to always get proper size of the destination string */
#define strncpy_null(dest, src) __strncpy__null(dest, src, sizeof(dest))