1. 23
  1. 6

    Huh, I never realized that VFS meant Virtual Filesystem Switch. I thought it stood for just “Virtual FileSystem”.

    1. 1

      Me either. Wikipedia offers both as possible expansions.

    2. 4

      Another important aspect of YAGNI. They didn’t need it, until they did, at which point they wrote an abstraction that would actually work for their use case. I don’t doubt the API would have been more block oriented had the original authors wrote the abstraction before NFS came along.

      1. 1

        You can afford YAGNI only if you have (or happen to have) a decent abstraction already in place.

        In this specific case, for instance, the VFS would had not been possible had the strict userland/kernel separation via the syscall API not existed. Or if some internal detail of the initial filesystem leaked through it and could not be faked.

        I’m a big proponent of YAGNI, but too often I see it used as an argument against doing any architectural planning at all.

        1. 1

          Some things did leak. Directory enumeration on early UNIX systems worked by opening the directory (as if it were a regular read-only file) and reading the data directly. This wasn’t too bad because it was read only and so other filesystems could fake it until userspace things were moved to supporting more abstract APIs. Inode numbers still leak today (right up to the user in the output of ls -l), for example and non-inode-based filesystems need to fudge inodes from somewhere.

          It probably helped that the filesystem is, itself, an abstraction. The raw interface is a block device, a filesystem adds namespaces, dynamic allocation of space, atomicity and concurrency semantics, and so on. On a UNIX system the namespace abstraction was already a slightly abstracted thing because of the notion of a ‘special file’, which could represent device nodes or named pipes (for example), which made it a bad idea to assume too much about the underlying data structures.

          1. 1

            not been possible

            More work touching more components, perhaps, but how would it have not been possible?

            There’s no doubt that well designed interfaces can help limit churn in the face of changing requirements. But the only way to really know if an interface is well designed is if it stands up to changing requirements. Catch 22.

            And even then, each interface has a cost. And it’s not always clear if they’re worth the cost.

        2. 2

          This caused me to wonder: is there a virtual filesystem like /proc on Windows?

          1. 6

            I’m not sure if this is a kernel feature or just a clever shell trick, but PowerShell lets you browse the Registry like a file system (cd HKLM:\)

            Windows Explorer is infinitely pluggable, with Shell Extensions. The Control Panel (used to?) be part of the Explorer shell, too.

            1. 5

              That’s actually a PowerShell provider. Another useful one is Env:\.

              1. 3
                1. 2

                  neat, but it only works on the cli, a real VFS in my eyes also allows explorer to access it without any additions

                2. 6

                  As others have pointed out, you can get things that expose that in Windows, but that’s not how Windows thinks of things.

                  Instead, in Windows, everything is an object. Objects, not files, are the fundamental building block—and like files in Plan 9, it’s objects all the way down. Files? Objects. Directories? Objects. Windows? Objects. Processes? Objects. Objects? Objects. In this way, I actually find the abstraction pleasing and complete, and its peer technologies, like COM and WSH, make Windows development very pleasant (at least to me), but files it ain’t.

                  You can use a tool called WinObj to view the hierarchy, and tools like the ones linked down thread attempt to let you browse the object manager as if it were a VFS, but be aware that doing so is like compressing a 3D object into a 2D space. You’re losing an awful lot of information.

                  1. 6

                    I don’t see the appeal of files either. Files are unstructured byte streams, which requires serialization and parsing to communicate.

                  2. 1

                    Windows has native NT paths that can give access to various internals. They have the UNC form starting with \\?\, \\.\ or \??\ . I don’t really know enough about windows to tell you more, but WinObj is good for exploring these.

                    1. 1

                      By default - I don’t think so. Can there be - yes. https://www.crossmeta.io/fuse-for-windows/