Messages in this thread | | | Date | Mon, 6 Dec 1999 11:53:47 -0500 (EST) | From | Chris Wing <> | Subject | Re: [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/
| |