/* * The proc filesystem macros */ #ifndef _LINUX_PROC_FS_MACROS_H #define _LINUX_PROC_FS_MACROS_H #include #include #define DECLARE_PROCFS_ENTRY(name, read_proc, write_proc) \ static int name##_proc_open(struct inode *inode, struct file *file) \ { \ return single_open(file, read_proc, PDE_DATA(inode)); \ } \ static const struct proc_ops name##_proc_fops = { \ .proc_open = name##_proc_open, \ .proc_read = seq_read, \ .proc_lseek = seq_lseek, \ .proc_release = single_release, \ .proc_write = write_proc \ }; #define DECLARE_PROCFS_READ_ENTRY(name, read_proc) \ static int name##_proc_open(struct inode *inode, struct file *file) \ { \ return single_open(file, read_proc, PDE_DATA(inode)); \ } \ static const struct proc_ops name##_proc_fops = { \ .proc_open = name##_proc_open, \ .proc_read = seq_read, \ .proc_lseek = seq_lseek, \ .proc_release = single_release, \ }; #define DECLARE_PROCFS_WRITE_ENTRY(name, write_proc) \ static const struct proc_ops name##_proc_fops = { \ .proc_write = write_proc \ }; #endif /* _LINUX_PROC_FS_MACROS_H */