From: Doug Maxey <dwm@enoyolf.org>
To: Greg KH <greg@kroah.com>
Cc: Konrad Rzeszutek <konrad@darnok.org>,
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 22:12:53 -0600 [thread overview]
Message-ID: <11870.1196136773@bebe.enoyolf.org> (raw)
In-Reply-To: <20071127033138.GB30770@kroah.com>
On Mon, 26 Nov 2007 19:31:38 PST, 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)
> > +{
> > + struct ibft_initiator *initiator = attr->initiator;
> > + void *ibft_loc = entry->data->hdr;
> > + char *str = buf;
> > +
> > + if (!initiator)
> > + return 0;
> > +
> > + str += sprintf_ipaddr(str, "isns", initiator->isns_server);
> > + str += sprintf_ipaddr(str, "slp", initiator->slp_server);
> > + str += sprintf_ipaddr(str, "primary_radius_server",
> > + initiator->pri_radius_server);
> > + str += sprintf_ipaddr(str, "secondary_radius_server",
> > + initiator->sec_radius_server);
> > + str += sprintf_string(str, "itname", initiator->initiator_name_len,
> > + (char *)ibft_loc + initiator->initiator_name_off);
> > + str--;
> > +
> > + return str-buf;
> > +}
>
> sysfs files have ONE VALUE PER FILE, not a whole bunch of different
> things in a single file. Please fix this.
The subparameters _are_ actually part of a single value, that value being
associated with the initiator instance.
Konrad is trying to implement a "work-alike" for what open firmware does.
open-iscsi already has the ability to extract the same format
bits from real OFW.
See open-iscsi.git/utils/fwparam_ppc.
>
>
> > +
> > +ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
> > + struct ibft_attribute *attr,
> > + char *buf)
> > +{
> > + struct ibft_nic *nic = attr->nic;
> > + void *ibft_loc = entry->data->hdr;
> > + char *str = buf;
> > +
> > + if (!nic)
> > + return 0;
> > + /*
> > + * Assume dhcp if any non-zero portions of its address are set.
> > + */
> > + if (memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) {
> > + str += sprintf_ipaddr(str, "dhcp", nic->dhcp);
> > + } else {
> > + str += sprintf_ipaddr(str, "ciaddr", nic->ip_addr);
> > + str += sprintf_ipaddr(str, "giaddr", nic->gateway);
> > + str += sprintf_ipaddr(str, "dnsaddr1", nic->primary_dns);
> > + str += sprintf_ipaddr(str, "dnsaddr2", nic->secondary_dns);
> > + }
> > + if (nic->hostname_len)
> > + str += sprintf_string(str, "hostname", nic->hostname_len,
> > + (char *)ibft_loc + nic->hostname_off);
> > + /* Cut off the comma. */
> > + str--;
> > +
> > + return str-buf;
> > +}
>
> Same here.
>
> > +ssize_t ibft_attr_show_target(struct ibft_kobject *entry,
> > + struct ibft_attribute *attr,
> > + char *buf)
> > +{
> > + struct ibft_tgt *tgt = attr->tgt;
> > + void *ibft_loc = entry->data->hdr;
> > + char *str = buf;
> > + int i;
> > +
> > + if (!tgt)
> > + return 0;
> > +
> > + str += sprintf_ipaddr(str, "siaddr", tgt->ip_addr);
> > + str += sprintf(str, "iport=%d,", tgt->port);
> > + str += sprintf(str, "ilun=");
> > + for (i = 0; i < 8; i++)
> > + str += sprintf(str, "%x", (u8)tgt->lun[i]);
> > + str += sprintf(str, ",");
> > +
> > + if (tgt->tgt_name_len)
> > + str += sprintf_string(str, "iname", tgt->tgt_name_len,
> > + (void *)ibft_loc + tgt->tgt_name_off);
> > +
> > + if (tgt->chap_name_len)
> > + str += sprintf_string(str, "chapid", tgt->chap_name_len,
> > + (char *)ibft_loc + tgt->chap_name_off);
> > + if (tgt->chap_secret_len)
> > + str += sprintf_string(str, "chappw", tgt->chap_secret_len,
> > + (char *)ibft_loc + tgt->chap_secret_off);
> > + if (tgt->rev_chap_name_len)
> > + str += sprintf_string(str, "ichapid", tgt->rev_chap_name_len,
> > + (char *)ibft_loc + tgt->rev_chap_name_off);
> > + if (tgt->rev_chap_secret_len)
> > + str += sprintf_string(str, "ichappw", tgt->rev_chap_secret_len,
> > + (char *)ibft_loc + tgt->rev_chap_secret_off);
> > +
> > + /* Cut off the comma. */
> > + str--;
> > +
> > + return str-buf;
> > +}
>
> Same here, are we writing a novella or something to userspace? :)
Yep. Just like real OFW.
>
> > +ssize_t ibft_attr_show_disk(struct ibft_kobject *dev,
> > + struct ibft_attribute *ibft_attr,
> > + char *buf)
> > +{
> > + char *str = buf;
> > +
> > + str += sprintf(str, "//ethernet@0,%d:iscsi,", dev->data->index);
> > + str += ibft_attr_show_initiator(dev, ibft_attr, str);
> > + str += sprintf(str, ",");
> > + str += ibft_attr_show_target(dev, ibft_attr, str);
> > + str += sprintf(str, ",");
> > + str += ibft_attr_show_nic(dev, ibft_attr, str);
> > +
> > + return str-buf;
> > +}
>
> And here, do I need to go on?
>
> > +ssize_t ibft_attr_show_mac(struct ibft_kobject *entry,
> > + struct ibft_attribute *attr,
> > + char *buf)
> > +{
> > + struct ibft_nic *nic = attr->nic;
> > + int len = 6;
> > +
> > + if (!nic)
> > + return 0;
> > +
> > + memcpy(buf, attr->nic->mac, len);
> > +
> > + return len;
> > +}
>
> Is mac a user readable string?
Nope. The actual value in OFW is u8[6] in BE. Again, this all input
for the fwparam_ppc parser.
++doug
next prev parent reply other threads:[~2007-11-27 5:09 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 [this message]
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
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=11870.1196136773@bebe.enoyolf.org \
--to=dwm@enoyolf.org \
--cc=dwm@austin.ibm.com \
--cc=greg@kroah.com \
--cc=hpa@zytor.com \
--cc=konrad@darnok.org \
--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
Powered by JetHome