a couple more questions about UAPI in the kernel source, just to clarify that there is still some cleanup that could be done. first, i get that whole idea behind the include/uapi/ directory ... that it's way cleaner to factor out the userspace content to a single location, and use that as the basis for a subsequent "kernel-headers" package or something to that effect. but even having done that, there is of course some necessary usage of testing the __KERNEL__ macro to see if one is preprocessing in kernel space or not. one of these uses is, say, in a uapi header file, there might be a test to include a structure member depending on whether you're in kernel space or user space. but consider the following example. here's include/linux/mtd/inftl.h, wherein an entire chunk of that header file is protected by a "__KERNEL__" test: #ifndef __MTD_INFTL_H__ #define __MTD_INFTL_H__ ... snip ... #ifdef __KERNEL__ <--- start test struct INFTLrecord { struct mtd_blktrans_dev mbd; __u16 MediaUnit; __u32 EraseSize; struct INFTLMediaHeader MediaHdr; int usecount; unsigned char heads; unsigned char sectors; unsigned short cylinders; __u16 numvunits; __u16 firstEUN; __u16 lastEUN; __u16 numfreeEUNs; __u16 LastFreeEUN; /* To speed up finding a free EUN */ int head,sect,cyl; __u16 *PUtable; /* Physical Unit Table */ __u16 *VUtable; /* Virtual Unit Table */ unsigned int nb_blocks; /* number of physical blocks */ unsigned int nb_boot_blocks; /* number of blocks used by the bios */ struct erase_info instr; }; int INFTL_mount(struct INFTLrecord *s); int INFTL_formatblock(struct INFTLrecord *s, int block); void INFTL_dumptables(struct INFTLrecord *s); void INFTL_dumpVUchains(struct INFTLrecord *s); int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, size_t *retlen, uint8_t *buf); int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, size_t *retlen, uint8_t *buf); #endif /* __KERNEL__ */ <--- end test #endif /* __MTD_INFTL_H__ */ is that test really necessary? this is a header file that should be included *only* from within kernel space -- how could it possibly end up being used from user space? or am i missing something? i can see the value in uapi header files still needing to test __KERNEL__, in case there are minor tweaks to be done. but it seems that there should be precious little need for testing __KERNEL__ in *kernel* header files once userspace content has been factored out and moved to uapi, no? thoughts? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies