Re: char-major

From: Spamless (Spamless_at_Nil.nil)
Date: 07/23/04


Date: Fri, 23 Jul 2004 15:20:23 GMT

In article <pan.2004.07.23.14.29.55.11946@jumpy.it>, Mauro G. wrote:
> I need to understand what is the mean of aliases "char-major-..." or
> "block-major-..."
> Does anyone help me?!

Linux uses a "file" method to access kernel services.
You have a directory /dev.
Those are not devices. They are nodes (created with mknod)
to point to kernel routines (either in the kernel or loaded
from modules if the kernel was compiled with module support
for that device).

Some devices are block devices and some are character oriented
devices.

If you do an "ls -l /dev" you will find entries such as:

brw-rw---- ... 3, 1 Sep 15 2003 hda1
crw------- ... 14, 0 Jul 22 21:14 mixer0

The first character (b or c) indicates block or character
device. While the /dev system uses what "appear" to be
file entries (so you can dump stuff to /dev/[something]
to get it handled by the driver which handles that sort
of data), they are actually tracked by a type, major number
and minor number.

In the above, hda1 is a block device with major number 3
and minor number 1 (often the minor numbers simply represent
different location for the same sort of item, e.g. disk1,
disk2, etc.).

If you have the kernel source installed, the text file:
  /usr/src/linux/Documentation/devices.txt
has the list of devices - type and major and minor numbers
(you can have one block device and on character device with the
same major/minor numbers such as
  9,1 (major,minor) character device: /dev/st1 Second SCSI tape, mode 0
  9,1 (major,minor) block device: /dev/md1 Second metadisk group
(minor number 0 would be the First SCSI tape and metadisk group)



Relevant Pages

  • [RFC] [PATCH] A clean approach to writeout throttling
    ... each line of code removed from the kernel is worth ten ... save kernel memory and make the kernel ... We seriously began to tackle the issue of block writeout vm deadlock ... Any block device with a user space component ...
    (Linux-Kernel)
  • Re: Screw Linux, Im going back to Windows!
    ... >> - The module unloader decides the CD driver is no longer ... >> But we need some kernel support. ... >> physical device from the block device even when it is ... We need it to be changed even during the time the filesystem ...
    (comp.os.linux.security)
  • Re: [PATCH] Allow userspace block device implementation
    ... this older thread deals with some aspects of that idea: http://communities.vmware.com/message/577841 ... Allow userspace block device implementation ... The patch included allows one to implement a kernel level block device ...
    (Linux-Kernel)
  • Re: [dm-devel] [RFC] dm-userspace
    ... machine transparently as a normal block device would be ideal. ... Actual data flow should happen only in the kernel, and userspace ... In addition to providing support for the above scenario, dm-userspace ...
    (Linux-Kernel)
  • Re: Request for comments on new disk installation plan
    ... kernel to use LVM. ... If you use the debian kernel, ... This requires the destination to be at least the size of the source. ... same size as the source block device. ...
    (Debian-User)