2005-04-17 05:20:36 +07:00
|
|
|
#ifndef _LINUX_MISCDEVICE_H
|
|
|
|
#define _LINUX_MISCDEVICE_H
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/major.h>
|
|
|
|
|
2010-06-09 15:39:49 +07:00
|
|
|
/*
|
|
|
|
* These allocations are managed by device@lanana.org. If you use an
|
|
|
|
* entry that is not in assigned your entry may well be moved and
|
|
|
|
* reassigned, or set dynamic if a fixed value is not justified.
|
|
|
|
*/
|
|
|
|
|
2008-11-26 18:03:54 +07:00
|
|
|
#define PSMOUSE_MINOR 1
|
|
|
|
#define MS_BUSMOUSE_MINOR 2
|
|
|
|
#define ATIXL_BUSMOUSE_MINOR 3
|
|
|
|
/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
|
|
|
|
#define ATARIMOUSE_MINOR 5
|
|
|
|
#define SUN_MOUSE_MINOR 6
|
|
|
|
#define APOLLO_MOUSE_MINOR 7
|
|
|
|
#define PC110PAD_MINOR 9
|
|
|
|
/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
|
2005-04-17 05:20:36 +07:00
|
|
|
#define WATCHDOG_MINOR 130 /* Watchdog timer */
|
|
|
|
#define TEMP_MINOR 131 /* Temperature Sensor */
|
2008-11-26 18:03:54 +07:00
|
|
|
#define RTC_MINOR 135
|
2005-04-17 05:20:36 +07:00
|
|
|
#define EFI_RTC_MINOR 136 /* EFI Time services */
|
2008-11-26 18:03:54 +07:00
|
|
|
#define SUN_OPENPROM_MINOR 139
|
2005-04-17 05:20:36 +07:00
|
|
|
#define DMAPI_MINOR 140 /* DMAPI */
|
2008-11-26 18:03:54 +07:00
|
|
|
#define NVRAM_MINOR 144
|
|
|
|
#define SGI_MMTIMER 153
|
2005-04-17 05:20:36 +07:00
|
|
|
#define STORE_QUEUE_MINOR 155
|
2008-11-26 18:03:54 +07:00
|
|
|
#define I2O_MINOR 166
|
2005-04-17 05:20:36 +07:00
|
|
|
#define MICROCODE_MINOR 184
|
2008-11-26 18:03:54 +07:00
|
|
|
#define TUN_MINOR 200
|
|
|
|
#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
|
|
|
|
#define MPT_MINOR 220
|
2009-03-09 14:27:49 +07:00
|
|
|
#define MPT2SAS_MINOR 221
|
2010-08-19 23:52:28 +07:00
|
|
|
#define UINPUT_MINOR 223
|
2008-11-26 18:03:54 +07:00
|
|
|
#define HPET_MINOR 228
|
|
|
|
#define FUSE_MINOR 229
|
|
|
|
#define KVM_MINOR 232
|
driver core: add devname module aliases to allow module on-demand auto-loading
This adds:
alias: devname:<name>
to some common kernel modules, which will allow the on-demand loading
of the kernel module when the device node is accessed.
Ideally all these modules would be compiled-in, but distros seems too
much in love with their modularization that we need to cover the common
cases with this new facility. It will allow us to remove a bunch of pretty
useless init scripts and modprobes from init scripts.
The static device node aliases will be carried in the module itself. The
program depmod will extract this information to a file in the module directory:
$ cat /lib/modules/2.6.34-00650-g537b60d-dirty/modules.devname
# Device nodes to trigger on-demand module loading.
microcode cpu/microcode c10:184
fuse fuse c10:229
ppp_generic ppp c108:0
tun net/tun c10:200
dm_mod mapper/control c10:235
Udev will pick up the depmod created file on startup and create all the
static device nodes which the kernel modules specify, so that these modules
get automatically loaded when the device node is accessed:
$ /sbin/udevd --debug
...
static_dev_create_from_modules: mknod '/dev/cpu/microcode' c10:184
static_dev_create_from_modules: mknod '/dev/fuse' c10:229
static_dev_create_from_modules: mknod '/dev/ppp' c108:0
static_dev_create_from_modules: mknod '/dev/net/tun' c10:200
static_dev_create_from_modules: mknod '/dev/mapper/control' c10:235
udev_rules_apply_static_dev_perms: chmod '/dev/net/tun' 0666
udev_rules_apply_static_dev_perms: chmod '/dev/fuse' 0666
A few device nodes are switched to statically allocated numbers, to allow
the static nodes to work. This might also useful for systems which still run
a plain static /dev, which is completely unsafe to use with any dynamic minor
numbers.
Note:
The devname aliases must be limited to the *common* and *single*instance*
device nodes, like the misc devices, and never be used for conceptually limited
systems like the loop devices, which should rather get fixed properly and get a
control node for losetup to talk to, instead of creating a random number of
device nodes in advance, regardless if they are ever used.
This facility is to hide the mess distros are creating with too modualized
kernels, and just to hide that these modules are not compiled-in, and not to
paper-over broken concepts. Thanks! :)
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Ian Kent <raven@themaw.net>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 23:07:20 +07:00
|
|
|
#define BTRFS_MINOR 234
|
|
|
|
#define AUTOFS_MINOR 235
|
2010-08-12 10:14:05 +07:00
|
|
|
#define MAPPER_CTRL_MINOR 236
|
2008-11-26 18:03:54 +07:00
|
|
|
#define MISC_DYNAMIC_MINOR 255
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
struct device;
|
|
|
|
|
|
|
|
struct miscdevice {
|
|
|
|
int minor;
|
|
|
|
const char *name;
|
2006-03-28 16:56:41 +07:00
|
|
|
const struct file_operations *fops;
|
2005-04-17 05:20:36 +07:00
|
|
|
struct list_head list;
|
2006-07-28 06:16:04 +07:00
|
|
|
struct device *parent;
|
|
|
|
struct device *this_device;
|
2009-09-19 04:01:12 +07:00
|
|
|
const char *nodename;
|
|
|
|
mode_t mode;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
extern int misc_register(struct miscdevice * misc);
|
2008-03-24 02:28:24 +07:00
|
|
|
extern int misc_deregister(struct miscdevice *misc);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define MODULE_ALIAS_MISCDEV(minor) \
|
|
|
|
MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
|
|
|
|
"-" __stringify(minor))
|
|
|
|
#endif
|