Re: [PATCH] btrfs-progs: detect zoned disks and prevent their raw use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 15, 2018 at 01:59:37PM -0700, Luis R. Rodriguez wrote:
> +static int is_zoned_disk(char *file)
> +{
> +	char str[PATH_MAX];
> +	char *devname = basename(file);
> +	FILE *f;
> +	int len;
> +
> +	len = snprintf(str, sizeof(str), "/sys/block/%s/queue/zoned", devname);
> +
> +	/* Indicates truncation */
> +	if (len >= PATH_MAX) {
> +		errno = ENAMETOOLONG;
> +		return -1;
> +	}
> +
> +	f = fopen(str, "r");
> +	if (!f)
> +		return 0;
> +
> +	fclose(f);
> +
> +	return 1;
> +}
> +

Seems this needs to be extended to ensure this is host-managed only, will spin
a v2 later.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux