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

> 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));
> old.abc = msqid.abc;
> [...]
> 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;

old.abc = msqid.abc;
[...]
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.

Thanks,

Chris
wingc@engin.umich.edu


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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