kmalloc (sizeof (struct xxx_dev), GFP_KERNEL);
#include <linux/cdev.h>
void cdev_init (struct cdev *cdve, struct file_operations *fops)
void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);
kobject_init(&cdev->kobj, &ktype_cdev_default);
cdev->ops = fops;
}
dev->cdev.owner = THIS_MODULE;
dev->cdev.ops = &globalmem_fops;
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |