This is the mail archive of the
mailing list for the eCos project.
Re: Should hard links to directories work?
- From: Bart Veer <bartv at ecoscentric dot com>
- To: Ross Younger <wry at ecoscentric dot com>
- Cc: ecos-devel at ecos dot sourceware dot org
- Date: Wed, 20 May 2009 14:45:13 +0100
- Subject: Re: Should hard links to directories work?
- References: <4A13F762.firstname.lastname@example.org>
>>>>> "Ross" == Ross Younger <email@example.com> writes:
Ross> The Unix world traditionally shuns such things as an
Ross> abomination. The eCos docs are quiet on the subject, as is
Ross> the code in ramfs and jffs2. Should they work? Does anybody
Ross> use them?
Ross> (By the way: I started this discussion with a bugzilla
Ross> ticket, which as Andrew points out is probably the wrong
Ross> http://bugzilla.ecoscentric.com/show_bug.cgi?id=1000775 )
"The link() function creates a new link (directory entry) for the
existing file, path1.
The path1 argument points to a pathname naming an existing file. The
path2 argument points to a pathname naming the new directory entry
to be created. The link() function will atomically create a new link
for the existing file and the link count of the file is incremented
If path1 names a directory, link() will fail unless the process has
appropriate privileges and the implementation supports using link()
So creating links to directories is not completely disallowed, but
from my reading it is certainly discouraged. I would be happy with
changes to ramfs and jffs2 to prevent new links to directories.
jffs2 should probably continue to support such links in an existing
filesystem, in case they are created in another OS.
Bart Veer eCos Configuration Architect
eCosCentric Limited The eCos experts http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.