macosunixfilesystemsosx-lionhfs

UF_TRACKED file flag from stat.h


In the header stat.h on osx 10.7 I found a define in fileflag UF_TRACKED. I googled that define but didn't find anything about the flag. Can you describe to me what this flag means? I encountered it when I tried to apply attributes to the file which placed on the mounted folder. That folder is HFS+ folder on the remoted osx 10.7.3.

Maybe I can ignore it? And what can happen in that case?


Solution

  • The UF_TRACKED is a flag which tells HFS to send an event to a tracked file handler in user mode on any change to the file's dentry (i.e. rename or delete, and changes in metadata, but not file modification). You can see that both in the header file:

    #define UF_TRACKED      0x00000040  /* file renames and deletes are tracked */
    

    The code to handle this is in the kernel, bsd/hfs/hfs_vfsutils.c:

    int
    check_for_tracked_file(struct vnode *vp, time_t ctime, uint64_t op_type, void *arg)
    {
            int tracked_error = 0, snapshot_error = 0;
    
            if (vp == NULL) {
                    return 0;
            }
    
            if (VTOC(vp)->c_bsdflags & UF_TRACKED) {
     ... 
    

    And is called all over the place, primarily from hfs_vnops.c