1 2 3 4 5 6 | struct cfg_load { caddr_t path; /* ptr to object module pathname */ caddr_t libpath; /* ptr to a substitute libpath */ mid_t kmid; /* kernel module id (returned) */ }; |
1 2 3 4 5 6 7 8 | struct cfg_dd { mid_t kmid;/* Module ID of device driver */ dev_t devno; /* Device major/minor number */ int cmd; /* Config command code for device driver*/ caddr_t ddsptr; /* Pointer to device dependent structure*/ int ddslen; /* Length of device dependent structure */ }; |
1 2 3 4 5 | int sysconfig( int cmd, /* Command to be executed */ void *parmp,/* Address of structure containing info for cmd */ int parmlen /* Length of parmp information */ ); |
1 | int genmajor(char* name_of_device_driver) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | int *genminor ( char * device_instance, /* Points to a character string containing the device instance name.*/ int major_no, /* The major number of the device instance.*/ int preferred_minor, /* Contains a single preferred minor number or a starting minor number for generating a set of numbers. */ int minors_in_grp, /* Indicates how many minor numbers are to be allocated. */ int inc_within_grp, /* Indicates the interval between minor numbers.*/ int inc_btwn_grp /* Indicates the interval between groups of minor numbers.*/ ); |
1 | dev_t makedev64(int major, int minor); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | int mknod ( char *Path, /* Names the new device special file. */ int Mode, /* Specifies the file type, attributes, and access permissions. */ dev_t Device /* Device number generated by makedev() subroutine. */ ); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | struct devsw { int (*d_open)(); /* entry point for open routine */ int (*d_close)(); /* entry point for close routine */ int (*d_read)();/* entry point for read routine */ int (*d_write)(); /* entry point for write routine */ int (*d_ioctl)();/* entry point for ioctl routine */ int (*d_strategy)();/* entry point for strategy routine */ struct tty *d_ttys;/* pointer to tty device structure */ int (*d_select)(); /* entry point for select routine */ int (*d_config)(); /* entry point for config routine */ int (*d_print)(); /* entry point for print routine */ int (*d_dump)(); /* entry point for dump routine */ int (*d_mpx)(); /* entry point for mpx routine */ int (*d_revoke)(); /* entry point for revoke routine */ caddr_t d_dsdptr; /* pointer to device specific data */ /* * The following entries are control fields managed * by the kernel and should not be modified by device * drivers or kernel extensions. They may be set to * 0 in the devsw structure for devswadd(), since they * are not copied into the device switch table. */ caddr_t d_selptr;/* ptr to outstanding select cntl blks*/ ulong d_opts;/* internal device switch control field */ }; |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |