Index: [thread] [date] [subject] [author]
  From: Brian Julin <bri@forcade.calyx.net>
  To  : ggi-develop@eskimo.com
  Date: Tue, 23 Feb 1999 13:12:34 -0500 (EST)

Re: Load-time parameters

On Tue, 23 Feb 1999, Marcus Sundberg wrote:

> Brian Julin wrote:
> > 3) Use a procfs/sysctl type interface -- insert the module, create
> > an instance, tweak the parameters, and then send a command to "activate"
> > a peice of hardware.
> >
> > But will an adequate, interactive, sysctl style interface be
> > available on all target OS's?? 
> 
> That question should be interpreted as:
> "Do all OSes have a way to get input from the administrator?"
> And I'm pretty sure the answer is yes. ;)

Fair enough.

> What you talk about above are implementation details of the
> OS/system layer. The driver components just get parameters from the
> KGI system layer, and the API to do this should not be dependent on
> the implementation on any particular OS.

Alright, then I propose that the new API to get module parameters from the
KGI subsystem be as follows:

kgi_sint kgi_parm_in_u8  (kgi_card *this, char *name, kgi_u8  *ptr);
kgi_sint kgi_parm_in_u16 (kgi_card *this, char *name, kgi_u16 *ptr);
kgi_sint kgi_parm_in_u32 (kgi_card *this, char *name, kgi_u32 *ptr);
kgi_sint kgi_parm_in_s8  (kgi_card *this, char *name, kgi_s8  *ptr);
kgi_sint kgi_parm_in_s16 (kgi_card *this, char *name, kgi_s16 *ptr);
kgi_sint kgi_parm_in_s32 (kgi_card *this, char *name, kgi_s32 *ptr);
kgi_sint kgi_parm_in_str (kgi_card *this, char *name, char **ptr);
kgi_sint kgi_parm_in_mem_region 
	(kgi_card *this, char *name, struct kgi_mem_region *ptr);
kgi_sint kgi_parm_in_io_region 
	(kgi_card *this, char *name, kgi_io_region *ptr);
kgi_sint kgi_parm_in_range
	(kgi_card *this, char *name, kgi_range *ptr);
kgi_sint kgi_parm_ins_u8  
	(kgi_card *this, char *name, kgi_u8 *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_u16 
        (kgi_card *this, char *name, kgi_u16 *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_u32 
        (kgi_card *this, char *name, kgi_u32 *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_s8  
	(kgi_card *this, char *name, kgi_s8  *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_s16 
	(kgi_card *this, char *name, kgi_s16 *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_s32 
	(kgi_card *this, char *name, kgi_s32 *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_str 
	(kgi_card *this, char *name, char **ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_mem_region (kgi_card *this, char *name,
	 struct kgi_mem_region *ptr, kgi_uint *num);
kgi_sint kgi_parm_ins_io_region (kgi_card *this, char *name, 
	 struct kgi_io_region *ptr, kgi_uint *num);
kgi_sint kgi_parm_in_range
	(kgi_card *this, char *name, kgi_range *ptr, kgi_uint *num);


/* Returns an error if the name is not found or this == NULL.

   *num specifies the number of entries to read, and after the
   function returns, contains the number of entries actually read.

   The sub-module is responsible for copying any null terminated 
   strings to it's own memory area before modifying them.  Otherwise
   all data is copied into the memory at *ptr; it is the sub-module's
   resposibility to allocate/free this memory.
*/

On the kernel subsystem side, essentially there would be a proc/sysctl
(or whatever) system that calls the following function for each parameter
to be stored, after creating one or more kgi_card structures:

kgi_parm_store (kgi_card *this, char *name, void *buf, kgi_uint len);

/* All data is copied from the pointer parameters so it is safe to 
   free/realloc the memory buffers.  If a parameter of the same name
   already exists the old values are deleted and freed. */


--
P.C.M.C.I.A. stands for "Plastic Connectors May Crack If Adjusted"
                                                             -- me
--
Brian S. Julin

Index: [thread] [date] [subject] [author]