5 ms·
I wonder if we're doing virtual filesystems wrong. There is a good reason why traditionally filesystem access was mediated by the OS layer, but there are many
by ithkuil 7d ago
I wonder if we're doing virtual filesystems wrong.
There is a good reason why traditionally filesystem access was mediated by the OS layer, but there are many use cases where you just want to give processes a different view of what they already can access and it could be done as a library in the same userspace process.
However, for that to work across all the processes in a session we'd need a standard way to install such a hook in all peocesses and that's achievable to some extent using LD preload but falls apart quite rapidly with statically built binaries or different libcs
- mpweiher 7d agoI think there is a good case to be made for these things not to be mediated by the operating system by default. In Objective-Smalltalk[1], I can access a file as follows: hello ← file:hello-world.txt This is structurally the same way I would access a local variable, environment variable, database, remote http server etc. hello ← https://example.com/hello-world.txt hello ← env:GREETING hello ← var:greeting // hello defaults to var:hello etc. And you can also introduce shortcuts scheme:greeter ← ref:https://example.com/ asScheme. hello ← greeter:hello-world.txt Or scheme:greeter ← ref:file:./ asScheme hello ← greeter:hello-world.txt Sending -asScheme to a reference is just a shorthand that actually constructs a composition[2] of a "path relative" store with the underlying store of the original reference. So the following two are identical: scheme:greeter ← ref:https://example.com/ asScheme. scheme:greeter ← #MPWRelativeScheme{ base: 'https://example/com' } → #MPWURLSchemeResolver{} This composition mechanism can be carried further with post-processing, so for example an img-scheme can be constructed by composing an image-decoder store with the previous store scheme:img ← #MPWImageDecoderStore{} → scheme:greeter helloPic ← img:wave.png And so on and so forth, caching is also a nice example. [1] https://objective.st https://objective.st [2] https://dl.acm.org/doi/10.1145/3359591.3359729 https://dl.acm.org/doi/10.1145/3359591.3359729