Add a file flag for "hidden" files?
Robert Watson
rwatson at FreeBSD.org
Wed Mar 1 10:18:15 PST 2006
On Wed, 1 Mar 2006, Mark Day wrote:
> 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.)
I don't see any problem with this. The only flag I know of in FreeBSD that
might not appear in Mac OS X is the system snapshot flag, which was added to
UFS after Apple forked from the FreeBSD source. You can find current flag
allocation here:
http://fxr.watson.org/fxr/source/sys/stat.h
274 /*
275 * Definitions of flags stored in file flags word.
276 *
277 * Super-user and owner changeable flags.
278 */
279 #define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags
*/
280 #define UF_NODUMP 0x00000001 /* do not dump file */
281 #define UF_IMMUTABLE 0x00000002 /* file may not be changed */
282 #define UF_APPEND 0x00000004 /* writes to file may only append
*/
283 #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union
*/
284 #define UF_NOUNLINK 0x00000010 /* file may not be removed or
renamed */
285 /*
286 * Super-user changeable flags.
287 */
288 #define SF_SETTABLE 0xffff0000 /* mask of superuser changeable
flags */
289 #define SF_ARCHIVED 0x00010000 /* file is archived */
290 #define SF_IMMUTABLE 0x00020000 /* file may not be changed */
291 #define SF_APPEND 0x00040000 /* writes to file may only append
*/
292 #define SF_NOUNLINK 0x00100000 /* file may not be removed or
renamed */
293 #define SF_SNAPSHOT 0x00200000 /* snapshot inode */
We have talked about adding a flag to hint the presence of extended ACL data
also, so that applications know if they should rely solely on stat() for
protection information, or also call acl_get_{fd,file,link}() to receive
extended ACL data for ls(1) output. Is your plan to mask hidden files solely
in user space, or to look at masking it in kernel also?
Robert N M Watson
More information about the freebsd-fs
mailing list