debugfs例子
static ssize_t anycall_write(struct file *file, const char __user *user_buf, size_t size, loff_t *ppos) { char buf[64]; int buf_size; int ret=0; buf_size = min(size, (sizeof(buf) - 1)); if (strncpy_from_user(buf, user_buf, buf_size) < 0) return -EFAULT; buf[buf_size] = 0; if (ret < 0) return ret; runAny(buf); return size; } static const struct file_operations anycall_fops = { .owner = THIS_MODULE, .write = anycall_write, }; static int __init anycall_init(void) { struct dentry *dentry; dentry = debugfs_create_file("anycall", S_IRUGO, NULL, NULL, &anycall_fops); printk(KERN_ERR "[anycall]install anycall !!!!\n");; return 0; }
补充:软件开发 , C++ ,