Commit ceafe3cc authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

btrfs: sysfs: export supported rescue= mount options



We're going to be adding a variety of different rescue options, we
should advertise which ones we support to make user spaces life easier
in the future.

Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 334c16d8
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -329,10 +329,32 @@ static ssize_t send_stream_version_show(struct kobject *kobj,
}
BTRFS_ATTR(static_feature, send_stream_version, send_stream_version_show);

static const char *rescue_opts[] = {
	"usebackuproot",
	"nologreplay",
};

static ssize_t supported_rescue_options_show(struct kobject *kobj,
					     struct kobj_attribute *a,
					     char *buf)
{
	ssize_t ret = 0;
	int i;

	for (i = 0; i < ARRAY_SIZE(rescue_opts); i++)
		ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%s",
				 (i ? " " : ""), rescue_opts[i]);
	ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
	return ret;
}
BTRFS_ATTR(static_feature, supported_rescue_options,
	   supported_rescue_options_show);

static struct attribute *btrfs_supported_static_feature_attrs[] = {
	BTRFS_ATTR_PTR(static_feature, rmdir_subvol),
	BTRFS_ATTR_PTR(static_feature, supported_checksums),
	BTRFS_ATTR_PTR(static_feature, send_stream_version),
	BTRFS_ATTR_PTR(static_feature, supported_rescue_options),
	NULL
};