* Load loadable kernel driver
@ 2001-06-28 8:36 Ginny E. Kim
2001-06-29 12:03 ` Andrew Duane USG
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Ginny E. Kim @ 2001-06-28 8:36 UTC (permalink / raw)
My system is "OSF1 Tru64UNIX V4.0F 1229 alpha".
I have one loadable kernel module and I want to load it.
I've already read documents(Creating Dynamically Configurable Kernel
Subsystems)
I did as they suggested..but, I couldn't succeed it.
My method
1. if I put attributes of my module in /etc/sysconfigtab, and put my
module in /sys/BINARY/ directory and /subsys/
I got following error after excuting "sysconfig -c mymodule"
framework error : unresolved symbol name
2. #cp mymodule /sys/BINARY/
#cp mymodule /subsys/
(I didn't modify /etc/sysconfigtab file to put attributes of my
module)
# sysconfig -c mymodule
method failed to perform preconfiguration
subsystem error : Not owner
How can I do to load my module to kernel?
and How can I compile my module(mymodule.mod)?
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: Load loadable kernel driver 2001-06-28 8:36 Load loadable kernel driver Ginny E. Kim @ 2001-06-29 12:03 ` Andrew Duane USG 2001-07-06 6:50 ` Ginny E. Kim 2001-06-29 13:46 ` Joe Mario 2001-06-29 20:58 ` Sean Davidson 2 siblings, 1 reply; 12+ messages in thread From: Andrew Duane USG @ 2001-06-29 12:03 UTC (permalink / raw) In article <2f6bec0a.0106280036.16304a21@posting.google.com> banny52@yahoo.com (Ginny E. Kim) writes: >My system is "OSF1 Tru64UNIX V4.0F 1229 alpha". >I have one loadable kernel module and I want to load it. >I've already read documents(Creating Dynamically Configurable Kernel >Subsystems) >I did as they suggested..but, I couldn't succeed it. > >My method >1. if I put attributes of my module in /etc/sysconfigtab, and put my >module in /sys/BINARY/ directory and /subsys/ > I got following error after excuting "sysconfig -c mymodule" > framework error : unresolved symbol name This means that your module has an extern symbol that isn't in the kernel. That is, you have something like: extern int foobar; where there is no "foobar" in the kernel. Unfortunately, due to a shortcoming in the infrastructure, it can also mean exactly the opposite, that there is a *duplicate* symbol name somewhere. That is: It would be helpful if the manager differentiated these two, and it would be even MORE helpful if the manager specified which symbol was undefined/redefined. >2. #cp mymodule /sys/BINARY/ > #cp mymodule /subsys/ > (I didn't modify /etc/sysconfigtab file to put attributes of my >module) > # sysconfig -c mymodule > method failed to perform preconfiguration > subsystem error : Not owner Is it "mymodule" or "mymodule.mod"? I think you have to have the .mod suffix on the file. But, the not owner message implies that you are not root, so don't have permission to do this. -- Andrew L. Duane (JOT-7) duane@zk3.dec.com Compaq Computer Corporation (603)-884-1294 110 Spit Brook Road M/S ZKO3-3/U14 Nashua, NH 03062-2698 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-06-29 12:03 ` Andrew Duane USG @ 2001-07-06 6:50 ` Ginny E. Kim 0 siblings, 0 replies; 12+ messages in thread From: Ginny E. Kim @ 2001-07-06 6:50 UTC (permalink / raw) duane@hunch.zk3.dec.com (Andrew Duane USG) wrote in message news:<9hhqrb$1t00$1@lead.zk3.dec.com>... > In article <2f6bec0a.0106280036.16304a21@posting.google.com> banny52@yahoo.com (Ginny E. Kim) writes: > >My system is "OSF1 Tru64UNIX V4.0F 1229 alpha". > >I have one loadable kernel module and I want to load it. > >I've already read documents(Creating Dynamically Configurable Kernel > >Subsystems) > >I did as they suggested..but, I couldn't succeed it. > > > >My method > >1. if I put attributes of my module in /etc/sysconfigtab, and put my > >module in /sys/BINARY/ directory and /subsys/ > > I got following error after excuting "sysconfig -c mymodule" > > framework error : unresolved symbol name > > This means that your module has an extern symbol that isn't in > the kernel. That is, you have something like: > > extern int foobar; > > where there is no "foobar" in the kernel. > > Unfortunately, due to a shortcoming in the infrastructure, it can > also mean exactly the opposite, that there is a *duplicate* symbol > name somewhere. That is: > > It would be helpful if the manager differentiated these two, and it > would be even MORE helpful if the manager specified which symbol was > undefined/redefined. > > >2. #cp mymodule /sys/BINARY/ > > #cp mymodule /subsys/ > > (I didn't modify /etc/sysconfigtab file to put attributes of my > >module) > > # sysconfig -c mymodule > > method failed to perform preconfiguration > > subsystem error : Not owner > > Is it "mymodule" or "mymodule.mod"? I think you have to have the > .mod suffix on the file. But, the not owner message implies that > you are not root, so don't have permission to do this. Thank you for your answer. But, I am sure that I excuted sysconfig, having root permission. That system has only 'root' id. My module is .mod suffix on file.. Does "unresolved symbol" mean mymodule has extern sysmbol that isn't in kernel? If then, is that problem in source or compiling option? How can I be close that problem to solve? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-06-28 8:36 Load loadable kernel driver Ginny E. Kim 2001-06-29 12:03 ` Andrew Duane USG @ 2001-06-29 13:46 ` Joe Mario 2001-07-02 6:39 ` Ginny E. Kim 2001-06-29 20:58 ` Sean Davidson 2 siblings, 1 reply; 12+ messages in thread From: Joe Mario @ 2001-06-29 13:46 UTC (permalink / raw) "Ginny E. Kim" wrote: > > My system is "OSF1 Tru64UNIX V4.0F 1229 alpha". > I have one loadable kernel module and I want to load it. > I've already read documents(Creating Dynamically Configurable Kernel > Subsystems) > I did as they suggested..but, I couldn't succeed it. > > My method > 1. if I put attributes of my module in /etc/sysconfigtab, and put my > module in /sys/BINARY/ directory and /subsys/ > I got following error after excuting "sysconfig -c mymodule" > framework error : unresolved symbol name > ... > How can I do to load my module to kernel? > and How can I compile my module(mymodule.mod)? Your loadable module won't load if there is an unresolved symbol. The name of the unresolved symbol should be reported to the console window. If you want to see the name of the unresolved symbol reported to a file, you can stop kloadsrv and then restart it with the following syntax: /sbin/kloadsrv -log /tmp/kls.log -d 15 < /dev/console > /dev/console 2>&1 Joe Mario Compaq Tru64 UNIX Development Environment ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-06-29 13:46 ` Joe Mario @ 2001-07-02 6:39 ` Ginny E. Kim 2001-07-06 19:55 ` Joe Mario 0 siblings, 1 reply; 12+ messages in thread From: Ginny E. Kim @ 2001-07-02 6:39 UTC (permalink / raw) Joe Mario <mario@zk3.dec.com> wrote in message news:<3B3C86C6.D19FDE67@zk3.dec.com>... > "Ginny E. Kim" wrote: > > > > My system is "OSF1 Tru64UNIX V4.0F 1229 alpha". > > I have one loadable kernel module and I want to load it. > > I've already read documents(Creating Dynamically Configurable Kernel > > Subsystems) > > I did as they suggested..but, I couldn't succeed it. > > > > My method > > 1. if I put attributes of my module in /etc/sysconfigtab, and put my > > module in /sys/BINARY/ directory and /subsys/ > > I got following error after excuting "sysconfig -c mymodule" > > framework error : unresolved symbol name > > ... > > How can I do to load my module to kernel? > > and How can I compile my module(mymodule.mod)? > > Your loadable module won't load if there is an unresolved symbol. > The name of the unresolved symbol should be reported to the > console window. > > If you want to see the name of the unresolved symbol reported to a > file, you can stop kloadsrv and then restart it with the following > syntax: > /sbin/kloadsrv -log /tmp/kls.log -d 15 < /dev/console > /dev/console > 2>&1 > > Joe Mario > Compaq Tru64 UNIX Development Environment I did it as your advice...and, As results of "syslog -c mymodule ", I got same message-framework error : unresolved symbol name..and I got console message following... ============================= cfgmgr: starting protocol version: 2 request from user: root request from host: compaq2 waiting for new packet packet received-> subsystem: mymodule operation: CFG_OP_CONFIGURE data size: 0 looking for method /subsys/mymodule.mth looking for method /var/subsys/mymodule.mth executing method for preconfiguration: /var/subsys/mymodule.mth preconfigure mymodule 1 device.mth: preconfiguration started for the "mymodule" device driver device.mth: Warning: Unable to find a Module_Config line in the sysconfigtab database device.mth: Psuedo Driver configured, no kernel topology structure created for this driver. device.mth: preconfigure returned successfully calling kmodcall to configure mymodule calling kloadsrv to load mymodule attaching to kloadsrv ldr_flag=0x100 requesting kloadsrv to perform load recognizer: Warning: /subsys/mymodule.mod is improperly built. This module was built without the recommended kernel switches. The -Wf,-static flag was not specified during the compilation. Unpredictable runtime behavior may result without the correct flags. See the example in /usr/examples/cfgmgr/README for the correct compile and link flags. kloadsrv: kernel_load("/subsys/mymodule.mod", x, module) = 256 ldr_resolve_symbol: error looking up package kernel symbol fr_checkp: Unresolved symbol name kloadsrv load return 93 load failed: unresolved symbol name sending reply packet waiting for new packet cfgmgr: read failed (errno 93) ============================ So, After Seeing the example in /usr/examples/cfgmgr/README, I comiled mymodule for same comilpe and link flags. (#cc -c -Wb,-static -Wco,-nofloat mymodule.c #ld -r -dc -o mymodule.mod mymodule.o) Do you have solutions?.....I really want to get the solutions..... ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-07-02 6:39 ` Ginny E. Kim @ 2001-07-06 19:55 ` Joe Mario 2001-07-09 2:10 ` Ginny E. Kim 0 siblings, 1 reply; 12+ messages in thread From: Joe Mario @ 2001-07-06 19:55 UTC (permalink / raw) Ginny: You have an unresolved symbol in the module you are compiling. The name of that symbol is "fr_checkp". That symbol is defined in the Tru64 UNIX module called "inet.mod". I suspect inet.mod is an optional module in a kernel configuration. Try running doconfig again, configuring in all network related modules to ensure that inet.mod gets linked into your newly rebuilt /vmunix. You can verify it is by the following command: nm -xv /vmunix |grep fr_checkp If the fr_checkp symbol is in the new vmunix, reboot the system with the new vmunix and then then try reloading your module. BTW, on another note, the "subsystem error : Not owner" messages you were seeing had nothing to do with your problem, nor were they ownership problems. There was a kloadsrv bug that incorrectly reported a "file not found" error message as "Not owner". Kloadsrv has a search path that it uses to find the modules it will load. The "Not owner" message means that it didn't find it in the first directory of the search path. Not a problem in your case. This bug has since been fixed. Joe "Ginny E. Kim" wrote: > > Joe Mario <mario@zk3.dec.com> wrote in message news:<3B3C86C6.D19FDE67@zk3.dec.com>... > > "Ginny E. Kim" wrote: > > > > > > My system is "OSF1 Tru64UNIX V4.0F 1229 alpha". > > > I have one loadable kernel module and I want to load it. > > > I've already read documents(Creating Dynamically Configurable Kernel > > > Subsystems) > > > I did as they suggested..but, I couldn't succeed it. > > > > > > My method > > > 1. if I put attributes of my module in /etc/sysconfigtab, and put my > > > module in /sys/BINARY/ directory and /subsys/ > > > I got following error after excuting "sysconfig -c mymodule" > > > framework error : unresolved symbol name > > > ... > > > How can I do to load my module to kernel? > > > and How can I compile my module(mymodule.mod)? > > > > Your loadable module won't load if there is an unresolved symbol. > > The name of the unresolved symbol should be reported to the > > console window. > > > > If you want to see the name of the unresolved symbol reported to a > > file, you can stop kloadsrv and then restart it with the following > > syntax: > > /sbin/kloadsrv -log /tmp/kls.log -d 15 < /dev/console > /dev/console > > 2>&1 > > > > Joe Mario > > Compaq Tru64 UNIX Development Environment > > I did it as your advice...and, > As results of "syslog -c mymodule ", I got same message-framework > error : unresolved symbol name..and I got console message following... > > ============================= > cfgmgr: starting > protocol version: 2 > request from user: root > request from host: compaq2 > waiting for new packet > packet received-> > subsystem: mymodule > operation: CFG_OP_CONFIGURE > data size: 0 > looking for method /subsys/mymodule.mth > looking for method /var/subsys/mymodule.mth > executing method for preconfiguration: > /var/subsys/mymodule.mth preconfigure mymodule 1 > device.mth: preconfiguration started for the "mymodule" device driver > device.mth: Warning: Unable to find a Module_Config line in the > sysconfigtab database > device.mth: Psuedo Driver configured, no kernel topology > structure created for this driver. > device.mth: preconfigure returned successfully > calling kmodcall to configure mymodule > calling kloadsrv to load mymodule > attaching to kloadsrv > ldr_flag=0x100 > requesting kloadsrv to perform load > recognizer: > Warning: /subsys/mymodule.mod is improperly built. > This module was built without the recommended kernel switches. > The -Wf,-static flag was not specified during the compilation. > Unpredictable runtime behavior may result without the correct > flags. See the example in /usr/examples/cfgmgr/README for the > correct compile and link flags. > > kloadsrv: kernel_load("/subsys/mymodule.mod", x, module) = 256 > ldr_resolve_symbol: error looking up package kernel symbol fr_checkp: > Unresolved symbol name > kloadsrv load return 93 > load failed: unresolved symbol name > sending reply packet > waiting for new packet > cfgmgr: read failed > (errno 93) > ============================ > > So, After Seeing the example in /usr/examples/cfgmgr/README, I comiled > mymodule for same comilpe and link flags. > (#cc -c -Wb,-static -Wco,-nofloat mymodule.c > #ld -r -dc -o mymodule.mod mymodule.o) > > Do you have solutions?.....I really want to get the solutions..... ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-07-06 19:55 ` Joe Mario @ 2001-07-09 2:10 ` Ginny E. Kim 2001-07-09 14:08 ` Brian Haley 2001-07-09 14:57 ` Joe Mario 0 siblings, 2 replies; 12+ messages in thread From: Ginny E. Kim @ 2001-07-09 2:10 UTC (permalink / raw) This message is very helpful to me. By the way, I have OSF1 Tru64UNIX V4.0F using doconfig ...I rebuilt Tru64 UNIX module.. But, I couldn't find "fr_checkp" symbol although new Tru64UNIX module had "inet.mod". Do I need to patch specially? How can I get new Tru64UNIX module having "fr_checkp" symbol? Joe Mario <mario@zk3.dec.com> wrote in message news:<3B4617A8.CF8A5A53@zk3.dec.com>... > Ginny: > You have an unresolved symbol in the module you are compiling. > The name of that symbol is "fr_checkp". That symbol is > defined in the Tru64 UNIX module called "inet.mod". > I suspect inet.mod is an optional module in a kernel > configuration. > > Try running doconfig again, configuring in all network > related modules to ensure that inet.mod gets linked into > your newly rebuilt /vmunix. You can verify it is by the > following command: > nm -xv /vmunix |grep fr_checkp > > If the fr_checkp symbol is in the new vmunix, reboot the > system with the new vmunix and then then try reloading your > module. > > BTW, on another note, the "subsystem error : Not owner" > messages you were seeing had nothing to do with your problem, > nor were they ownership problems. There was a kloadsrv bug > that incorrectly reported a "file not found" error message > as "Not owner". Kloadsrv has a search path that it uses > to find the modules it will load. The "Not owner" message > means that it didn't find it in the first directory of the > search path. Not a problem in your case. > This bug has since been fixed. > Joe > > > "Ginny E. Kim" wrote: > > > > Joe Mario <mario@zk3.dec.com> wrote in message news:<3B3C86C6.D19FDE67@zk3.dec.com>... > > > "Ginny E. Kim" wrote: > > > > > > > > My system is "OSF1 Tru64UNIX V4.0F 1229 alpha". > > > > I have one loadable kernel module and I want to load it. > > > > I've already read documents(Creating Dynamically Configurable Kernel > > > > Subsystems) > > > > I did as they suggested..but, I couldn't succeed it. > > > > > > > > My method > > > > 1. if I put attributes of my module in /etc/sysconfigtab, and put my > > > > module in /sys/BINARY/ directory and /subsys/ > > > > I got following error after excuting "sysconfig -c mymodule" > > > > framework error : unresolved symbol name > > > > ... > > > > How can I do to load my module to kernel? > > > > and How can I compile my module(mymodule.mod)? > > > > > > Your loadable module won't load if there is an unresolved symbol. > > > The name of the unresolved symbol should be reported to the > > > console window. > > > > > > If you want to see the name of the unresolved symbol reported to a > > > file, you can stop kloadsrv and then restart it with the following > > > syntax: > > > /sbin/kloadsrv -log /tmp/kls.log -d 15 < /dev/console > /dev/console > > > 2>&1 > > > > > > Joe Mario > > > Compaq Tru64 UNIX Development Environment > > > > I did it as your advice...and, > > As results of "syslog -c mymodule ", I got same message-framework > > error : unresolved symbol name..and I got console message following... > > > > ============================= > > cfgmgr: starting > > protocol version: 2 > > request from user: root > > request from host: compaq2 > > waiting for new packet > > packet received-> > > subsystem: mymodule > > operation: CFG_OP_CONFIGURE > > data size: 0 > > looking for method /subsys/mymodule.mth > > looking for method /var/subsys/mymodule.mth > > executing method for preconfiguration: > > /var/subsys/mymodule.mth preconfigure mymodule 1 > > device.mth: preconfiguration started for the "mymodule" device driver > > device.mth: Warning: Unable to find a Module_Config line in the > > sysconfigtab database > > device.mth: Psuedo Driver configured, no kernel topology > > structure created for this driver. > > device.mth: preconfigure returned successfully > > calling kmodcall to configure mymodule > > calling kloadsrv to load mymodule > > attaching to kloadsrv > > ldr_flag=0x100 > > requesting kloadsrv to perform load > > recognizer: > > Warning: /subsys/mymodule.mod is improperly built. > > This module was built without the recommended kernel switches. > > The -Wf,-static flag was not specified during the compilation. > > Unpredictable runtime behavior may result without the correct > > flags. See the example in /usr/examples/cfgmgr/README for the > > correct compile and link flags. > > > > kloadsrv: kernel_load("/subsys/mymodule.mod", x, module) = 256 > > ldr_resolve_symbol: error looking up package kernel symbol fr_checkp: > > Unresolved symbol name > > kloadsrv load return 93 > > load failed: unresolved symbol name > > sending reply packet > > waiting for new packet > > cfgmgr: read failed > > (errno 93) > > ============================ > > > > So, After Seeing the example in /usr/examples/cfgmgr/README, I comiled > > mymodule for same comilpe and link flags. > > (#cc -c -Wb,-static -Wco,-nofloat mymodule.c > > #ld -r -dc -o mymodule.mod mymodule.o) > > > > Do you have solutions?.....I really want to get the solutions..... ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-07-09 2:10 ` Ginny E. Kim @ 2001-07-09 14:08 ` Brian Haley 2001-07-10 4:29 ` Ginny E. Kim 2001-07-09 14:57 ` Joe Mario 1 sibling, 1 reply; 12+ messages in thread From: Brian Haley @ 2001-07-09 14:08 UTC (permalink / raw) "Ginny E. Kim" wrote: > By the way, I have OSF1 Tru64UNIX V4.0F using doconfig > ...I rebuilt Tru64 UNIX module.. > But, I couldn't find "fr_checkp" symbol although new Tru64UNIX module > had "inet.mod". > Do I need to patch specially? How can I get new Tru64UNIX module > having "fr_checkp" symbol? inet.mod is in every kernel, but fr_checkp doesn't exist until V5.1. I'm assuming you're trying to run ipfilter? -Brian -------------------------------------------------- Brian P. Haley enet: brian.haley@compaq.com Tru64 UNIX Networking Group Compaq Computer Corporation ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-07-09 14:08 ` Brian Haley @ 2001-07-10 4:29 ` Ginny E. Kim 2001-07-10 15:46 ` Brian Haley 0 siblings, 1 reply; 12+ messages in thread From: Ginny E. Kim @ 2001-07-10 4:29 UTC (permalink / raw) Yes, I want to run ipfilter... If then,,if 4.0F doesn't have "fr_check" sysmbol.. do you say I can't load ipfilter module in 4.0F...? Brian Haley <haley@zk3.dec.com> wrote in message news:<3B49BADC.3C6A566A@zk3.dec.com>... > "Ginny E. Kim" wrote: > > > By the way, I have OSF1 Tru64UNIX V4.0F using doconfig > > ...I rebuilt Tru64 UNIX module.. > > But, I couldn't find "fr_checkp" symbol although new Tru64UNIX module > > had "inet.mod". > > Do I need to patch specially? How can I get new Tru64UNIX module > > having "fr_checkp" symbol? > > inet.mod is in every kernel, but fr_checkp doesn't exist until V5.1. > I'm assuming you're trying to run ipfilter? > > -Brian > > > -------------------------------------------------- > Brian P. Haley enet: brian.haley@compaq.com > Tru64 UNIX Networking Group > Compaq Computer Corporation ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-07-10 4:29 ` Ginny E. Kim @ 2001-07-10 15:46 ` Brian Haley 0 siblings, 0 replies; 12+ messages in thread From: Brian Haley @ 2001-07-10 15:46 UTC (permalink / raw) "Ginny E. Kim" wrote: > Yes, I want to run ipfilter... > If then,,if 4.0F doesn't have "fr_check" sysmbol.. > do you say I can't load ipfilter module in 4.0F...? Right, 4.0F doesn't support ipfilter. -Brian ----------------------------------- Brian P. Haley Tru64 UNIX Networking Group Compaq Computer Corporation ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-07-09 2:10 ` Ginny E. Kim 2001-07-09 14:08 ` Brian Haley @ 2001-07-09 14:57 ` Joe Mario 1 sibling, 0 replies; 12+ messages in thread From: Joe Mario @ 2001-07-09 14:57 UTC (permalink / raw) Ginny: I just checked the "fr_checkp" symbol and noticed it was introduced into the Tru64 OS in the V5.1 release. That means it doesn't exist in any releases prior to V5.1. Are you building any part of your loadable kernel driver with any Tru64 OS software newer than V4.0F? If so, it's not supported. Somehow your driver, which you're trying to load on V4.0F, is picking up symbol references to symbols on newer releases. Joe Mario "Ginny E. Kim" wrote: > > This message is very helpful to me. > By the way, I have OSF1 Tru64UNIX V4.0F using doconfig > ...I rebuilt Tru64 UNIX module.. > But, I couldn't find "fr_checkp" symbol although new Tru64UNIX module > had "inet.mod". > Do I need to patch specially? How can I get new Tru64UNIX module > having "fr_checkp" symbol? > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Load loadable kernel driver 2001-06-28 8:36 Load loadable kernel driver Ginny E. Kim 2001-06-29 12:03 ` Andrew Duane USG 2001-06-29 13:46 ` Joe Mario @ 2001-06-29 20:58 ` Sean Davidson 2 siblings, 0 replies; 12+ messages in thread From: Sean Davidson @ 2001-06-29 20:58 UTC (permalink / raw) Here is an example of a most simple loadable module. This example has the different includes needed to compile V4 and V5 modules. Missing the *_attributes structure or the *_configure routine will cause missing symbols. Also not include all the correct header files will also cause missing symbols. You should really only copy the loadable module into the /subsys or /var/subsys directories. Sean Davidson Compaq Tru64 UNIX Release Engineering = = = = = = = = /etc/sysconfigtab entries = = = = = nhdzz: Debug = 1 = = = = = = = = == = = = = = = = /* * * Dummy nhd disk driver * */ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> #include <sys/errno.h> #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/sysconfig.h> #include <sys/disklabel.h> #if defined(OSVERS_V4) || defined(OSVERS_V5) #include <sys/malloc.h> #include <sys/buf.h> #if defined(OSVERS_V5) #include <sys/common_protos.h> #endif #endif #include <io/common/devio.h> #include <io/common/devgetinfo.h> #define NHD_NODEV (-1) #define NHD_INSTANCE (1) #define NHD_UNITMAX 255 #define NHD_DEV_NULL (0) #define nhdzz_unit(x) ((minor(x) >> 3) & 0x7) struct nhdzz_devs { int d_flags; /* flags */ size_t d_size; /* size of device */ unsigned char * d_buf; /* controll xfer buffer */ }; /* * forward declarations */ int nodev(), nulldev(); int nhdzz_open(), nhdzz_close(), nhdzz_read(), nhdzz_write(), nhdzz_ioctl(); int nhdzz_dump(), nhdzz_size(); void nhdzz_strategy(); /* * softc structure */ struct nhdzz_softc { int nhdzz_openflag; /* Open flag */ int nhdzz_count; /* Count chars out to device */ int nhdzz_state; /* Device state */ } nhdzz_softc[1]; /* * other data */ int nhdzz_config = FALSE; /* configured status */ int nhdzz_unit_count; /* current number of units */ struct nhdzz_devs *nhdzz_devs[NHD_UNITMAX]; /* disk device structures */ static unsigned char nhdzz_data_buffer[65536]; /* disk data buffer */ #define NHDZZ_DEVS_NULL ((struct nhdzz_devs *) NULL) /* * system configuration data */ static int nhdzz_units = 2; static int nhdzz_majnum = NHD_NODEV; #define nhdzz_bmajnum nhdzz_majnum #define nhdzz_cmajnum nhdzz_majnum static int nhdzz_version = 1; static int nhdzz_debug = 0; static unsigned char nhdzz_cfgname[CFG_ATTR_NAME_SZ] = "NHDa Device"; static unsigned char nhdzz_modtype[CFG_ATTR_NAME_SZ] = "Dynamic"; /* * device switch table */ struct dsent nhdzz_devsw_entry = { nhdzz_open, /* d_open */ nhdzz_close, /* d_close */ (int(*)(struct buf *))nhdzz_strategy, /* d_strategy */ nhdzz_read, /* d_read */ nhdzz_write, /* d_write */ nhdzz_ioctl, /* d_ioctl */ nhdzz_dump, /* d_dump */ nhdzz_size, /* d_psize */ nodev, /* d_stop */ nodev, /* d_reset */ nodev, /* d_select */ 0, /* d_mmap */ 0, /* d_segmap */ NULL, /* d_ttys */ DEV_FUNNEL_NULL, /* d_funnell */ 0, /* d_bflags */ 0 /* d_cflags */ }; /* * configuration attributes */ cfg_subsys_attr_t nhdzz_attributes[] = { {"Module_Config_Name", CFG_ATTR_STRTYPE, CFG_OP_QUERY, (caddr_t)nhdzz_cfgname, 2, CFG_ATTR_NAME_SZ, 0}, {"Module_Type", CFG_ATTR_STRTYPE, CFG_OP_QUERY, (caddr_t)nhdzz_modtype, 2, CFG_ATTR_NAME_SZ, 0}, {"Number_of_units", CFG_ATTR_INTTYPE, CFG_OP_QUERY | CFG_OP_RECONFIGURE | CFG_OP_CONFIGURE, (caddr_t)&nhdzz_units, 1, NHD_UNITMAX, 0}, {"Major_device_number", CFG_ATTR_INTTYPE, CFG_OP_QUERY | CFG_OP_RECONFIGURE | CFG_OP_CONFIGURE, (caddr_t)&nhdzz_majnum, 0, 512, 0}, {"Version", CFG_ATTR_INTTYPE, CFG_OP_QUERY, (caddr_t)&nhdzz_version, 0, 9999999, 0}, {"Debug", CFG_ATTR_INTTYPE, CFG_OP_QUERY | CFG_OP_RECONFIGURE | CFG_OP_CONFIGURE, (caddr_t)&nhdzz_debug, 0, 255, 0}, {"", 0, 0, 0, 0, 0, 0} }; /* * configure */ int nhdzz_configure(optype, indata, indatalen, outdata, outdatalen) cfg_op_t optype; cfg_attr_t *indata; size_t indatalen; cfg_attr_t *outdata; size_t outdatalen; { int i, error = ESUCCESS; unsigned char *buf; struct nhdzz_devs *vdisk; switch (optype) { case CFG_OP_CONFIGURE: /* * check for device already configured */ if (nhdzz_config == TRUE) { error = EBUSY; break; } /* * set device configured */ nhdzz_config = TRUE; printf("nhdzz: configured\n"); printf("nhdzz: debug = %d\n", nhdzz_debug); break; case CFG_OP_UNCONFIGURE: /* * make sure configuration was successfull */ if (nhdzz_config != TRUE) { error = ENXIO; break; } /* * set device unconfigured */ nhdzz_config = FALSE; printf("nhdzz: unconfigured\n"); break; case CFG_OP_QUERY: break; case CFG_OP_RECONFIGURE: /* * don't allow the number of units to get smaller */ if (nhdzz_units < nhdzz_unit_count) { error = EINVAL; } break; default: error = EINVAL; break; } return(error); } /* * open */ int nhdzz_open(dev, flags, mode) dev_t dev; int flags; int mode; { int unit; /* * make sure unit is in range */ unit = nhdzz_unit(dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) return(ENXIO); return(0); } /* * close */ int nhdzz_close(dev, flags, mode) dev_t dev; int flags; int mode; { int unit; /* * verify unit and device structure */ unit = nhdzz_unit(dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) return(ENXIO); return(0); } /* * block read/write */ void nhdzz_strategy(bp) struct buf *bp; { struct partition *pp; int bn, sz; int unit; /* * check for good unit and being online */ unit = nhdzz_unit(bp->b_dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) { bp->b_error = ENXIO; bp->b_flags |= B_ERROR; biodone(bp); return; } bp->b_resid = 0; biodone(bp); return; } /* * raw read */ int nhdzz_read(dev, uio) dev_t dev; struct uio *uio; { int unit, error; struct buf *bp; /* * verify unit and device structure */ unit = nhdzz_unit(dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) return(ENXIO); /* * get a buffer for i/o and just do a physical i/o read */ MALLOC(bp, struct buf *, sizeof(struct buf), M_DEVBUF, M_WAITOK); bzero(bp, sizeof(struct buf)); error = physio(nhdzz_strategy, bp, dev, B_READ, minphys, uio); FREE(bp, M_DEVBUF); return(error); } /* * raw write */ int nhdzz_write(dev, uio) dev_t dev; struct uio *uio; { int unit, error; struct buf *bp; /* * verify unit and device structure */ unit = nhdzz_unit(dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) return(ENXIO); /* * get a buffer for i/o and just do a physical i/o write */ MALLOC(bp, struct buf *, sizeof(struct buf), M_DEVBUF, M_WAITOK); bzero(bp, sizeof(struct buf)); error = physio(nhdzz_strategy, bp, dev, B_WRITE, minphys, uio); FREE(bp, M_DEVBUF); return(error); } /* * size */ int nhdzz_size(dev) dev_t dev; { int unit; /* * verify unit and device structure */ unit = nhdzz_unit(dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) return(-1); /* * return size of virtual disk */ return(2097152); } /* * dump */ int nhdzz_dump(dev) dev_t dev; { return(ENXIO); } /* * ioctl */ nhdzz_ioctl(dev, cmd, data, flag) dev_t dev; u_long cmd; caddr_t data; int flag; { int unit, flags, size, i, junk, error = 0; unsigned long addr; struct nhdzz_devs *vdisk; struct nhdzz_ioctl *ioctl_data = (struct nhdzz_ioctl *) data; DEVGEOMST *devgeom; v1_device_info_t *devi_p; v1_disk_dev_info_t *diskp; struct devget *devget; struct disklabel *lp; struct partition *pp; struct pt_tbl *pt; struct buf *bp; /* * trim the ioctl command and verify user is super user */ cmd = (cmd & 0xffffffff); if (error = suser(u.u_cred, &u.u_acflag)) return(error); /* * verify that unit is valid */ unit = nhdzz_unit(dev); if (unit < 0 || unit >= nhdzz_units || nhdzz_devs[unit] == NHDZZ_DEVS_NULL) return(ENXIO); /* * process ioctl command */ switch (cmd) { case DIOCGDINFO: break; case DIOCGPART: break; case DIOCSDINFO: break; case DIOCWLABEL: break; case DIOCWDINFO: break; case DIOCGDEFPT: break; case DIOCGCURPT: break; case DEVIOCGET: break; case DEVGETINFO: break; case DEVGETGEOM: break; default: error = ENXIO; } return(error); } ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2001-07-10 15:46 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2001-06-28 8:36 Load loadable kernel driver Ginny E. Kim 2001-06-29 12:03 ` Andrew Duane USG 2001-07-06 6:50 ` Ginny E. Kim 2001-06-29 13:46 ` Joe Mario 2001-07-02 6:39 ` Ginny E. Kim 2001-07-06 19:55 ` Joe Mario 2001-07-09 2:10 ` Ginny E. Kim 2001-07-09 14:08 ` Brian Haley 2001-07-10 4:29 ` Ginny E. Kim 2001-07-10 15:46 ` Brian Haley 2001-07-09 14:57 ` Joe Mario 2001-06-29 20:58 ` Sean Davidson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox