1, head file
#include
2, API
struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
struct proc_dir_entry *parent);
struct proc_dir_entry *create_proc_read_entry(const char *name,
mode_t mode, struct proc_dir_entry *base,
read_proc_t *read_proc, void * data);
void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
3, read_proc_t, write_proc_t
int proc_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
printk(KERN_INFO "enter proc_readm off = %d, count = %d\n", off, count);
int data_len = 0;
data_len = sprintf(page, "%d\n", pMDEV->totalsize);
data_len -= off;
if (data_len < 0)
data_len = 0;
*eof = (data_len <= count) ? 1 : 0;
*start = page + off;
return data_len;
}
int proc_write(char *page, char **start, off_t off, int count, int *eof, void *data)
{
return 0;
}
阅读(766) | 评论(0) | 转发(0) |