public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH 1/2] scsi: sd: Separate zeroout and discard command choices
Date: Tue, 11 Apr 2017 21:04:17 -0400	[thread overview]
Message-ID: <yq1d1civ3la.fsf@oracle.com> (raw)
In-Reply-To: <1491589694.2559.16.camel@sandisk.com> (Bart Van Assche's message of "Fri, 7 Apr 2017 18:28:15 +0000")

Bart Van Assche <Bart.VanAssche@sandisk.com> writes:

Bart,

> characters then zeroing_mode_show() will truncate it. Since all
> strings in the zeroing_mode[] array are short, have you considered to
> use sprintf() instead? And if you do not want to use sprintf(), how
> about using snprintf(buf, PAGE_SIZE, ...)? I'm asking this because I'm
> no fan of magic constants.

Yeah, this was just a copy and paste from the provisioning code.

> Since sysfs guarantees that buf is '\0'-terminated, why does the above
> function call strncmp() instead of strcmp()?
>
> Can the above chain of if-statements be replaced by a for-loop such that
> zeroing_mode_store() won't have to be updated if the zeroing_mode[] array
> is modified?

I have a patch that converts sd.c to sysfs_match_string(). That's much
cleaner but will have to wait until the latter gets merged.

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2017-04-12  1:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 11:41 [PATCH 1/2] scsi: sd: Separate zeroout and discard command choices Martin K. Petersen
2017-04-05 11:41 ` [PATCH 2/2] scsi: sd: Remove LBPRZ dependency for discards Martin K. Petersen
2017-04-07 18:36   ` Bart Van Assche
2017-04-07 18:28 ` [PATCH 1/2] scsi: sd: Separate zeroout and discard command choices Bart Van Assche
2017-04-12  1:04   ` Martin K. Petersen [this message]
2017-04-07 19:59 ` Bart Van Assche
2017-04-10  7:13   ` hch

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=yq1d1civ3la.fsf@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    /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