Linux????????????豸?????????????豸?????豸
???????????? ???????[ 2013/5/7 9:57:29 ] ????????
????????????????????????豸????????????????豸???1??????LANANA????????豸??10?????????豸??????????????????????????Щ??????????????й???????г??Щ???豸???????????????????塣
??1 ???????豸??1????????豸??
?????Щ?豸?????????????????/dev/null???????豸??????????????????????????Щ???豸???漰????????????????????к??????????????1?????豸???1??memory_fops?ж???????Щ??????????????£?
????driver/char/mem.c
static const struct file_operations memory_fops = {
.open = memory_open??
.llseek = noop_llseek??
};
???????к???memory_open???????????????????豸????????豸??????????
static int memory_open(struct inode *inode?? struct file *filp)
{
int minor;
const struct memdev *dev;
minor = iminor(inode); /* get the minor device number commented by guoqingbo */
if (minor >= ARRAY_SIZE(devlist))
return -ENXIO;
dev = &devlist[minor];/* select the specific file_operations */
if (!dev->fops)
return -ENXIO;
filp->f_op = dev->fops;
if (dev->dev_info)
filp->f_mapping->backing_dev_info = dev->dev_info;
/* Is /dev/mem or /dev/kmem ? */
if (dev->dev_info == &directly_mappable_cdev_bdi)
filp->f_mode |= FMODE_UNSIGNED_OFFSET;
if (dev->fops->open) //open the device
return dev->fops->open(inode?? filp);
return 0;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11