On Thu, Apr 16, 2015 at 5:34 PM, Paul Goyette <p...@vps1.whooppee.com> wrote: > I'm working on turning swwdog (for now, eventually others) into a kernel > module, and I'm running into some difficulty with the autoconfig stuff. > > I've got an IOCONF=swwdog.ioconf in my Makefile, and swwdog.ioconf contains > > ioconf swwdog > include "conf/files" > include "dev/sysmon/files.sysmon" > pseudo-device swwdog > > In files.sysmon there is > > defpseudodev swwdog: sysmon_wdog > file dev/sysmon/swwdog.c swwdog > > In the swwdog_modcmd()'s init code, I am calling > > config_init_component(cfdriver_ioconf_swwdog, > cfattach_ioconf_swwdog, cfdata_ioconf_swwdog); > > where the arguments are all references to data structures defined in the > generated ioconf.[ch] files. > > The problem occurs a bit later on when I create a local struct cfattach > > cf.cf_name = "swwdog"; > cf.cf_atname = "swwdog"; > cf.cf_unit = 0; > cf.cf_fstate = FSTATE_STAR; > cf.cf_pspec = NULL; > cf.cf_loc = NULL; > cf.cf_flags = 0; > > and attempt to call config_attach_pseudo(). config_attach_pseudo() calls > config_devalloc() to allocate memory (primarily for the softc), and > config_devalloc() in turn locates the swwdog's struct cfdriver (which was > "frobbed" into the master device list by config_init_component()). > > Next, config_devalloc() tries to find a struct cfattach in the cfdriver list > of attachments. Unfortunately, the generated ioconf.c file has empty lists > of both struct cfdata and struct cfattach, so no struct cfattach ever got > "frobbed" by config_init_component, and thus the call to > cf_attach_lookup_cd() fails. > > ... > static struct cfdata cfdata_ioconf_swwdog[] = { > /* driver attachment unit state loc flags pspec */ > { NULL, NULL, 0, 0, NULL, 0, NULL } > }; > > > static const struct cfattachinit cfattach_ioconf_swwdog[] = { > { NULL, NULL } > }; > ... > > > Am I missing something obvious here? Or is config not generating valid > ioconf.[ch] files for a defpseudodev device?
I'd be surprised if config(1) works normally for defpseudodev as is. ;)