From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: linux-btrfs@vger.kernel.org, snitzer@redhat.com, hare@suse.de,
axboe@kernel.dk, mwilck@suse.com,
Damien Le Moal <damien.lemoal@wdc.com>,
Bart Van Assche <Bart.VanAssche@wdc.com>
Subject: Re: [PATCH] btrfs-progs: detect zoned disks and prevent their raw use
Date: Fri, 15 Jun 2018 23:06:23 +0200 [thread overview]
Message-ID: <20180615210623.GQ5527@wotan.suse.de> (raw)
In-Reply-To: <20180615205937.8192-1-mcgrof@kernel.org>
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
prev parent reply other threads:[~2018-06-15 21:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-15 20:59 [PATCH] btrfs-progs: detect zoned disks and prevent their raw use Luis R. Rodriguez
2018-06-15 21:06 ` Luis R. Rodriguez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180615210623.GQ5527@wotan.suse.de \
--to=mcgrof@kernel.org \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=hare@suse.de \
--cc=linux-btrfs@vger.kernel.org \
--cc=mwilck@suse.com \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox