From owner-freebsd-current Mon Jan 6 18:21:56 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id SAA21959 for current-outgoing; Mon, 6 Jan 1997 18:21:56 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id SAA21950 for ; Mon, 6 Jan 1997 18:21:45 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id TAA13473; Mon, 6 Jan 1997 19:12:28 -0700 From: Terry Lambert Message-Id: <199701070212.TAA13473@phaeton.artisoft.com> Subject: Re: MOD_DECL in lkm.h To: jb@cimlogic.com.au (John Birrell) Date: Mon, 6 Jan 1997 19:12:28 -0700 (MST) Cc: bde@zeta.org.au, current@freebsd.org In-Reply-To: <199701031946.GAA28204@freebsd1.cimlogic.com.au> from "John Birrell" at Jan 4, 97 06:46:50 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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.