Mario 'BitKoenig' Holbe a écrit :
Neil Brown <neilb@xxxxxxx> wrote:
On Wednesday October 21, stephane.bunel@xxxxxxxxxxxxxxxxx wrote:
0 8 0 0 active sync /dev/char/21:0
1 8 16 1 active sync /dev/char/21:1
What is a block device doing in /dev/char ??? There should only be
character devices in there.
major 21 are usually SCSI generic devices (/dev/sg) and they are char...
crw-rw---- 1 root root 21, 0 Oct 10 21:48 /dev/sg0
crw-rw---- 1 root root 21, 1 Oct 10 21:48 /dev/sg1
The question is, why do they appear at mdadm --detail
mdadm performs a physical walk to not follow symbolic links (cf nftw(
FTW_PHYS ) in map_dev() ). But using stat() mdadm finaly follow the symbolic
link and so returns the same type/major/minor as the targeted link.
lstat() is identical to stat(), except that if path is a symbolic link,
then the link itself is stat-ed, not the file that it refers to.
#ls -la /dev/char/21:0
lrwxrwxrwx 1 root root 13 2009-10-16 18:12 /dev/char/21:0 -> ../raid_disk0
Tested from Python:
>>> import os, stat
Using stat:
>>> mode = os.stat( '/dev/char/21:0' )[ stat.ST_MODE ]
>>> stat.S_ISBLK( mode )
True
using lstat():
>>> mode = os.lstat( '/dev/char/21:0' )[ stat.ST_MODE ]
>>> stat.S_ISBLK( mode )
False
Stéphane Bunel.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html