|
From: Paul M. <le...@Ch...> - 2001-10-05 20:04:29
|
On Fri, Oct 05, 2001 at 10:20:04PM +0400, Nick Kurshev wrote:
> Do you mean a character devices?:
>
> #if LINUX_VERSION_CODE >= 0x020400
> static struct file_operations xxx_fops =
> {
> llseek: xxx_lseek,
> read: xxx_read,
> write: xxx_write,
> ioctl: xxx_ioctl,
> mmap: xxx_mmap,
> open: xxx_open,
> release: xxx_release
> };
> #else
> static struct file_operations xxx_fops =
> {
> xxx_lseek,
> xxx_read,
> xxx_write,
> NULL,
> NULL,
> xxx_ioctl,
> xxx_mmap,
> xxx_open,
> NULL,
> xxx_release
> };
> #endif
>
Er.. this is utterly useless by the way. the above notation is not a 2.4
specific thing.
static struct file_operations xxx_fops = {
llseek: xxx_llseek,
read: xxx_read,
write: xxx_write,
ioctl: xxx_ioctl,
mmap: xxx_mmap,
open: xxx_open,
release: xxx_release,
};
works just fine the way it is. strict ansi C doesn't like it.. but it's a
standard anyways. c99 notation for the same thing is:
static struct file_operations xxx_fops = {
.llseek = &xxx_llseek,
.read = &xxx_read,
.write = &xxx_write,
.ioctl = &xxx_ioctl,
.mmap = &xxx_mmap,
.open = &xxx_open,
.release = &xxx_release,
};
though I don't care for c99 in general.
Anything that still does the "let's fill in all function pointers with NULL if
we don't have a function, and list everything in order" thing is broken and
needs to be fixed.
Regards,
--
Paul Mundt <le...@ch...>
|