[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] 32-bit UID support for 2.3.30pre6 (important update)

> static void copy_msqid_to_user(void * buf, struct mgqid64_ds *msqid, int version)
> {
> msqid_ds old;
> if(version == 1)
> return copy_to_user(buf,msqid,sizeof(*msqid));
> =;
> [...]
> return copy_to_user(buf,&old,sizeof(old));
> }
> The knowledge about the legacy support should be completely hidden
> within copy_xxx_to_user().

This was the way I wrote it originally :)

The only problem with this code is that it increases the stack usage (due
to the fact that both a msqid_ds and msqid64_ds have to be allocated at
the same time). We could optimize it slightly:

static void copy_msqid_to_user(void * buf, struct mgqid64_ds *msqid, int version)
if(version == 1)
return copy_to_user(buf,msqid,sizeof(*msqid));
else {
msqid_ds old; =;
return copy_to_user(buf,&old,sizeof(old));

Now the extra stack space should only be used in the case of legacy
support, right? However, it will still use more stack space in this case
than the alternate approach. If you don't think it's a problem, I'll
recode it in this style and post an updated patch later today.



To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:55    [W:0.038 / U:9.340 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site