class_create()
-------------------------------------------------
linux-2.6.22/include/linux/device.h
struct class *class_create(struct module *owner, const char *name)
class_create - create a struct class structure
@owner: pointer to the module that is to "own" this struct class
@name: pointer to a string for the name of this class.
在/sys/class/下创建类目录
class_device_create - creates a class device and registers it with sysfs
@cls: pointer to the struct class that this device should be registered to.
@parent: pointer to the parent struct class_device of this new device, if any.
@devt: the dev_t for the char device to be added.
@device: a pointer to a struct device that is assiociated with this class device.
@fmt: string for the class device's name对于没有指定dev->parent的dev都将被添加到/sys/devices/virtual/tty/ 目录下,如果指定了dev->parent,那么同时该dev->class存在,同时parent->class存在,那么该dev->name目录将被添加到parent->class所在目录下****@*****:~$ ls -a /sys/class/tty/console
lrwxrwxrwx 1 root root 0 2009-06-30 09:40
/sys/class/tty/console->../../devices/virtual/tty/console ****@*****:~$ ls -a/sys/devices/virtual/tty/console/
total 0 -rw-r--r-- 1 root root 4.0K 2009-06-30 10:51 uevent
drwxr-xr-x 2 root root 0 2009-06-30 10:51 power
lrwxrwxrwx 1 root root 0 2009-06-30 10:57 subsystem->../../../../class/tty -r--r--r-- 1 root root 4.0K 2009-06-30 10:57 dev