Re: tty and ldisc module safety

From: Andrew Morton (andrewm@uow.edu.au)
Date: Tue Sep 26 2000 - 10:00:33 EST


Jeff Garzik wrote:
>
> On Wed, 27 Sep 2000, Andrew Morton wrote:
> >
> > --- linux-2.4.0-test9-pre7/include/linux/tty_driver.h Sat Aug 5 13:35:24 2000
> > +++ linux-akpm/include/linux/tty_driver.h Wed Sep 27 00:47:24 2000
> > @@ -117,6 +117,15 @@
> >
> > #include <linux/fs.h>
> >
> > +#ifdef CONFIG_MODULES
> > +#include <linux/module.h>
> > +struct module;
> > +#define SET_TTY_OWNER(driver) \
> > + do { (driver)->owner = THIS_MODULE; } while (0)
> > +#define SET_LDISC_OWNER(ldisc) \
> > + do { (ldisc)->owner = THIS_MODULE; } while (0)
> > +#endif
>
> Why ifdef MODULE?

So we can later do

#ifdef SET_TTY_OWNER

to determine in one hit whether we're compiling for a kernel which has
this change and whether we're supporting modules. Much more reliable
than LINUX_VERSION_CODE().

Those 4 bytes in the tty and ldisc structs may come in handy one day. I
really dislike adding little bits of creeping bloat.
 
> And why the "struct module;"?

Stupidity?

> Simply including
> linux/modules.h should take care of both cases... Like pci.h, modules.h
> should work fine even when !MODULES...

Yep.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:17 EST