Re: dev=[0000]

H. Peter Anvin (hpa@transmeta.com)
25 Aug 1998 23:24:24 GMT


Followup to: <199808252058.QAA26064@red.seas.upenn.edu>
By author: "Vladimir Dergachev" <vladimid@seas.upenn.edu>
In newsgroup: linux.dev.kernel
>
>
> I know I asked this question before, but apparently there is more to it than
> I thought..
>
> Here goes=
> in struct bufferhead { } there are two kind of fields for device:
> b_dev and b_rdev.. b_rdev is (in comments) said to be the "real" device
> (whatever this means) b_dev has a comment saying that when it's equal to
> B_FREE( current value 0xffff) the bufferhead is free. However when I list
> the current buffer contents I get a lot of entries with b_rdev equal to 0
> and b_dev!=B_FREE. So what is this device 0 ? One of previous answers
> suggested that the 0 device is kernel's equivalent of NULL pointer, but
> now I think it is not.. Here is an example of such :
>
> anua:/proc/103/fd# ll
> total 0
> l-wx------ 1 anya users 64 Aug 25 16:52 1 -> [0304]:244877
> l-wx------ 1 anya users 64 Aug 25 16:52 2 -> [0304]:244877
> lr-x------ 1 anya users 64 Aug 25 16:52 0 -> [0304]:236684
> lrwx------ 1 anya users 64 Aug 25 16:52 5 -> [0000]:785
>
> (103 is kaudioserver)
>
> You see that the last file descriptor points to inode on device 0.
> You can also find a lot of such inodes if you look in the entry corresponding
> to Xserver..
>
> So what are they ? Are they sockets ? Are they buffered ?
>

Major 0 is usually used for anonymous mounts (filesystems with "nodev"
in /proc/filesystems), but major 0 minor 0 is reserved as "no such
device". If it's used for other things, then that is a bug. However,
a bug such that anonymous mounts are allocated minors starting at 0
instead of 1 isn't really particularly far-fetched.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html