嘿!single_open 原来在这里
2014-08-07 21:54
288 查看
嘿!single_open 原来在这里
找了一会儿,没找到,后面找某搜索引擎也没有很多关于single_open的信息
其实single_open和single_release 都在/linux/seq_file.h
里面
int single_open(struct file *file, int (*show)(struct seq_file *, void *),
void *data)
{
struct seq_operations *op = kmalloc(sizeof(*op), GFP_KERNEL);
int res = -ENOMEM;
if (op) {
op->start = single_start;
op->next = single_next;
op->stop = single_stop;
op->show = show;
res = seq_open(file, op);
if (!res)
((struct seq_file *)file->private_data)->private = data;
else
kfree(op);
}
return res;
}
找single_open和single_release的初衷是因为在LDD的demo里面看到这个函数了,但是书上又没有。。。
囧~不知道是不是内核版本的原因诶。。
LDD的demo里面这样用的
static int jit_timer_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, jit_timer_proc_show, NULL);
}
传入了一个struct file结构体指针和inode指针传进去了,inode没用
真希望能再去一次啊~ 腿疼神马的木有关系~
找了一会儿,没找到,后面找某搜索引擎也没有很多关于single_open的信息
其实single_open和single_release 都在/linux/seq_file.h
里面
int single_open(struct file *file, int (*show)(struct seq_file *, void *),
void *data)
{
struct seq_operations *op = kmalloc(sizeof(*op), GFP_KERNEL);
int res = -ENOMEM;
if (op) {
op->start = single_start;
op->next = single_next;
op->stop = single_stop;
op->show = show;
res = seq_open(file, op);
if (!res)
((struct seq_file *)file->private_data)->private = data;
else
kfree(op);
}
return res;
}
找single_open和single_release的初衷是因为在LDD的demo里面看到这个函数了,但是书上又没有。。。
囧~不知道是不是内核版本的原因诶。。
LDD的demo里面这样用的
static int jit_timer_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, jit_timer_proc_show, NULL);
}
传入了一个struct file结构体指针和inode指针传进去了,inode没用
真希望能再去一次啊~ 腿疼神马的木有关系~
相关文章推荐
- XAMPP 启动mysql报错 InnoDB: Error: could not open single-table tablespace file……
- 闲聊linux中的input设备(10) 原来你也在这里
- 闲聊linux中的input设备(10) 原来你也在这里
- (转)MDB链接SQLSERVER导致写入冲突,头疼的问题,原来错在这里!!
- Mac 下MAMP Pro MySQL无法启动报 Error: could not open single-table tablespace file ./mysql/innodb_table_sta
- 原来新随笔在这里写,找了老半天
- 闲聊linux中的input设备(10) 原来你也在这里
- 兼容,原来在这里就已经開始--------Day34
- Single Log Out with OpenSAML
- SSD(Single Shot MultiBox Detector):create_list.sh io.cpp:187 Could not open or find file
- 原来你也在这里
- Ukulele 原来你也在这里
- 原来你也在这里
- 原来问题在这里-我的memory leak诊断历程
- 正则,原来你就在这里
- 兼容,原来在这里就已经开始--------Day34
- iOS提交时Build(构建版本)迟迟没有+号出现,后来收到苹果邮件原来问题在这里
- [导入]感悟一首:"原来你也在这里"
- SQL——回头看,原来“事务”在这里!!!
- javascript中window.open在原来的窗口中打开新的窗口(不同名)