Re: [PATCH 1/2] scsi: sd: Separate zeroout and discard command choices

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

 



Bart Van Assche <Bart.VanAssche@xxxxxxxxxxx> 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux