Page 1 of 1

VFS Path Stylings Idea

Posted: Thu May 14, 2009 7:00 pm
by AaronMiller
Hullo all. :) I have an idea, and I was wondering if you wouldn't mind telling me what you think -- it's fairly simple for me to implement at the moment.

Okay, a bit of information first -- I like the Windows FS style (except the backslashes), and I like the Unix FS style. And what I mean by that; Windows: C:\Windows\System32\User32.dll -- Unix (to access the same file): /dev/sda/Windows/System32/User32.dll

I was thinking I could combine the two VFS' in a way that you could use either VFS path name to reference the same file. The idea is that this path name:
C:/Windows/System32/User32.dll

Would be equal to one of these path names:
/mount/sda/Windows/System32/User32.dll -- Note: /mount is where all the mounted devices go in my OS
hd0:/Windows/System32/User32.dll

Basically, what is going on there is that whenever a colon ':' is used, it references one of the mounted file systems in the /mount directory. Like an alias. The 'C:' would basically be an alias of 'hd0' or 'hd1' or whatever.

I got this idea while playing with PlayStation 2 homebrew -- I noticed a path name like this:
mc0:somedir/somefile.ext

I actually liked that a bit, and figured it could be an optional way to reference files in my OS. :) What do you guys think?


Cheers,

-naota

Re: VFS Path Stylings Idea

Posted: Thu May 14, 2009 7:15 pm
by Love4Boobies
The whole concept of mounting doesn't work with Windows-style paths. What's stopping me from mounting my floppy drive in /mount/sda/Windows/System32/floppy ? If you can only mount in one place then it's Windows-style anyway so you're just replacing "/" with "\"which isn't much of a VFS thing. Actually, even Windows recognizes the "/" character as a separator.

Re: VFS Path Stylings Idea

Posted: Thu May 14, 2009 7:25 pm
by AaronMiller
No, I didn't mean it like that. ;)
I meant the specialized shortcut. "blarg:/hi.txt"

Cheers,

-naota

Re: VFS Path Stylings Idea

Posted: Thu May 14, 2009 7:27 pm
by Love4Boobies
I know. But I just told you why it wouldn't work. A: can be mounted inside C:.

Re: VFS Path Stylings Idea

Posted: Thu May 14, 2009 7:35 pm
by AaronMiller
Oh, I see what you mean.

No, that aliasing only takes place in the '/mount' directory. 'A' (fd0) would be a device -- mounted by its own driver to the mount directory -- A is an alias of /mount/fd0 at /mount/A -- A can be changed to be, for example, C:/Floppy

By the design of my own VFS, fd0 can't be deleted -- it doesn't make sense to allow it to be deleted (unmounted, yes.) -- I forgot what relevance that had, but thought I'd share that anyways.


Cheers,

-naota

Re: VFS Path Stylings Idea

Posted: Thu May 14, 2009 7:39 pm
by Love4Boobies
Ok, I see what you're driving at. Still, the whole idea of having A: and C: is separating volumes. It'd be sort of odd if you had A:, C: and you could also access A: from within C:. Anyway, I'm no UNIX guru so I'm not entirely sure you can mount something twice.

Re: VFS Path Stylings Idea

Posted: Fri May 15, 2009 2:05 am
by Brendan
Hi,
Love4Boobies wrote:Ok, I see what you're driving at. Still, the whole idea of having A: and C: is separating volumes. It'd be sort of odd if you had A:, C: and you could also access A: from within C:. Anyway, I'm no UNIX guru so I'm not entirely sure you can mount something twice.
In Unix I don't think you can mount something twice, but there's probably no technical reason why a (non-Unix) OS couldn't. However, it'd be confusing for users and inefficient for things like backups (for example, if you copy "/" and everything in it somewhere then you'll end up with 2 versions of the exact same data).

The beautiful thing about Unix style mount points is that you can copy all the data from one drive or partition to another drive or partition and mount the new partition where the old partition was, and nobody will notice any difference. In a similar way (for e.g.), if the partition used for "/usr" becomes full you could copy everything in "/usr/src" to a new partition and mount that partition at "/usr/src" to free up space in the original partition.

Using device names (either "A: and C:" or "/dev/fda and /dev/sda") means that as soon as you change devices your symbolic links (or shortcuts?) end up broken, and so do any other file references. For example, a startup script that executes the file "/dev/sda1/sbin/foo" will become broken if the file suddenly becomes "/dev/sdb2/sbin/foo"; and a user/administrator would probably need to manually find all the broken file references and symbolic links and fix them. Note: In earlier versions of Windows this caused plenty of problems - you'd install a new hard drive and suddenly your CD-ROM becomes E: instead of D: and most of your games wouldn't work anymore because the game checks if the official CD is in "drive D:".


Cheers,

Brendan

Re: VFS Path Stylings Idea

Posted: Fri May 15, 2009 7:42 am
by frank
You could only allow mount points in the unix style paths so that /mount/sda/Windows/System32/floppy points to /mount/floppy and hd0:/Windows/System32/floppy just points to an empty directory. It would create an inconsistency between the two methods of access but it would make more sense from a logical standpoint.
Brendan wrote:Using device names (either "A: and C:" or "/dev/fda and /dev/sda") means that as soon as you change devices your symbolic links (or shortcuts?) end up broken, and so do any other file references. For example, a startup script that executes the file "/dev/sda1/sbin/foo" will become broken if the file suddenly becomes "/dev/sdb2/sbin/foo"; and a user/administrator would probably need to manually find all the broken file references and symbolic links and fix them.
For this you could use the volume label or a GUID to mount instead, or have a way to allows mount a disk at the same location regardless of its physical connection.

Re: VFS Path Stylings Idea

Posted: Fri May 15, 2009 2:45 pm
by scgtrp
Still, the whole idea of having A: and C: is separating volumes. It'd be sort of odd if you had A:, C: and you could also access A: from within C:.
I never tried with a floppy drive, but you're completely free in XP to mount a partition on an empty directory in a NTFS partition.

http://support.microsoft.com/kb/307889

Re: VFS Path Stylings Idea

Posted: Sat May 16, 2009 2:40 pm
by AaronMiller
Let me try and re-explain.

* Nothing is mounted twice -- it can't be mounted twice, only once and thats it.
* If you use ':' it means "To the left of this colon references an alias or directory in the /mount directory"

So "A:/boot/grub/menu.lst" would be "/mount/fd0/boot/grub/menu.lst" -- assuming 'A' is an alias to /mount/fd0 that exists in the /mount directory. Therefor, "A:/boot/grub/menu.lst" is the same as the following:
/mount/A/boot/grub/menu.lst
/mount/fd0/boot/grub/menu.lst
fd0:/boot/grub/menu.lst

Although it's mounted only once. There's no real reason to have an alias in the mount directory other than to get a 'wine' styled app to work, and to allow people switching from Windows (or just familiarizing themselves with this OS) to have an easier time moving over.

It's like a special kind of environment variable. Ex, in Windows the path '%comspec%' would usually reference "C:\Windows\System32\cmd.exe" or "%temp%" would usually reference "C:\Temp" Where as this is simply a way to reference something in the /mount directory without having to type out its full path + it looks cool (IMO.)

Thanks for the input, all. :)

Cheers,

-naota