Hi! I cleaned up xen/include/asm-x86/guest_access.h. I also fixed a bug in __copy_field_from_guest(), which seems to me to be a kind of cut-copy-paste bug. copy_{to,from}_user() and copy_{to,from}_user_hvm() expect a non-const argument as the first argument. So I remove the consts from the initializer. I replace typeof with __typeof__, which is always available in gcc - it is not, when the -ansi option is used. I do some explicit casts, which makes gcc errors more readable. In case, you pass an array by your mistake, which gets casted to a char *, then gcc tells you that rather just "invalid initializer". Christoph _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Petersson, Mats
2007-Jan-12 12:01 UTC
RE: [Xen-devel] [PATCH] Cleanup asm-x86/guest_access.h
> -----Original Message----- > From: xen-devel-bounces@lists.xensource.com > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of > Christoph Egger > Sent: 11 January 2007 14:54 > To: xen-devel@lists.xensource.com > Subject: [Xen-devel] [PATCH] Cleanup asm-x86/guest_access.h > > > Hi! > > I cleaned up xen/include/asm-x86/guest_access.h. I also fixed > a bug in > __copy_field_from_guest(), which seems to me to > be a kind of cut-copy-paste bug. > > copy_{to,from}_user() and copy_{to,from}_user_hvm() expect a non-const > argument as the first argument. So I remove the consts from > the initializer. > I replace typeof with __typeof__, which is always available > in gcc - it is > not, when the -ansi option is used.And is it expected that Xen will EVER be compiled with -ansi? I think there''s enough gcc-isms in other places that this will never happen - not that it really makes any difference, I''m just curious if anyone "cares"... -- Mats> > I do some explicit casts, which makes gcc errors more readable. > In case, you pass an array by your mistake, which gets > casted to a char *, then gcc tells you that rather just > "invalid initializer". > > Christoph >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 12/1/07 12:01, "Petersson, Mats" <Mats.Petersson@amd.com> wrote:>> copy_{to,from}_user() and copy_{to,from}_user_hvm() expect a non-const >> argument as the first argument. So I remove the consts from >> the initializer. >> I replace typeof with __typeof__, which is always available >> in gcc - it is >> not, when the -ansi option is used. > > And is it expected that Xen will EVER be compiled with -ansi? I think > there''s enough gcc-isms in other places that this will never happen - > not that it really makes any difference, I''m just curious if anyone > "cares"...Yes, I''m going to take the const cleanups but bin the __typeof__ changes. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christoph Egger
2007-Jan-12 13:43 UTC
Re: [Xen-devel] [PATCH] Cleanup asm-x86/guest_access.h
On Friday 12 January 2007 14:37, Keir Fraser wrote:> On 12/1/07 12:01, "Petersson, Mats" <Mats.Petersson@amd.com> wrote: > >> copy_{to,from}_user() and copy_{to,from}_user_hvm() expect a non-const > >> argument as the first argument. So I remove the consts from > >> the initializer. > >> I replace typeof with __typeof__, which is always available > >> in gcc - it is > >> not, when the -ansi option is used. > > > > And is it expected that Xen will EVER be compiled with -ansi? I think > > there''s enough gcc-isms in other places that this will never happen - > > not that it really makes any difference, I''m just curious if anyone > > "cares"... > > Yes, I''m going to take the const cleanups but bin the __typeof__ changes.Do you also take the small bugfix in the __copy_field_from_guest() function at the very bottom in my patch ? _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 12/1/07 13:43, "Christoph Egger" <Christoph.Egger@amd.com> wrote:>> Yes, I''m going to take the const cleanups but bin the __typeof__ changes. > > Do you also take the small bugfix in the __copy_field_from_guest() function > at the very bottom in my patch ?Yes, thanks for that! -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel