Message ID | 87poaqyxdi.wl-satoru.takeuchi@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 17 September 2017 at 01:36, Satoru Takeuchi <satoru.takeuchi@gmail.com> wrote: > It's messy to use "" to disable compression. Introduce the new value "no" > which can also be used for this purpose. From an English language point of view, "none" would be better. None says the absence of, where as no is more general negative. Mike -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/btrfs-property.asciidoc b/Documentation/btrfs-property.asciidoc index 7ed6a7d..97b90d6 100644 --- a/Documentation/btrfs-property.asciidoc +++ b/Documentation/btrfs-property.asciidoc @@ -43,7 +43,7 @@ read-only flag of subvolume: true or false label:::: label of device compression:::: -compression setting for an inode: lzo, zlib, zstd, or "" (empty string) +compression setting for an inode: lzo, zlib, zstd, no, or "" (empty string). Both no and "" are for disabling compression. *list* [-t <type>] <object>:: Lists available properties with their descriptions for the given object. diff --git a/props.c b/props.c index a7e3e96..a2df868 100644 --- a/props.c +++ b/props.c @@ -142,9 +142,11 @@ 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")) + value = ""; sret = fsetxattr(fd, xattr_name, value, strlen(value), 0); - else + } else sret = fgetxattr(fd, xattr_name, NULL, 0); if (sret < 0) { ret = -errno;
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> --- Documentation/btrfs-property.asciidoc | 2 +- props.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)