6

Does anybody know one? preferrably with linux implementation?

alternatively, does anybody know how much effort would it take to add it in any open-source implementation? (i mean: maybe it's enough to change an if statement, maybe i have to go carefully trhough the whole fs implementation adding tests; do you have that notion? ).

thanks....

ribamar
  • 1,435
  • 1
  • 16
  • 26

2 Answers2

4

HFS+ allows directory hardlinks in OSX 10.5. Only TimeMachine can create them since OSX 10.6, and HFS+ does some sanity checking that they do not introduce cycles.

However, Linux will not read them. Besides filesystems, this could be enforced at the VFS layer. Even if there are no cycles, some userspace tools rely on having no directory hard links (eg, a GNU find optimisation that lets it skip many directories; it can be disabled with -noleaf ).

Tobu
  • 24,771
  • 4
  • 91
  • 98
2

Technically nothing keeps you from opening /dev/sda with a hex editor and creating one. However everything else in your system will fall apart if you do.

The best explanation i could find is this quote from jta:

User-added hardlinks to directories are forbidden because they break the directed acyclic graph structure of the filesystem (which is an ASSERT in Unixiana, roughly), and because they confuse the hell out of file-tree-walkers (a term Multicians will recognize at sight, but Unix geeks can probably figure out without problems too.

Martin Olsen
  • 1,895
  • 1
  • 17
  • 20
  • This answer doesn't answer accurately, but is helpful in the sense that the problem may be in the kernel, and not in the fs implementations (I was suspicious that there was simply no fs implementations handling dir hard links in linux, not that the kernel "forbids" it). Would it be, however, simple or too much complex to change the kernel implementation to prevent "everything else in your system will fall apart if you do"? – ribamar Dec 11 '10 at 12:44
  • 2
    Martin is correct. It is not just the kernel that won't like it, userspace tools also assume that the filesystem is a directed acylic graph. The kernel enforces the restriction. – mark4o Dec 11 '10 at 18:24
  • 1
    The presence of directory hardlinks alone doesn't break the DAG property - only if you create a cycle does this become a problem. – caf Dec 12 '10 at 12:49