> Carl Lowenstein wrote:
> > On 8/23/05, JD Runyan <[EMAIL PROTECTED]> wrote:
> > 
> >>As far as hard links go, you can only use them in the same 
> filesystem.
> >>They are useful for allowing one group of people rights to alter a 
> >>file, and another group the rights to view a file, because 
> each link 
> >>to the file has its own permissions.
> > 
> > 
> > Well, I don't think so.  See below for a quick experiment:
> 
> I stand corrected. I swear I used to do that, but lord knows 
> what kind of system I was on. So after a little research, it 
> appears the only advantage to a hard link, is it is exactly 
> like the original, while a soft/sym link is a pointer to the 
> location of the original.

Yup.  Browsing through the kernel source... The file's "mode" is in the
inode structure as "i_mode", where as dirent only contains "d_ino" as a
reference to that directory entry's inode.

Also, it appears that soft/sym links use another inode.  The big advantage
to hard links as I see it is the inode maintains a reference count.  When
files are hard linked, the reference count for the relevant inode is
incremented.  When files are "rm"ed, the reference count is decremented.
For sym links, "rm"ing the file results in a broken link.

-Jon


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to