- ret = ioctl(fd, BTRFS_IOC_SUBVOL_GETFLAGS, &flags);
- if (ret < 0) {
- ret = -errno;
- fprintf(stderr, "ERROR: failed to get flags for %s. %s\n",
- object, strerror(-ret));
- goto out;
- }
-
- if (!value) {
- if (flags & BTRFS_SUBVOL_RDONLY)
- fprintf(stdout, "ro=true\n");
- else
- fprintf(stdout, "ro=false\n");
- ret = 0;
- goto out;
- }
+ if (value) {
+ if (!strcmp(value, "true")) {
+ read_only = true;
+ } else if (!strcmp(value, "false")) {
+ read_only = false;
+ } else {
+ error("invalid value for property: %s", value);
+ return -EINVAL;
+ }