[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dumb compilation question
omigosh. i only spent a /couple of hours/ staring at this. i told you it was
a dumb compilation question! hee hee. :)
btw, a question about style -- when registering a driver, the module
programming guide and rubini's o'reilly book use mknod from a script
to generate a device file from a dynamically allocated major number.
is there a reason why they don't call mknod from init_module and rm from
cleanup_module?
also, yesterday, i noticed that "real" drivers use a syntax to fill a fops
structure. was shocked to see it because i never saw this syntax before,
but it's pretty cool. must be a gcc extension:
static struct file_operations fops = {
read: &device_read,
write: &device_write,
open: &device_open,
release: &device_release
};
this is cool beyond belief. but the C99 way of doing things seems to work
on gcc 2.95.3:
static struct file_operations fops = {
.read = &device_read,
.write = &device_write,
.open = &device_open,
.release = &device_release
};
is it OK to use these C99'isms? i'm only asking because people who wrote
the bleeding edge drivers, like daryll strauss's tdfx DRI module, use the
gcc extension rather than C99. is it possible there's a reason for their
choice, or is it a matter of style?
by the way, thank you!! i was considering joining the kernel mailing list,
but felt really bad interjecting these questions right in the middle of
serious linux kernel discussions. it felt kind of tacky and wierd.
pete
On Sun 04 Mar 01, 11:28 AM, Mark McLoughlin said:
> On Sat, 3 Mar 2001, Peter Jay Salzman wrote:
>
> >
> > CFLAGS = -c -O1 -nostdinc -I/usr/src/linux-2.4.2/include
> > MODFLAGS := -DMODULE -D__KERNEL__ -DLINUX -D__SMP__
> ^^^^^^^^
> >
> > chardev.o: ${PROG}.c
> > ${CC} ${CFLAGS} ${MODCFLAGS} ${PROG}.c
> ^^^^^^^^^^^^
>
> I think you might want ${MODFLAGS}... ;)
>
>
> Good Luck,
> Mark
>
> -
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/
> IRC Channel: irc.openprojects.net / #kernelnewbies
> Web Page: http://www.surriel.com/kernelnewbies.shtml
--
"...and here is fortress ovum being stormed by p@dirac.org
millions of tiny warriors..." www.dirac.org/p
-- Robert "Schweitzer" Picardo
PGP signature