All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Daniel Wagner <dwagner@suse.de>
Cc: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>,
	Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Martin Belanger <nitram_67@hotmail.com>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH libnvme 2/1] nvme: Add generic connect parameter support detection
Date: Mon, 12 Sep 2022 15:32:01 +0300	[thread overview]
Message-ID: <b709468e-56ed-a7af-6556-7ddfc4c3fea7@grimberg.me> (raw)
In-Reply-To: <20220909065657.vnf6lzzfcs7y5nis@carbon.lan>


>> --- a/src/libnvme.map
>> +++ b/src/libnvme.map
>> @@ -352,6 +352,7 @@ LIBNVME_1_0 {
>>   		nvmf_treq_str;
>>   		nvmf_trtype_str;
>>   		nvmf_update_config;
>> +		nvmf_check_param_support;
> 
> New entries go to the 'unreleased' section, this would be LIBNVME_1_2.

OK.

>> +int nvmf_check_param_support(const char *param, bool *supported)
>> +{
> 
> I was wondering if t would be better to return all supported features in
> one go. Not really sure about it though.

Why? it is already held in the kernel, why hold it again?

>> +	int ret = 0, fd, len;
>> +	char buf[0x1000];
>> +
>> +	fd = open(nvmf_dev, O_RDWR);
>> +	if (fd < 0) {
>> +		nvme_msg(NULL, LOG_ERR, "Failed to open %s: %s\n",
>> +			 nvmf_dev, strerror(errno));
> 
> 'nvme_msg(NULL,' will always write to the stderr which is kind of bad
> for libraries. I think it would okay just to return the error codes in
> this function and have the caller do the logging part.

OK

> 
>> +		return -ENVME_CONNECT_OPEN;
>> +	}
>> +
>> +	memset(buf, 0x0, sizeof(buf));
>> +	len = read(fd, buf, sizeof(buf) - 1);
>> +	if (len < 0) {
>> +		nvme_msg(NULL, LOG_ERR, "Failed to read from %s: %s\n",
>> +			 nvmf_dev, strerror(errno));
>> +		ret = -ENVME_CONNECT_READ;
>> +		goto out_close;
>> +	}
>> +	nvme_msg(NULL, LOG_DEBUG, "supported opts: '%.*s'\n",
>> (int)strcspn(buf, "\n"), buf);
> 
> This triggered my question above why we don't return all supported
> features up and have the caller added something like this?

Why? the caller doesn't need the entire array, it is just looking
to check if a param is supported. We can move this out if someone
actually needs the entire string or set of caps...


  reply	other threads:[~2022-09-12 12:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 14:24 [PATCH rfc 0/1] Fix missing AENs when discovery controllers are disconnected Sagi Grimberg
2022-09-07 14:24 ` [PATCH rfc 1/1] fabrics: support notify_rediscover connect parameter Sagi Grimberg
2022-09-07 14:24 ` [PATCH libnvme 2/1] nvme: Add generic connect parameter support detection Sagi Grimberg
2022-09-09  6:56   ` Daniel Wagner
2022-09-12 12:32     ` Sagi Grimberg [this message]
2022-09-12 14:19       ` Daniel Wagner
2022-09-07 14:24 ` [PATCH libnvme 3/1] fabrics: add notify_rediscover parameter Sagi Grimberg
2022-09-09  6:58   ` Daniel Wagner
2022-09-12 12:33     ` Sagi Grimberg
2022-09-12 14:42       ` Daniel Wagner
2022-09-07 14:24 ` [PATCH nvme-cli 4/1] fabrics: re-read the discovery log page when a discovery controller reconnected Sagi Grimberg
2022-09-10 15:47 ` [PATCH rfc 0/1] Fix missing AENs when discovery controllers are disconnected James Smart
2022-09-12 12:39   ` Sagi Grimberg
2022-09-13  0:06     ` James Smart
2022-09-14 10:29       ` Sagi Grimberg
2022-09-14 15:00         ` James Smart
2022-09-14 15:31           ` Sagi Grimberg
2022-09-14 17:26             ` James Smart
2022-09-18 14:12               ` Sagi Grimberg

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=b709468e-56ed-a7af-6556-7ddfc4c3fea7@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=nitram_67@hotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.