xfs
[Top] [All Lists]

Re: Hard Links

To: "Quang Nguyen (Ngo)" <quang.nguyen@xxxxxxxxxxxx>
Subject: Re: Hard Links
From: Jean Francois Martinez <jfm2@xxxxxxxxxxxxxxxx>
Date: Thu, 13 Dec 2001 01:35:45 +0100
Cc: "'Steve Lord '" <lord@xxxxxxx>, "''linux-xfs@xxxxxxxxxxx' '" <linux-xfs@xxxxxxxxxxx>
References: <ACD4093EB009D411BC8A009027D7699660A16F@xxxxxxxxxxxxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
"Quang Nguyen (Ngo)" wrote:
> 
> If I remember correctly, NextStep did provide hardlinks to directories.  I
> wonder if OSX's native FS does support them.  Anyway, I'm writing a backup
> utility, so I thought I might need to pay attention to them in case, they're
> there.
> 
> Thanks,
> Quang


Original Unix (V7 and older) didn't have an mkdir() system call.  The
mkdir 
program created an inode of directory type and then it created two
hardlinks
named . and ..  Thus the need for allowing hard links to directories.  
That
 meant mkdir program had to be setuid root and that if
it was killed at an untimely moment it would let you with a partly built 
directory.   When Unixes got mkdir system call there was no longer a
reason
to allow hard linking to directories but vendors were probably afraid to
break
programs who were building directories directly without using the mkdir
program
or a library function.  Since Linux was started from scratch it didn't
need to
allow hard links to directories. 

> 
> -----Original Message-----
> From: Steve Lord
> To: Quang Nguyen (Ngo)
> Cc: 'linux-xfs@xxxxxxxxxxx'
> Sent: 12/11/01 12:12 PM
> Subject: Re: Hard Links
> 
> On Tue, 2001-12-11 at 14:08, Quang Nguyen (Ngo) wrote:
> > Is XFS going to support hard links to directories?
> >
> > # ln -d dir dirLink
> >
> > returns
> >
> > ln: creating hard link `../dirLink' to `dir': Operation not permitted
> 
> Generally you do not want to do this, you can create loops and all
> sorts of nasty things with hardlinks to directories. The man page for
> link even explicitly lists an error for this:
> 
>        EPERM  oldpath is a directory.
> 
> You also have to ask yourself, if there are two hardlinks to a
> directory, which directory is its parent.
> 
> You can create soft links to directories though.
> 
> Steve
> 
> _____________________________________________________________________
> This message has been checked for all known viruses by the
> MessageLabs Virus Scanning Service. For further information visit
> http://www.messagelabs.com/stats.asp
> 
> [[HTML alternate version deleted]]

-- 
Jean Francois Martinez

Project Independence http://independence.seul.org
Because Linux should be for everyone


<Prev in Thread] Current Thread [Next in Thread>