From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762285AbXGLXMF (ORCPT ); Thu, 12 Jul 2007 19:12:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753923AbXGLXLz (ORCPT ); Thu, 12 Jul 2007 19:11:55 -0400 Received: from smtp2.linux-foundation.org ([207.189.120.14]:60909 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753151AbXGLXLy (ORCPT ); Thu, 12 Jul 2007 19:11:54 -0400 Date: Thu, 12 Jul 2007 16:11:46 -0700 From: Andrew Morton To: "Robert P. J. Day" Cc: Linux Kernel Mailing List Subject: Re: [PATCH] Make asm-generic/ioctl.h more generic using conditionals. Message-Id: <20070712161146.78e078b5.akpm@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed version 2.2.7 (GTK+ 2.8.6; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Jul 2007 06:33:26 -0400 (EDT) "Robert P. J. Day" wrote: > > Allow individual architectures to override a small set of macros > before including asm-generic/ioctl.h, in order to greatly simplify a > number of existing ioctl.h files. > > The overrideable macros would be: > > _IOC_SIZEBITS > _IOC_DIRBITS > _IOC_NONE > _IOC_WRITE > _IOC_READ > > --- > > i've submitted this once before, and it didn't seem to garner a lot > of attention one way or the other. this patch can be applied > standalone and shouldn't affect anything, but it would subsequently > allow at least a few ioctl.h files to be shortened considerably. It would be good if we could see one of these followon patches. If such an example patch (cc'ed to the arch maintainer, please) looks OK then we can go ahead with this base patch. > diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h > index cd02729..4fb087a 100644 > --- a/include/asm-generic/ioctl.h > +++ b/include/asm-generic/ioctl.h > @@ -21,8 +21,19 @@ > */ > #define _IOC_NRBITS 8 > #define _IOC_TYPEBITS 8 > -#define _IOC_SIZEBITS 14 > -#define _IOC_DIRBITS 2 > + > +/* > + * Let any architecture override either of the following before > + * including this file. > + */ > + > +#ifndef _IOC_SIZEBITS > +# define _IOC_SIZEBITS 14 > +#endif > + > +#ifndef _IOC_DIRBITS > +# define _IOC_DIRBITS 2 > +#endif > > #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) > #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) > @@ -35,11 +46,21 @@ > #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) > > /* > - * Direction bits. > + * Direction bits, which any architecture can choose to override > + * before including this file. > */ > -#define _IOC_NONE 0U > -#define _IOC_WRITE 1U > -#define _IOC_READ 2U > + > +#ifndef _IOC_NONE > +# define _IOC_NONE 0U > +#endif > + > +#ifndef _IOC_WRITE > +# define _IOC_WRITE 1U > +#endif > + > +#ifndef _IOC_READ > +# define _IOC_READ 2U > +#endif > > #define _IOC(dir,type,nr,size) \ > (((dir) << _IOC_DIRSHIFT) | \ > > -- > ======================================================================== > Robert P. J. Day > Linux Consulting, Training and Annoying Kernel Pedantry > Waterloo, Ontario, CANADA > > http://fsdev.net/wiki/index.php?title=Main_Page > ========================================================================