LDD3 scull例子感觉不错的代码

static struct scull_adev_info {
	char *name;
	struct scull_dev *sculldev;
	struct file_operations *fops;
} scull_access_devs[] = {
	{ "scullsingle", &scull_s_device, &scull_sngl_fops },
	{ "sculluid", &scull_u_device, &scull_user_fops },
	{ "scullwuid", &scull_w_device, &scull_wusr_fops },
	{ "sullpriv", &scull_c_device, &scull_priv_fops }
};
首先声明一个结构体scull_adev_info, 然后定义scull_access_devs[]数组和实现其内容。

你可能感兴趣的:(scull,scull_adev_info)