Subject: Re: Replacing the sysctl() interface.
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
From: Chris G. Demetriou <cgd@sibyte.com>
List: tech-kern
Date: 06/05/2000 16:38:18
Jun-ichiro itojun Hagino <itojun@iijlab.net> writes:
> 	the issue is that, malloc types are not really module-specific.

really?  how many different modules are going to use:

#define M_SEGMENT       43      /* Segment for LFS */
#define M_LFSNODE       44      /* LFS vnode private part */
#define M_FFSNODE       45      /* FFS vnode private part */
#define M_MFSNODE       46      /* MFS vnode private part */
#define M_NQLEASE       47      /* Nqnfs lease */
#define M_NQMHOST       48      /* Nqnfs host address table */
#define M_NFSSVC        50      /* Nfs server structure */
#define M_NFSUID        51      /* Nfs uid mapping structure */
#define M_NFSD          52      /* Nfs server daemon structure */
#define M_ISOFSMNT      57      /* ISOFS mount structure */
#define M_ISOFSNODE     58      /* ISOFS vnode private part */
#define M_MSDOSFSMNT    59      /* MSDOS FS mount structure */
#define M_MSDOSFSFAT    60      /* MSDOS FS fat table */
#define M_MSDOSFSNODE   61      /* MSDOS FS vnode private part */
#define M_MISCFSMNT     64      /* miscfs mount structures */
#define M_MISCFSNODE    65      /* miscfs vnode private part */
#define M_ADOSFSMNT     66      /* adosfs mount structures */
#define M_ADOSFSNODE    67      /* adosfs vnode private part */
#define M_ANODE         68      /* adosfs anode structures and tables. */
#define M_AFS           70      /* Andrew File System */
#define M_ADOSFSBITMAP  71      /* adosfs bitmap */
#define M_NFSRVDESC     72      /* NFS server descriptor */
#define M_NFSDIROFF     73      /* NFS directory cookies */
#define M_NFSBIGFH      74      /* NFS big filehandle */
#define M_EXT2FSNODE    75      /* EXT2FS vnode private part */
#define M_VMSWAP        76      /* VM swap structures */
#define M_VMPAGE        77      /* VM page structures */
#define M_VMPBUCKET     78      /* VM page buckets */
#define M_USB           87      /* USB general */
#define M_USBDEV        88      /* USB device driver */
#define M_POOL          89      /* memory pool structs */
#define M_CODA          90      /* Coda file system structures and tables. */

OK, actually...  just start at 43 and go down.  few of those will be
used (directly) by multiple modules.

(even M_POOL...  only allocation and deallocation of pools will use it!)


> 	malloc types needs to be unique across the souce code tree to
> 	diffferentiate between them.

actually, in fact, there's no reason that mutiple modules couldn't use
the same M_FOO name, as long as the values were different, and as long
as the symbols are exposed in the same places.  (i.e., if you wanted
to use both in the kernel, they'd have to be static... which is a
lose.  but if you wanted to use one in kernel, and one in a loadable
module, and the module were mostly stripped, you'd be fine.)

In the FreeBSD scheme, unless i'm mistaken, the type 'names' etc., are
actually pointers.  That gives the necessary amount of uniqueness.


>	I believe centralized management in
> 	sys/sys/malloc.h is good enough.

Look at the list above.

You'll note that 'M_AFS' is there.

The one definition, in itself, is proof that centralized management in
sys/sys/malloc.h is _not_ good enough.



cgd