2004-06-18 19:54:17

by Adrian Almenar

[permalink] [raw]
Subject: sysfs directories...

i was looking at /sys on my machine yesterday and i found something
strange.

cd
/sys/block/hda/device/block/device/block/device/block/device/block/...
and that continues being almost infinite and recursive, it is normal
???

My Kernel Version is: 2.6.7-rc3

Cheers,

--
Adrian Almenar


2004-06-18 20:29:29

by Chris Wright

[permalink] [raw]
Subject: Re: sysfs directories...

* Adrian Almenar ([email protected]) wrote:
> i was looking at /sys on my machine yesterday and i found something
> strange.
>
> cd
> /sys/block/hda/device/block/device/block/device/block/device/block/...
> and that continues being almost infinite and recursive, it is normal

Both /sys/block/hda/device and the next element 'block' are symlinks,
so it'll top out after 40 (enforced by vfs).

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net

2004-06-18 22:07:22

by Andreas Schwab

[permalink] [raw]
Subject: Re: sysfs directories...

Adrian Almenar <[email protected]> writes:

> i was looking at /sys on my machine yesterday and i found something
> strange.
>
> cd
> /sys/block/hda/device/block/device/block/device/block/device/block/...
> and that continues being almost infinite and recursive, it is normal
> ???

Consult your favourite Unix textbook and look up "symbolic links". Then
look again at /sys/block/hda/device.

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Maxfeldstra?e 5, 90409 N?rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2004-06-18 22:58:43

by Greg KH

[permalink] [raw]
Subject: Re: sysfs directories...

On Fri, Jun 18, 2004 at 03:51:17PM -0400, Adrian Almenar wrote:
> i was looking at /sys on my machine yesterday and i found something
> strange.
>
> cd
> /sys/block/hda/device/block/device/block/device/block/device/block/...
> and that continues being almost infinite and recursive, it is normal
> ???

What does:
ls -l /sys/block/hda

show?

thanks,

greg k-h

2004-06-19 08:01:20

by V13

[permalink] [raw]
Subject: Re: sysfs directories...

On Friday 18 June 2004 22:51, Adrian Almenar wrote:
> i was looking at /sys on my machine yesterday and i found something
> strange.
>
> cd
> /sys/block/hda/device/block/device/block/device/block/device/block/...
> and that continues being almost infinite and recursive, it is normal
> ???

It's a bash trick when changing dir to a symlink:

hell:/sys/block/hda$ cd device
hell:/sys/block/hda/device$ cd block
hell:/sys/block/hda/device/block$ cd device
hell:/sys/block/hda/device/block/device$ cd block
hell:/sys/block/hda/device/block/device/block$ pwd
/sys/block/hda/device/block/device/block
hell:/sys/block/hda/device/block/device/block$ /bin/pwd
/sys/block/hda
hell:/sys/block/hda/device/block/device/block/device$ pwd
/sys/block/hda/device/block/device/block/device
hell:/sys/block/hda/device/block/device/block/device$ /bin/pwd
/sys/devices/pci0000:00/0000:00:04.1/ide0/0.0

<<V13>>