All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Hicks <mort@bork.org>
To: Andrew Vasquez <praka@users.sourceforge.net>, linux-scsi@vger.kernel.org
Subject: Re: Transport Attributes -- attempt#3
Date: Fri, 16 Jan 2004 11:40:03 -0500	[thread overview]
Message-ID: <20040116164003.GH27591@localhost> (raw)
In-Reply-To: <20040114233457.GA23840@praka.local.home>



On Wed, Jan 14, 2004 at 03:34:57PM -0800, Andrew Vasquez wrote:
> On Wed, 14 Jan 2004, Martin Hicks wrote:
> 
> > +
> > +/* the FiberChannel Tranport Attributes: */
> > +fc_transport_rd_attr_cast(node_name, "0x%llx\n", unsigned long long);
> > +fc_transport_rd_attr_cast(port_name, "0x%llx\n", unsigned long long);
> > +fc_transport_rd_attr(port_id, "0x%x\n");
> > +
> 
> Purely aesthetics : PortIDs are typically viewed as three hex bytes
> padded with zeros, i.e. 010203.  Perhaps this may be more appropriate:
> 
> 	fc_transport_rd_attr(port_id, "0x%06x\n");

Okay.  Will do.

> 
> [snip]
> > +	attrs = (struct fc_transport_attrs *)sdev->transport_attr_values;
> > +	list_for_each_entry(fc, &ha->fcports, list) {
> > +		if (fc->os_target_id == sdev->id) {
> > +			attrs->port_name = __be64_to_cpu(*(uint64_t *)fc->port_name);
> > +			attrs->node_name = __be64_to_cpu(*(uint64_t *)fc->node_name);
> > +			attrs->port_id = fc->d_id.b24;
> 
> This port_id assignment will not give you what you expect on
> big-endian machines.  Given the previous port_id example value
> (010203), on BE machines, the attribute will read as 030201 when
> displayed.  A more endian safe way if you want to continue with the
> pure-type usages (uint64_t/int) rather than byte arrays would be:
> 
> 	attrs->port_id = fc->d_id.b.domain << 16 |
> 		fc->d_id.b.area << 8 |
> 		fc->d_id.b.al_pa;

I'll fix that up.

Thanks,
mh

-- 
Martin Hicks || mort@bork.org || PGP/GnuPG: 0x4C7F2BEE

  reply	other threads:[~2004-01-16 16:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 18:54 Transport Attributes -- attempt#2 Martin Hicks
2004-01-08 13:17 ` Christoph Hellwig
2004-01-08 14:01   ` Martin Hicks
2004-01-08 14:11     ` James Bottomley
2004-01-14 18:12   ` Transport Attributes -- attempt#3 Martin Hicks
2004-01-14 23:34     ` Andrew Vasquez
2004-01-16 16:40       ` Martin Hicks [this message]
2004-01-17  0:23       ` Lincoln Dale
2004-01-14 23:58     ` Patrick Mansfield
2004-01-16 14:54     ` Christoph Hellwig
2004-01-16 16:54       ` Martin Hicks
2004-01-20  0:07     ` Brian King
2004-01-20 19:49       ` Patrick Mansfield
2004-01-20 20:38         ` Brian King
  -- strict thread matches above, loose matches on Subject: below --
2004-01-15 12:52 Martin Peschke3
2004-01-16 16:47 ` Martin Hicks
2004-01-20 12:29 Martin Peschke3
2004-01-20 23:20 Martin Peschke3
2004-01-20 23:45 ` Mike Anderson

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=20040116164003.GH27591@localhost \
    --to=mort@bork.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=praka@users.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.