forked from Mirrors/btrfs-progs
btrfs-progs: move parse_csum_type to utils
This will be used by convert. Signed-off-by: David Sterba <dsterba@suse.com>master
parent
78a3831d46
commit
65efb419a2
|
@ -762,6 +762,26 @@ err:
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum btrfs_csum_type parse_csum_type(const char *s)
|
||||||
|
{
|
||||||
|
if (strcasecmp(s, "crc32c") == 0) {
|
||||||
|
return BTRFS_CSUM_TYPE_CRC32;
|
||||||
|
} else if (strcasecmp(s, "xxhash64") == 0 ||
|
||||||
|
strcasecmp(s, "xxhash") == 0) {
|
||||||
|
return BTRFS_CSUM_TYPE_XXHASH;
|
||||||
|
} else if (strcasecmp(s, "sha256") == 0) {
|
||||||
|
return BTRFS_CSUM_TYPE_SHA256;
|
||||||
|
} else if (strcasecmp(s, "blake2b") == 0 ||
|
||||||
|
strcasecmp(s, "blake2") == 0) {
|
||||||
|
return BTRFS_CSUM_TYPE_BLAKE2;
|
||||||
|
} else {
|
||||||
|
error("unknown csum type %s", s);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* not reached */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int open_file_or_dir3(const char *fname, DIR **dirstream, int open_flags)
|
int open_file_or_dir3(const char *fname, DIR **dirstream, int open_flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -65,6 +65,7 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_bytes, unsigned unit_mo
|
||||||
#define pretty_size(size) pretty_size_mode(size, UNITS_DEFAULT)
|
#define pretty_size(size) pretty_size_mode(size, UNITS_DEFAULT)
|
||||||
const char *pretty_size_mode(u64 size, unsigned mode);
|
const char *pretty_size_mode(u64 size, unsigned mode);
|
||||||
|
|
||||||
|
enum btrfs_csum_type parse_csum_type(const char *s);
|
||||||
u64 parse_size(const char *s);
|
u64 parse_size(const char *s);
|
||||||
u64 parse_qgroupid(const char *p);
|
u64 parse_qgroupid(const char *p);
|
||||||
u64 arg_strtou64(const char *str);
|
u64 arg_strtou64(const char *str);
|
||||||
|
|
20
mkfs/main.c
20
mkfs/main.c
|
@ -388,26 +388,6 @@ static u64 parse_profile(const char *s)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum btrfs_csum_type parse_csum_type(const char *s)
|
|
||||||
{
|
|
||||||
if (strcasecmp(s, "crc32c") == 0) {
|
|
||||||
return BTRFS_CSUM_TYPE_CRC32;
|
|
||||||
} else if (strcasecmp(s, "xxhash64") == 0 ||
|
|
||||||
strcasecmp(s, "xxhash") == 0) {
|
|
||||||
return BTRFS_CSUM_TYPE_XXHASH;
|
|
||||||
} else if (strcasecmp(s, "sha256") == 0) {
|
|
||||||
return BTRFS_CSUM_TYPE_SHA256;
|
|
||||||
} else if (strcasecmp(s, "blake2b") == 0 ||
|
|
||||||
strcasecmp(s, "blake2") == 0) {
|
|
||||||
return BTRFS_CSUM_TYPE_BLAKE2;
|
|
||||||
} else {
|
|
||||||
error("unknown csum type %s", s);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
/* not reached */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *parse_label(const char *input)
|
static char *parse_label(const char *input)
|
||||||
{
|
{
|
||||||
int len = strlen(input);
|
int len = strlen(input);
|
||||||
|
|
Loading…
Reference in New Issue