lkml.org 
[lkml]   [1999]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Question about hard links...
On Thu, 12 Aug 1999, Micahel Zappe wrote:

> Does anyone out there see any problems with the second solution that could
> arise?
Yes.

if(link(oldfile, newfile) >= 0) unlink(oldfile); else perror("Rename failed");

> If it may cause problems, does anyone know of any popular
> applications that require hard links?
News demons use hard links.

Well really, you can do it but...

The only way to make symlinks reliably emulate hard links is to make it
something like this:

link()
{
if [ -f $1 ]
then
NEXTNAME= ...
mv $1 /linkdir/$NEXTNAME
ln -s /linkdir/$NEXTNAME $1
fi
LINKNAME=`readlink $1`
ln -s $LINKNAME $2
}

You'll also need to do something about keeping link counts so can move the
file out of the links directory when there's only one pointer at it.

UMSDOS doesn't do this so there are problems with empty directories that
aren't really ...

Of course this all defeats your purpose slightly :-)

Or perhaps not, they could have a quota on the links directory too.

--
Rob. (Robert de Bath <http://poboxes.com/rdebath>)
<rdebath @ poboxes.com> <http://www.cix.co.uk/~mayday>



-
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.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.751 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site