Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jan 1997 19:12:28 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        jb@cimlogic.com.au (John Birrell)
Cc:        bde@zeta.org.au, current@freebsd.org
Subject:   Re: MOD_DECL in lkm.h
Message-ID:  <199701070212.TAA13473@phaeton.artisoft.com>
In-Reply-To: <199701031946.GAA28204@freebsd1.cimlogic.com.au> from "John Birrell" at Jan 4, 97 06:46:50 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > Most modules have
> > no need for a stat function.
> 
> That's a shame because it is a useful interface for looking at debug info.
> Ah well, looks like my module won't have a stat function either.

In my original code, the purpose of the stat() function was to allow
system call LKM 3 to tell me it provided system call 77 so I could
automatically make my program use the right argument to syscall().


> BTW, with lkms, how is device config info (like in kernel config files)
> supposed to be passed in rather than hard coding the configuration?
> In my case, I've got a digital I/O board that can have dip switches set
> to a range of base addresses. And it can be configured not to do interrupts
> or IRQs 2 - 7. I'd like to be able to do:
> 
> modload -c config_file -p postinstall XXX_mod.o
> 
> where the config_file might contain something similar to that given to
> the kernel config. Then I'd like the number of units to come from the
> config_file rather than from the NXXX in the XXX.h header file.

Make your probe code figure the information out so you con't need
a config line.  Config lines are evil.  8-(.

Dynamically allocate units as necessary and attach them to the vnode
data pointer contents for devfs.  If you have a variable number of
units and want to specifically allocate them in order, export a
directory node and use VOP_FCNTL or VOP_IOCTL to ask it to allocate you
and return a device name.  The allocation is valid so long as the
parent device is open.  Then open the cloned device as a device in the
dubdirectory of the parent node (which can act as a directory for
VOP_LOOKUP and as a device for VOP_READ), making the allocation stick,
and close the parent (cloning) device.

This is my planned mechanism for cloning pty's... and for dynamic
addition of PCMCIA devices under a card services device.  Works for
auto recognition of attached disks, partitioning and subpartitioning
of disks, and media insertion removal events, too.  8-).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701070212.TAA13473>