2007-07-20 02:21:28

by NeilBrown

[permalink] [raw]
Subject: Re: [PATCH 013 of 20] knfsd: nfsd: factor out code from show_expflags

On Thursday July 19, [email protected] wrote:
> On Thu, Jul 19, 2007 at 10:16:14AM +1000, Neil Brown wrote:
> > On Wednesday July 18, [email protected] wrote:
> > > OK, here I'm still confused--what should we be doing instead?
> >
> > Cast the variable to a type that printf knows about.
> > seq_printf(m, ",anonuid=%d", (int)anonu);
> >
> > Or maybe cast it to (long) and use %ld, just in case...
>
> OK. In the event that uid_t some day ceases to eventually become an
> int, will the casts help, or will they just suppress useful warnings?

Probably not. Just leave it as it is.

>
> > Note the stray 's' in the current patch, after the comma!
>
> Sharp eyes, thanks! I'll make a patch. Uh, any objection if I print
> all those uid's as unsigned while I'm at it?

I wondered about that too. I think we have completely removed the
fiction that 'nobody' is '-2' rather than '65534' so it should be both
safe and sensible to make them unsigned.

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2007-07-20 04:22:47

by Satyam Sharma

[permalink] [raw]
Subject: Re: [PATCH 013 of 20] knfsd: nfsd: factor out code from show_expflags

On 7/20/07, Neil Brown <[email protected]> wrote:
> On Thursday July 19, [email protected] wrote:
> > On Thu, Jul 19, 2007 at 10:16:14AM +1000, Neil Brown wrote:
> > > On Wednesday July 18, [email protected] wrote:
> > > > OK, here I'm still confused--what should we be doing instead?
> > >
> > > Cast the variable to a type that printf knows about.
> > > seq_printf(m, ",anonuid=%d", (int)anonu);
> > >
> > > Or maybe cast it to (long) and use %ld, just in case...
> >
> > OK. In the event that uid_t some day ceases to eventually become an
> > int, will the casts help, or will they just suppress useful warnings?
>
> Probably not. Just leave it as it is.
>
> >
> > > Note the stray 's' in the current patch, after the comma!
> >
> > Sharp eyes, thanks! I'll make a patch. Uh, any objection if I print
> > all those uid's as unsigned while I'm at it?
>
> I wondered about that too. I think we have completely removed the
> fiction that 'nobody' is '-2' rather than '65534' so it should be both
> safe and sensible to make them unsigned.

Ummm ... sorry for butting in here :-) But uid_t is always unsigned, yes.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2007-07-20 22:18:15

by J. Bruce Fields

[permalink] [raw]
Subject: [PATCH] knfsd: Fix typo in export display, print uid and gid as unsigned

From: J. Bruce Fields <[email protected]>

For display purposes, treat uid's and gid's as unsigned ints for now.
Also fix a typo.

Signed-off-by: "J. Bruce Fields" <[email protected]>
---
fs/nfsd/export.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

On Fri, Jul 20, 2007 at 12:21:16PM +1000, Neil Brown wrote:
> On Thursday July 19, [email protected] wrote:
> > Sharp eyes, thanks! I'll make a patch. Uh, any objection if I print
> > all those uid's as unsigned while I'm at it?
>
> I wondered about that too. I think we have completely removed the
> fiction that 'nobody' is '-2' rather than '65534' so it should be both
> safe and sensible to make them unsigned.

OK! Here's what I've got.--b.

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 6ab8de4..2d295dd 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1503,9 +1503,9 @@ static void exp_flags(struct seq_file *m, int flag, int fsid,
if (flag & NFSEXP_FSID)
seq_printf(m, ",fsid=%d", fsid);
if (anonu != (uid_t)-2 && anonu != (0x10000-2))
- seq_printf(m, ",sanonuid=%d", anonu);
+ seq_printf(m, ",anonuid=%u", anonu);
if (anong != (gid_t)-2 && anong != (0x10000-2))
- seq_printf(m, ",sanongid=%d", anong);
+ seq_printf(m, ",anongid=%u", anong);
if (fsloc && fsloc->locations_count > 0) {
char *loctype = (fsloc->migrated) ? "refer" : "replicas";
int i;
--
1.5.3.rc2