📄 debugfs_compat.h
字号:
/* Ripped from include/linux/fs.h in the 2.6.14 kernel. */#ifndef _DEBUGFS_COMPAT_H#define _DEBUGFS_COMPAT_H/* * simple attribute files * * These attributes behave similar to those in sysfs: * * Writing to an attribute immediately sets a value, an open file can be * written to multiple times. * * Reading from an attribute creates a buffer from the value that might get * read with multiple read calls. When the attribute has been read * completely, no further read calls are possible until the file is opened * again. * * All attributes contain a text representation of a numeric value * that are accessed with the get() and set() functions. */#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \static int __fops ## _open(struct inode *inode, struct file *file) \{ \ __simple_attr_check_format(__fmt, 0ull); \ return simple_attr_open(inode, file, __get, __set, __fmt); \} \static struct file_operations __fops = { \ .owner = THIS_MODULE, \ .open = __fops ## _open, \ .release = simple_attr_close, \ .read = simple_attr_read, \ .write = simple_attr_write, \};static inline void __attribute__((format(printf, 1, 2)))__simple_attr_check_format(const char *fmt, ...){ /* don't do anything, just let the compiler check the arguments; */}int simple_attr_open(struct inode *inode, struct file *file, u64 (*get)(void *), void (*set)(void *, u64), const char *fmt);int simple_attr_close(struct inode *inode, struct file *file);ssize_t simple_attr_read(struct file *file, char __user *buf, size_t len, loff_t *ppos);ssize_t simple_attr_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos);ssize_t compat_simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos, const void *from, size_t available);#endif /* _DEBUGFS_COMPAT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -