Date: Wed, 1 Mar 2006 09:48:04 -0800 From: Mark Day <mday@apple.com> To: freebsd-fs@freebsd.org Subject: Add a file flag for "hidden" files? Message-ID: <DBD69E00-A9CB-45BA-8398-2A662D18D781@apple.com>
next in thread | raw e-mail | index | archive | help
Hello, For an future version of Mac OS X, I'm trying to solve a problem where certain files and directories on Windows file systems don't normally appear in the Windows GUI, but currently do appear in the Mac OS X GUI (but they shouldn't). I'd like to gauge interest in having the change ported back to FreeBSD (since many of our file systems are derived from FreeBSD). The approach I'm planning to use is to add a new flag to the file flags (i.e. the st_flags field from stat(2); settable via chflags(2)). I'd like to avoid a collision with any flags FreeBSD would add in the future, so either have FreeBSD adopt the flag, or start allocating Mac OS X-specific flags from the high order bits (since FreeBSD has been allocating them from the low order bits). My current name for this new file flag is UF_HIDDEN. Windows file systems (FAT, NTFS, SMB) have a "hidden" attribute bit on files and directories. If a file or directory has this attribute set, Windows will not normally show it in the GUI unless you explicit ask to view hidden items. Mac file systems (HFS, AFP) have a similar notion called the "invisible" bit, which is just one part of the Finder Info (which also contains things like file type and creator information, icon position, etc.). Mac OS X has a mechanism for storing Finder Info on file systems without native support for Finder Info, by using extra files known as AppleDouble or "dot underscore" files (because their name is the original file's name with "._" prepended). The management of the AppleDouble files happens in application-layer libraries in Mac OS X 10.3.x and earlier, and also in the VFS layer in Mac OS X 10.4.x and later. It would be complex to try to push the AppleDouble support down into the Windows file systems merely so they could shadow their native hidden bit into the invisible bit of the Finder Info. The file flags are very easy for individual file systems to implement. And the GUI is already getting the stat(2) information anyway, so no need to make extra system calls. I could certainly provide patches to FreeBSD for the headers, FAT, NTFS, and probably HFS. The strtofflags(3) and fflagstostr(3) functions should also change so you can get at the flag bit via ls (1), find(1), chflags(1), etc.; I think I could provide that patch, too. (I've never actually used FreeBSD, so it will take me a bit of time to get it installed, find my way around the sources, make and test the changes.) -Mark
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DBD69E00-A9CB-45BA-8398-2A662D18D781>