summaryrefslogtreecommitdiff
path: root/props.c
diff options
context:
space:
mode:
authorSatoru Takeuchi <satoru.takeuchi@gmail.com>2017-10-14 21:54:54 +0900
committerDavid Sterba <dsterba@suse.com>2017-11-14 15:59:00 +0100
commitdf11e2787b5b57ecdb313f2725dc5c9a5e549576 (patch)
tree8cd4fd0e94e6d862a578634abd36afe5a6f2d3fc /props.c
parent4a5b95abb620175ca6eb356ff8a7d698891fa8ab (diff)
btrfs-progs: allow "no" to disable compression for convenience
It's messy to use "" to disable compression. Introduce the new value "no" which can also be used for this purpose. Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com> [ coding style fixes ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'props.c')
-rw-r--r--props.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/props.c b/props.c
index a7e3e96b..94b43b40 100644
--- a/props.c
+++ b/props.c
@@ -142,10 +142,13 @@ static int prop_compression(enum prop_object_type type,
memcpy(xattr_name + XATTR_BTRFS_PREFIX_LEN, name, strlen(name));
xattr_name[XATTR_BTRFS_PREFIX_LEN + strlen(name)] = '\0';
- if (value)
+ if (value) {
+ if (strcmp(value, "no") == 0)
+ value = "";
sret = fsetxattr(fd, xattr_name, value, strlen(value), 0);
- else
+ } else {
sret = fgetxattr(fd, xattr_name, NULL, 0);
+ }
if (sret < 0) {
ret = -errno;
if (ret != -ENOATTR)