Re: My nikel to Linux kernel wishlist ( module_syscall )

sergey@memco.com
Mon, 30 Aug 1999 15:54:53 -0400


Hi !
David Olofson wrote:
>sergey@memco.com wrote:
>(...)
>> > So, I have butchered it slightly, but now your device control interface
>> > looks like:
>> >
>> >int opendevice(const char * pathname, int flags);
>> >int devctl(int dd, int request, ...);
>> >int closedevice(int dd);
>>
>> >Well, that looks like a rather useful interface. I think I might patent
>> >it :-)
>>
>> Ok. Looks like a open/ioctl/close . So that another good idea ! Stop
supporting
>> a
>> /proc/modules file and start support a /proc/modules directory. Every
>> file in that directory would link to dynamic kernel module and would
>> have the same name. You can use every IO system call ( even select& poll)
>> for that 'file'.
>(...)
>> In that case we need to export a new struct file_operation per
>> each module.

>Uh oh... So, we have a new way of providing /dev/ functionality with a
>slightly different device mapping scheme.
>
>Ok, I kind of like the idea of a more "module instance = device
>instance" kind of mapping for some things (kernel sofware engines that
>only occur in one instance, for example), but I'm still having a problem
>seeing what the point is with all this.

Well, there is a point. This is a advanced good old { "CON:", "COM1:", etc. }
MSDOS idea. And
1. There are only 256 majors in the system. Enough for today,
but that is not a _huge_ number, is it ?
2. In other UNIXOIDs you could not open device file twice. ( I think
you understand that I mean ). That's why CLONE devices was invented.
3. I don't want to care about major number/device driver at ALL when
I try to write some 'pure' software kernel module without
hardware issues. That is not a NATURAL WAY.

> I think it looks more like a
> matter of "how to find the device I want to access"...

There is no such metter. Just look below.

>Oh, you may want to look at the RTLinux POSIX I/O module, originally
>written by Victor Yodaiken (I think - there was no comment in the
>original files...), modified a little for my Driver Programming
>Interface. (For porting drivers to RTLinux easily - no new API.) It now
>uses the standard Linux file, file_operations, and inode structs, but
>the inode struct thing is a quick hack that I need to clean up some
>more. (What about some locking, for example? None at all in the current
>version.)
>The next DPI version, hopefully with a cleaner rtl_posixio, will be
>released soon, but I have a song to record and mix before the weekend...
>
>Site at: http://www.angelfire.com/or/audiality/download.html

Very interesting. I'll take a look.

>Anyway, it implements about everything you need, except for the /proc/
>part, which you could grab elsewhere. However, I'd try to find out what
>the point is, really... Too hard to find a device using major + minor
>and a /dev/ file? ;-)

Even you don't need to find out a major+minor, look for such
file in /dev tree, etc.. Your user program would simply open
"/dev/MY_UNIQUE_DEVICE_NAME" and you could create that device
file every time from module's INIT_MODULE() routine by calling
sys_unlink & sys_mknod functions (indirectly, of course ).

//David

Sergey Tsybanov

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