mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Rzeszutek <konrad@darnok.org>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, pjones@redhat.com,
	konradr@redhat.com, konradr@linux.vnet.ibm.com,
	randy.dunlap@oracle.com, hpa@zytor.com, lenb@kernel.org,
	mike.anderson@us.ibm.com, dwm@austin.ibm.com
Subject: Re: [PATCH] Add iSCSI IBFT Support (v0.3)
Date: Mon, 26 Nov 2007 23:23:31 -0500	[thread overview]
Message-ID: <200711262323.35416.konrad@darnok.org> (raw)
In-Reply-To: <20071127033138.GB30770@kroah.com>

On Monday 26 November 2007 22:31:38 Greg KH wrote:
> On Mon, Nov 26, 2007 at 06:56:42PM -0400, Konrad Rzeszutek wrote:
> > +/*
> > + *  Routines for reading of the iBFT data in a human readable fashion.
> > + */
> > +ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry,
> > +				 struct ibft_attribute *attr,
> > +				 char *buf)
> > +{
.. snip..
> > +
> > +	str += sprintf_ipaddr(str, "isns", initiator->isns_server);
> > +	str += sprintf_ipaddr(str, "slp", initiator->slp_server);
.. snip ..
>
> sysfs files have ONE VALUE PER FILE, not a whole bunch of different
> things in a single file.  Please fix this.

No problem. I will have that shortly posted.

>
> > +
> > +ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
> > +			   struct ibft_attribute *attr,
> > +			   char *buf)
.. snip.. 
> > +		str += sprintf_ipaddr(str, "giaddr", nic->gateway);
> > +		str += sprintf_ipaddr(str, "dnsaddr1", nic->primary_dns);
>
> Same here.

Yup. 
>
> > +ssize_t ibft_attr_show_target(struct ibft_kobject *entry,
> > +			      struct ibft_attribute *attr,
> > +			      char *buf)
> > +{
.. snip..
> > +}
>
> Same here, are we writing a novella or something to userspace?  :)

Hehe.. I will make it simpler :-)

>
> > +ssize_t ibft_attr_show_disk(struct ibft_kobject *dev,
> > +			    struct ibft_attribute *ibft_attr,
> > +			    char *buf)
> > +{
.. snip ..
> > +}
>
> And here, do I need to go on?

I will have a new version posted quite shortly.

>
> > +ssize_t ibft_attr_show_mac(struct ibft_kobject *entry,
> > +			   struct ibft_attribute *attr,
> > +			   char *buf)
> > +{
..snip..
> > +
> > +	memcpy(buf, attr->nic->mac, len);
> > +
> > +	return len;
> > +}
>
> Is mac a user readable string?  Then perhaps a simple sprintf would work
> instead, as I doubt you are including a \n here...

It was meant to be as a binary value. But that doesn't fit in sysfs directory, 
so let me make it use sprintf here.

>
> > +/*
> > + * The main routine which allows the user to read the IBFT data.
> > + */
> > +static ssize_t ibft_show_attribute(struct kobject *kobj,
> > +				   struct attribute *attr,
> > +				   char *buf)
> > +{
..snip..
> > +
> > +static struct sysfs_ops ibft_attr_ops = {
> > +	.show = ibft_show_attribute,
> > +};
>
> I think this whole mess can go away in the new rework Kay and I have
> done, please document this whole thing and I'll see what I can do.

Absolutely.

>
> > +struct ibft_control {
> > +    struct ibft_hdr hdr;
> > +    u16 extensions;
> > +    u16 initiator_off;
> > +    u16 nic0_off;
> > +    u16 tgt0_off;
> > +    u16 nic1_off;
> > +    u16 tgt1_off;
> > +} __attribute__((__packed__));
>
> Did we loose tabs for some reason?  I'm guessing your editor is not
> showing them properly, nor did you use scripts/checkpatch.pl :(

I did use checkpatch.pl v0.99 downloaded somewhere from the web. I hadn't
realized it was now residing in scripts/checkpatch.pl - and from now on I will 
use that.

>
> > +#if defined(CONFIG_ISCSI_IBFT) || defined(CONFIG_ISCSI_IBFT_MODULE)
..snip..
> > +static ssize_t find_ibft(void)
> > +{
..snip..
> > +}
>
> What is a function (not even an inline one) doing in a .h file?

I was not sure where to put it. This function (find_ibft) is used by the 
setup_[32|64].c and the iscsi_ibft.c code. Randy suggested I put in .c file, 
but I am not sure exactly where? Should I make a new file in called 
libs/iscsi_ibft_helper.c ?

>
..snip..
> > +struct ibft_kobject {
> > +	struct ibft_data *data;
> > +	char name[IBFT_ISCSI_KOBJECT_MAX_LEN];
>
> Why have this,
>
> > +	u8 type;
> > +	struct kobject kobj;
>
> When the kobject itself has an unlimited size name associated with it?

Absolutely no reason at all. It was a evolution vestige of the code that is
not needed anymore. 

>
..snip..
> > +	char name[IBFT_ISCSI_ATTR_MAX_LEN];
>
> Same here, an attribute already has a pointer to a name, no need to have
> another one in the same structure.

Thanks. Will remove it.
>
> > +	struct list_head node;
> > +};
>
> thanks,

Thank you for taking your time to review the code. I will have the new
version out shortly.
>
> greg k-h



  parent reply	other threads:[~2007-11-27  4:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 22:56 Konrad Rzeszutek
2007-11-26 23:53 ` Randy Dunlap
2007-11-27  4:23   ` Konrad Rzeszutek
2007-11-27  3:23 ` Greg KH
2007-11-27  3:31 ` Greg KH
2007-11-27  4:12   ` Doug Maxey
2007-11-27  4:50     ` Konrad Rzeszutek
2007-11-27  5:28       ` Greg KH
2007-11-27 23:06       ` Arjan van de Ven
2007-11-29 15:36         ` darnok
2007-12-05  0:39           ` Konrad Rzeszutek
2007-11-27  4:23   ` Konrad Rzeszutek [this message]
2007-11-27  5:29     ` Greg KH
2007-11-27 18:09       ` darnok
2007-11-27 19:09         ` Greg KH
2007-11-28 19:21           ` darnok
2007-11-28 19:45             ` Greg KH
2007-11-28 20:24               ` darnok
2007-11-28 20:33                 ` Greg KH

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=200711262323.35416.konrad@darnok.org \
    --to=konrad@darnok.org \
    --cc=dwm@austin.ibm.com \
    --cc=greg@kroah.com \
    --cc=hpa@zytor.com \
    --cc=konradr@linux.vnet.ibm.com \
    --cc=konradr@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.anderson@us.ibm.com \
    --cc=pjones@redhat.com \
    --cc=randy.dunlap@oracle.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

all inboxes | Powered by JetHome®