natevw / fatfs

Standalone FAT16/FAT32 filesystem implementation in JavaScript
47 stars 13 forks source link

Mode ↔︎ flags mapping #7

Closed natevw closed 10 years ago

natevw commented 10 years ago

Via http://oreilly.com/openbook/samba/book/ch05_03.html#ch05-56404, here's how Samba at least used to map the FAT flags, using the three executable bits and owner writable:

Flag mapping


Not sure what this even is, but http://www.mkssoftware.com/docs/man1/chmod.1.asp uses higher bits instead:

4000      Hidden file (setuid bit)
2000      System file (setgid bit)
1000      Archive bit (sticky bit)

Plus:

To get a read-only file on Windows systems, you must turn off all three write permission bits; if any of the three is on, Windows considers the file to be writable.

natevw commented 10 years ago

This doesn't really cover the flags we're interested in, but here's some related documentation for Microsoft's POSIX layer: http://technet.microsoft.com/en-us/library/bb463216.aspx#ECAA

natevw commented 10 years ago

c.f. http://en.wikipedia.org/wiki/FAT_filesystem_and_Linux

natevw commented 10 years ago

And also: http://dev.man-online.org/man1/fatattr/ (via http://linlog.skepticats.com/entries/2007/10/26_1516/)

…which may be this: https://github.com/sodabrew/fatattr/blob/master/fatattr.c (uses ioctl)

natevw commented 10 years ago

Both options were implemented in https://github.com/natevw/fatfs/commit/5abb9e5dd24d614ef7ae617d793e1fac7fab41f2.