About this list Date view Thread view Subject view Author view Attachment view

From: Herbert Poetzl (herbert_at_13thfloor.at)
Date: Mon 29 Mar 2004 - 15:29:05 BST


On Mon, Mar 29, 2004 at 03:47:00PM +0200, Lars Braeuer wrote:
> Herbert Poetzl wrote:
> >On Mon, Mar 29, 2004 at 01:58:57PM +0200, Lars Braeuer wrote:
> >
> >>Herbert Poetzl wrote:
> >>
> >>>>What would be the right formula for reassembling the id's for vs1.27 +
> >>>>quota?
> >>>
> >>>
> >>>currently the best format would probably be UID24/GID24
> >>>
> >>>#define XIDINO_UID(uid, xid) (((uid) & 0xFFFFFF) | (((xid) & 0xFF00)
> >>><< 16))
> >>>#define XIDINO_GID(gid, xid) (((gid) & 0xFFFFFF) | (((xid) & 0x00FF)
> >>><< 24))
> >>>
> >>>which basically means that the upper 8 bit of (16 bit) xid
> >>>go into the upper 8 bit of the (32 bit) uid, and the lower
> >>>8 bit of the xid, into the upper 8 bit of the (32 bit) gid
> >>>
> >>>but probably simpler would be the transition to UID32/GID16
> >>>because in this setup, you only have to mask the 'old' uid
> >>>to 16 bit, and leave the gid untouched ...
> >>
> >>You mean the uid will remain untouched, since the xid goes
> >>into the upper 16 bit of the gid, correct or am I making a
> >>mistake here?
> >
> >
> >no, in the old format, both uid and gid contain redundant
> >information, where GID16 is equivalent for gid, it doesn't
> >touch the uid, so removing the upper 16 bit from the uid
> >would be sufficient, which might be easier than getting all
> >the math right ...
>
> Ah ok, I understand.
>
> >>Well if UID24/GID24 is the recommended format, then converting
> >>both values (uid/gid) should be as easy as converting a single
> >>one (gid), I hope. ;)
> >
> >
> >well, you have to split up the xid, combine the parts with
> >the uid/gid, and store both back, where in the other case,
> >a masking of the uid to 16 bit is sufficient, YMMV
>
> Isn't this done by supplying uid and xid to XIDINO_UID?
> The function then returns a formatted uid, right?
>
> Another question about the CONFIG_INOXID_GID24 part in vxid.h:
> Why is it "<< 16", wouldn't this store the first 8 bit of the xid in the
> upper 16 bit of the uid leaving the last 8 bit unused?
>
> #define XIDINO_UID(uid, xid) (((uid) & 0xFFFFFF) |
> (((xid) & 0xFF00) << 16))
> #define XIDINO_GID(gid, xid) (((gid) & 0xFFFFFF) |
> (((xid) & 0x00FF) << 24))

xid = XXxx
uid = UUuuuu
gid = GGgggg

uid' = XXUUuuuu
gid' = xxGGgggg

xid & 0xFF00 = XX00
(xid & 0xFF00) << 16 = XX000000

xid & 0x00FF = 00xx
(xid & 0x00FF) << 24 = xx000000

HTH,
Herbert

> Regards,
>
> Lars
_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 29 Mar 2004 - 15:29:48 BST by hypermail 2.1.3