小编mic*_*ael的帖子

从内核模块使用sysfs时出现未知符号错误

嘿,我正在尝试使用sysfs一点点,从用户空间获取一些数据到我的内核模块.这是代码:

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/elf.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>

#define PRINT(x) printk(KERN_INFO x "\n")
#define ERROR(fmt,arg...) printk(KERN_ALERT "Error - " fmt,##arg)



ssize_t mystore (struct kobject *obj,
                    struct attribute *attr, const char *buff, size_t count)
{
 /* doing a little bit */
        return count;
}


ssize_t myshow (struct kobject *obj, struct attribute *attr, char *buff)
{
    return 0;
}

char file_name[] = "myfile";
static struct attribute myattribute = {
    .name = file_name,
    .mode …
Run Code Online (Sandbox Code Playgroud)

c linux kernel module

2
推荐指数
1
解决办法
4248
查看次数

标签 统计

c ×1

kernel ×1

linux ×1

module ×1