All file systems that the BeOS recognizes are organized hierarchically. Most file systems use hierarchical organization naturally; any other type of system must be adapted at the "file system handler" level to simulate a hierarchy. The result is that all file systems can be treated similarly in terms of their organizational architecture.
If you're in a hurry and don't care to get into the details, here's all you really have to know
File System Layout |
Navigating the File System |
The tenets of a Be-recognized hierarchical file system are these:
In the BeOS, more than one file system can be mounted at a time. Each distinct file system is mounted within the root file system (described in the next section). Because of this, all (non-root) file systems maintain distinct boundaries. However, these otherwise-tidy boundaries are smudged a bit by...
Symbolic Links. The BeOS recognizes symbolic links. A symbolic link (or "symlink") is a file that "points to" some other entry (another file, directory, or symbolic link). This other entry can live anywhere--in some other directory, or even in another file system. Because of symbolic links, the graph of the hierarchy isn't acyclic: As you follow a path through the hierarchy, it's possible to get into a loop. (If you leave symbolic links out of the picture, the graph is acyclic.)
Currently, the BeOS does not recognize hard links (although it will in the future). A hard link associates an entry in the hierarchy with a specific chunk of data (a node). The attraction of hard links is that more than one entry can be associated with the same node. |
Before looking at the file system layout, let's get one thing clear. The term "file system" is a heavily loaded monicker:
In the BeOS, this uber-system is part of the kernel. The first thing it does is mount the root file system. All other file systems are mounted within the root file system.
The structure of the root file system is a simple, two-level hierarchy:
The directories in the root file system have a prescribed purpose:
The symlinks in the root file system are less restricted. The OS creates some number of symlinks automatically (as described below), but other than that, you're free to put whatever symlinks you want in the root file system. However...
"Root-level" symlinks are simply a convenience for developers--the user won't be able to see them (the Tracker doesn't display the root file system). |
When BeOS is launched, some number of directories and symlinks are automatically created in the root file system. The directories are:
And the symlinks:
If you cd to / in a shell and list the files, you'll see something like this (where "MyDisk" is the name of the boot disk, and "fido" is a floppy):
l--------- 1 users 0 Jun 19 22:11 bin -> /boot/beos/bin drwx------ 1 users 2048 Jun 19 21:58 boot drwxr-x--- 1 users 0 Jun 19 22:11 dev l--------- 1 users 0 Jun 19 22:11 etc -> /boot/beos/etc drwxr-xr-x 1 users 2048 Jun 19 22:12 fido l--------- 1 users 0 Jun 19 22:11 MyDisk -> /boot drwxrwxrwx 1 users 0 Jun 19 22:11 pipe l--------- 1 users 0 Jun 19 22:11 system -> /boot/beos/system l--------- 1 users 0 Jun 19 22:11 tmp -> /boot/var/tmp l--------- 1 users 0 Jun 19 22:11 var -> /boot/var
If you invoke df, you'll see the list of mounted file systems:
Mount Type Total Free Flags Device ---------------- -------- -------- -------- ----- ---------------------------- / rootfs 0 0 0 /dev devfs 0 0 0 /pipe pipefs 0 0 0 /boot bfs 532950 395715 70004 /dev/disk/scsi/050/0_2 /fido bfs 1440 904 70004 /dev/disk/floppy/raw
All file systems, both persistent and virtual, are displayed. The virtual file systems are the ones that have 0 size.
A virtual file system has no backing storage. The hierarchy that it represents is maintained in memory; when you shut down the OS, all virtual file systems disappear.
Currently, the BeOS provides three virtual file system handlers:
From the developer's perspective, a virtual file system isn't much different from a persistent file system: You can create a BVolume object to represent it, you can walk through it's hierarchy , and look at its contents, and so on.
But virtual file systems are hidden from the Tracker user:
The Tracker does not display virtual file systems, nor does it let the user form a virtual fs query. |
When the kernel attempts to mount a file system, if must first find a file system handler that understands the file system's format. In other words, the handler is an intermediary between the kernel and the bytes on a disk (for example).
All file system handlers are add-ons. The kernel loads the handler add-on that it needs, and talks to it through a set of well-defined functions. The advantage of this approach is that the kernel doesn't need to know about specific file systems, it only needs to know how to talk to the handlers.
Unfortunately, the file system handler API isn't public yet...
Currently, you can't create your own file system handler. |
The handler API will be released sometime in the future.
The Be Book, in lovely HTML, for the BeOS Preview Release.
Copyright © 1997 Be, Inc. All rights reserved.
Be is a registered trademark; BeOS, BeBox, BeWare, GeekPort, the Be logo, and the BeOS logo are trademarks of Be, Inc.
Last modified July 17, 1997.