Re: [PATCH 01/32] Add an ERR_CAST() macro to complement ERR_PTR and co. [try #2]
On Thu, 04 Oct 2007 16:56:07 +0100 David Howells wrote: > Add an ERR_CAST() macro to complement ERR_PTR and co. for the purposes of > casting an error entyped as one pointer type to an error of another pointer > type whilst making it explicit as to what is going on. > > This provides a replacement for the ERR_PTR(PTR_ERR(p)) construct. > > Signed-off-by: David Howells <[EMAIL PROTECTED]> > --- > > include/linux/err.h | 12 > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/include/linux/err.h b/include/linux/err.h > index 1ab1d44..e810ca4 100644 > --- a/include/linux/err.h > +++ b/include/linux/err.h > @@ -34,6 +34,18 @@ static inline long IS_ERR(const void *ptr) > return IS_ERR_VALUE((unsigned long)ptr); > } > > +/** > + * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type > + * ptr: The pointer to cast. @ptr: > + * > + * Explicitly cast an error-valued pointer to another pointer type in such a > + * way as to make it clear that's what's going on. > + */ > +static inline void *ERR_CAST(const void *ptr) > +{ > + return (void *) ptr; > +} > + > #endif > > #endif /* _LINUX_ERR_H */ --- ~Randy - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/32] Add an ERR_CAST() macro to complement ERR_PTR and co. [try #2]
Sam Ravnborg <[EMAIL PROTECTED]> wrote: > One like one variant, another like another variant. > Both fails to say why. It's shorter, more compact, and of course requires the least amount of change (especially as I can automate it with a command line perl script). David - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/32] Add an ERR_CAST() macro to complement ERR_PTR and co. [try #2]
On Fri, Oct 05, 2007 at 04:47:36PM +0100, David Howells wrote: > Christoph Hellwig <[EMAIL PROTECTED]> wrote: > > > I don't like this one very much, I'd rather take the variant Linus > > outline in his last post on that topic.. > > I'd rather not take that variant. One like one variant, another like another variant. Both fails to say why. So you left everyone wondering. Sam - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/32] Add an ERR_CAST() macro to complement ERR_PTR and co. [try #2]
Christoph Hellwig <[EMAIL PROTECTED]> wrote: > I don't like this one very much, I'd rather take the variant Linus > outline in his last post on that topic.. I'd rather not take that variant. David - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/32] Add an ERR_CAST() macro to complement ERR_PTR and co. [try #2]
On Thu, Oct 04, 2007 at 04:56:07PM +0100, David Howells wrote: > Add an ERR_CAST() macro to complement ERR_PTR and co. for the purposes of > casting an error entyped as one pointer type to an error of another pointer > type whilst making it explicit as to what is going on. > > This provides a replacement for the ERR_PTR(PTR_ERR(p)) construct. I don't like this one very much, I'd rather take the variant Linus outline in his last post on that topic.. - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html