netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Love, Robert W" <robert.w.love@intel.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"bprakash@broadcom.com" <bprakash@broadcom.com>,
	"devel@open-fcoe.org" <devel@open-fcoe.org>
Subject: Re: [RFC PATCH 1/5] libfcoe, fcoe: Allow user to set a ctlr's mode
Date: Wed, 12 Sep 2012 19:24:37 +0000	[thread overview]
Message-ID: <5050E174.2070200@intel.com> (raw)
In-Reply-To: <504ED16D.5080607@acm.org>

On Mon 10 Sep 2012 10:51:41 PM PDT, Bart Van Assche wrote:
> On 09/11/12 00:59, Robert Love wrote:
>> +static enum fip_conn_type fcoe_parse_mode(const char *buf,
>> +				  const struct fcoe_ctlr_mode_table *tbl)
>> +{
>> +	int modeint = -1, i, rv;
>> +	char *p, modestr[FCOE_MAX_MODENAME_LEN + 1] = { 0, };
>> +
>> +	for (p = (char *)buf; *p; p++)
>> +		if (!(isdigit(*p) || isspace(*p)))
>> +			break;
>
> If you change the declaration of p from "char *p" into "const char *p"
> you won't need a cast in the above for loop.
>
> [ ... ]
>
>> -static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO,
>> -			show_ctlr_mode, NULL);
>> +
>> +static ssize_t store_ctlr_mode(struct device *dev,
>> +			       struct device_attribute *attr,
>> +			       const char *buf, size_t count)
>> +{
>> +	struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
>> +
>> +	if (!ctlr->f->set_fcoe_ctlr_mode)
>> +		return -EINVAL;
>> +
>> +	ctlr->mode = fcoe_parse_mode(buf, ctlr_mode_tbl);
>
> As far as I know sysfs doesn't terminate buf with a '\0' before calling
> a store method. Does that mean that you are passing a string that is not
> '\0'-terminated to a function that expects a '\0'-terminated string ?
>
> Bart.

Hey Bart. I just wanted to acknowledge your comments. I will make sure 
that they're addressed after figuring out if sysfs is the right place 
for the interfaces.

Thanks, //Rob

  reply	other threads:[~2012-09-12 19:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10 22:59 [RFC PATCH 0/5] Reorganize libfcoe control interfaces Robert Love
2012-09-10 22:59 ` [RFC PATCH 1/5] libfcoe, fcoe: Allow user to set a ctlr's mode Robert Love
2012-09-10 23:12   ` Greg KH
2012-09-11  5:51   ` Bart Van Assche
2012-09-12 19:24     ` Love, Robert W [this message]
2012-09-10 22:59 ` [RFC PATCH 2/5] libfcoe: Create new libfcoe control interfaces Robert Love
2012-09-14  7:06   ` Bhanu Prakash Gollapudi
2012-09-10 22:59 ` [RFC PATCH 3/5] fcoe: Use new fcoe_sysfs control interface Robert Love
2012-09-10 22:59 ` [RFC PATCH 4/5] bnx2fc: " Robert Love
2012-09-14  7:28   ` Bhanu Prakash Gollapudi
2012-09-10 22:59 ` [RFC PATCH 5/5] libfcoe, fcoe: Remove libfcoe module parameters Robert Love
2012-09-11  0:05 ` [RFC PATCH 0/5] Reorganize libfcoe control interfaces Bhanu Prakash Gollapudi
2012-09-11  1:41   ` Love, Robert W
2012-09-11  5:46     ` Bhanu Prakash Gollapudi
2012-09-11 17:12   ` Chris Leech
2012-09-11 17:43     ` Love, Robert W
2012-09-11 17:06 ` Chris Leech
2012-09-11 17:36   ` Love, Robert W
2012-09-11 17:46     ` [Open-FCoE] " Love, Robert W
2012-09-11 18:31     ` Bhanu Prakash Gollapudi
2012-09-11 18:47       ` Love, Robert W
     [not found]     ` <504F76A1.50809-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-09-12 19:35       ` Love, Robert W

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=5050E174.2070200@intel.com \
    --to=robert.w.love@intel.com \
    --cc=bprakash@broadcom.com \
    --cc=bvanassche@acm.org \
    --cc=devel@open-fcoe.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).