One of the unique features of BeOS is the way the Operating System holds a reference to a disk file.
To understand this and why it is difficult to emulate this on other operating systems, you will need a primer on how a traditional Unix file system is built. I will be quick, I promise.
Files are stored on disks. There are a lot of kinds of disks, all referred to as devices. Every device has a unique device_id
– a counting number. Each device is divided in blocks (of some hundreds of bytes). When you want to write a file to a device, you take some blocks enough to fit your file in, link them in a chain and write file content to the blocks chain. But how do you store who owns the file? Where (which block) the file starts? This is a job of nodes. Node is a piece of data, bookkeeping all the meta information on the file. Owner, group, permissions, ACL, attributes… Name? No, not the name. On a Unix filesystem one file can be known under many names – all sharing the same meta-information and content, uniquely identified by node_id
. A rose by any other name would smell as sweet.
So, how do you identify a file by a /file/path
we all are familiar with? There are special files on disk, called directories, which keep the "filename -> node_id"
mapping. The entries in the directory file are called links. There is no restrictions on how many times and under how many names you can list one node_id
. The entries that point to a node being another directory are called… sub-directories.
Now you see that deep path traversal can be time consuming, as you need to read and scan many directory files.
BeOS just skips all of that directory nonsense. If you want to refer to a disk file, you just need two pieces of data: device_id
and node_id
on that device. Two numbers – which uniquely identify a file on your, particular machine. You just go to the device, find a node on that device and you have all that is needed to open a file.
It’s not that simple on Linux/Unix. In order to be able to access a file, you need at least x
(execute) permission on all directories leading to the file and r
(read) permission on the file itself. It is not possible to access a random node
number on a disk device. Thus, it is not possible to pass reference to a file by a simple two numbers (device_id
and node_id
) which BeOS calls node_ref
and is using everywhere…