btrfs-progs: move get_subvol_name() to utils.c
Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0f9a5cf70c
commit
8cec21a7ed
11
cmds-send.c
11
cmds-send.c
|
@ -335,17 +335,6 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_subvol_name(char *mnt, char *full_path)
|
|
||||||
{
|
|
||||||
int len = strlen(mnt);
|
|
||||||
if (!len)
|
|
||||||
return full_path;
|
|
||||||
if (mnt[len - 1] != '/')
|
|
||||||
len += 1;
|
|
||||||
|
|
||||||
return full_path + len;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int init_root_path(struct btrfs_send *s, const char *subvol)
|
static int init_root_path(struct btrfs_send *s, const char *subvol)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
12
utils.c
12
utils.c
|
@ -3159,3 +3159,15 @@ int test_issubvolume(const char *path)
|
||||||
|
|
||||||
return (int)stfs.f_type == BTRFS_SUPER_MAGIC;
|
return (int)stfs.f_type == BTRFS_SUPER_MAGIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *get_subvol_name(char *mnt, char *full_path)
|
||||||
|
{
|
||||||
|
int len = strlen(mnt);
|
||||||
|
if (!len)
|
||||||
|
return full_path;
|
||||||
|
|
||||||
|
if (mnt[len - 1] != '/')
|
||||||
|
len += 1;
|
||||||
|
|
||||||
|
return full_path + len;
|
||||||
|
}
|
||||||
|
|
2
utils.h
2
utils.h
|
@ -197,6 +197,8 @@ int test_issubvolname(const char *name);
|
||||||
int test_issubvolume(const char *path);
|
int test_issubvolume(const char *path);
|
||||||
int test_isdir(const char *path);
|
int test_isdir(const char *path);
|
||||||
|
|
||||||
|
char *get_subvol_name(char *mnt, char *full_path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Btrfs minimum size calculation is complicated, it should include at least:
|
* Btrfs minimum size calculation is complicated, it should include at least:
|
||||||
* 1. system group size
|
* 1. system group size
|
||||||
|
|
Loading…
Reference in New Issue