From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 8/9] nfs: switch to nfs3
Date: Fri, 7 Feb 2014 09:52:50 +0100 [thread overview]
Message-ID: <20140207085250.GE17045@pengutronix.de> (raw)
In-Reply-To: <20140207064857.GF9671@ns203013.ovh.net>
Hello Jean-Christophe,
On Fri, Feb 07, 2014 at 07:48:57AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:40 Thu 06 Feb , Uwe Kleine-K??nig wrote:
> > +#define ntohll(val) __be64_to_cpu(val)
> > +#define htonll(val) __cpu_to_be64(val)
>
> use the cpu_to and to_cpu directly
> as if we have the standard define in any header later this will cause issues
htonll isn't that standard. I doesn't exist neither in Linux userspace
nor in Linux kernel space. I would prefer to put the macro into a global
place already now. Or still better, define {ntoh,hton}{16,32,64} which
have a more intuitive naming scheme.
> > - printk("NFS: returned filename too long: %u\n", count);
> > + printf("%s: returned a too long filename: %u\n", __func__, count);
> can we use dev_xx for message
I will check where I can get my hands on a good struct device_d*.
> > +static uint32_t *nfs_add_fh3(uint32_t *p, unsigned fh_len, const char *fh)
> > +{
> > + *p++ = htonl(fh_len);
> > +
> > + /* zero padding */
> > + if (fh_len & 3)
> > + p[fh_len / 4] = 0;
> > +
> > + memcpy(p, fh, fh_len);
> > + p += DIV_ROUND_UP(fh_len, 4);
> > + return p;
> > +}
> > +
> > +static uint32_t *nfs_add_filename(uint32_t *p,
> > + uint32_t filename_len, const char *filename)
> > +{
> > + *p++ = htonl(filename_len);
> > +
> > + /* zero padding */
> > + if (filename_len & 3)
> > + p[filename_len / 4] = 0;
> > +
> > + memcpy(p, filename, filename_len);
> > + p += DIV_ROUND_UP(filename_len, 4);
> > + return p;
> > +}
> > +
> what is the difference with the function upper?
The function and parameter names and the type of the 2nd argument.
(OK, I guess that wasn't the answer you wanted to read. Yes, you're
right, they could use the same function. Something like nfs_add_string.
(Technically fh3 isn't a string<> but an opaque<NFS3_FHSIZE>, but that
doesn't really matter here. I will think a bit about proper naming.))
> > + npriv->rootfh_len = ntohl(net_read_uint32(p++));
> > + if (npriv->rootfh_len > NFS3_FHSIZE) {
> > + printf("%s: file handle too big: %lu\n", __func__,
> > + (unsigned long)npriv->rootfh_len);
> > + return -EIO;
> really EIO?
That's a protocol error and -EIO is what is returned in other places for
protocol errors, too. Still if you have a better suggestion ...
> > - ret = rpc_lookup_req(npriv, PROG_NFS, 2);
> > + ret = rpc_lookup_req(npriv, PROG_NFS, 3);
>
> so we loose nfs2?
Right. Do you consider it a loss? I don't think it worth to implement
both side by side.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-02-07 8:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 16:40 [PATCH 0/9] nfs3 support Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 1/9] net: net_read_uint32: assert that only 32 bit are read Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 2/9] nfs: skip over stale rpc packets Uwe Kleine-König
2014-02-07 8:20 ` Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 3/9] nfs: shorten and simplify rpc_add_credentials a bit Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 4/9] nfs: simplify rpc_lookup_req Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 5/9] nfs: drop an unneeded variable from nfs_do_open() Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 6/9] net: new function net_read_uint64 Uwe Kleine-König
2014-02-07 8:17 ` Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 7/9] mount: support filesystem options passed via -o Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 8/9] nfs: switch to nfs3 Uwe Kleine-König
2014-02-07 6:48 ` Jean-Christophe PLAGNIOL-VILLARD
2014-02-07 8:52 ` Uwe Kleine-König [this message]
2014-02-07 9:50 ` Jean-Christophe PLAGNIOL-VILLARD
2014-02-07 10:23 ` Uwe Kleine-König
2014-02-06 16:40 ` [PATCH 9/9] nfs: parse nfsport and mount port from file system options Uwe Kleine-König
2014-02-07 6:50 ` Jean-Christophe PLAGNIOL-VILLARD
2014-02-07 8:22 ` Uwe Kleine-König
2014-02-07 8:45 ` Jean-Christophe PLAGNIOL-VILLARD
2014-02-07 10:06 ` Uwe Kleine-König
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=20140207085250.GE17045@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.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