Hallo,
irgendwie steh ich grad voll auf dem Schlauch (liegt vermutlich auch an der Uhrzeit)...aber wie bekomme ich Geräteattribute in mein Kernel-Modul, damit die im sysfs als dateien angezeigt werden?! speziell geht es um name, pid und pgdir....
Ich pack noch meinen Sourcecode dazu, vielleicht wird jemand von euch da schlau draus:




#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/device.h>
#include <linux/fs.h>


MODULE_DESCRIPTION("My kernel module");
MODULE_AUTHOR("root (root@bs-host)");
MODULE_LICENSE("GPL");

static char *name;
module_param(name, charp, 0644);

struct class *bs_class;
struct device *bs_device;
static int bs_Major;

//static int device_open(struct inode *, struct file *);
//static int device_release(struct inode *, struct file *);
//static ssize_t device_read(struct file *, char *, size_t, loff_t *);
//static ssize_t device_write(struct file *, const char *, size_t, loff_t *);

static struct file_operations fops = {
// .read = device_read,
// .write = device_write,
// .open = device_open,
// .release = device_release
};

struct driver_attribute {
char* name;
int pid;
int pgdir;
};

static int bs1_init_module(void)
{
printk("<0>Module BS1 init\n" );
bs_Major = register_chrdev(0,"bs-device", &fops);
if (bs_Major<0) {
printk(KERN_WARNING "Kann keine Major-Nummer bekommen!");
return bs_Major;
}
bs_class = class_create(THIS_MODULE,"bs-class");
bs_device = device_create(bs_class,NULL,MKDEV(bs_Major,0),"bs-device");
// DEVICE_ATTR(name,0644,show_debug, NULL);
//driver_create_file(bs_device,"Name");
return 0;
}

static void bs1_exit_module(void)
{
printk("<0>Module BS1 exit\n" );
class_destroy(bs_class);
device_destroy(bs_class,MKDEV(bs_Major,0));
unregister_chrdev(bs_Major,"bs-device");
}

module_init(bs1_init_module);
module_exit(bs1_exit_module);