下面代码会产生/sys/module/xxx/security/testhello 配置文件
#include <linux/kmod.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
int g_testhello;
struct attribute att={"testhello",THIS_MODULE,0644};
struct attribute *default_attr[]={
&att,
NULL
};
static int my_atoi(const char *name)
{
int val = 0;
for (;; name++) {
switch (*name) {
case '0' ... '9':
val = 10*val+(*name-'0');
break;
default:
return val;
}
}
}
static void test_cache_release(struct kobject *kobj)
{
kfree(kobj);
}
static ssize_t test_attr_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{
printk("***