本文介绍了来自stat.h的UF_TRACKED文件标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在osx 10.7的头文件stat.h中,我发现文件标记UF_TRACKED上的定义。我GOOGLE了定义,但没有找到任何关于国旗。你能描述一下这个标志是什么意思?我遇到它时,我尝试应用属性的文件放在装载的文件夹。该文件夹是远程OSX 10.7.3上的HFS +文件夹。也许我可以忽略它?在这种情况下会发生什么?

解决方案

UF_TRACKED是一个标志,告诉HFS发送一个事件到一个跟踪的文件处理程序在用户模式下对文件的dentry进行任何更改(即重命名或删除,以及元数据更改,但不更改文件)。您可以在头文件中看到:

  #define UF_TRACKED 0x00000040 / *文件重命名和删除被跟踪* / 

处理这个问题的代码位于内核bsd / hfs / hfs_vfsutils.c中:



$ $ p $ $ $ $ $ $ $ $ $ $ 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; (VTOC(vp) - > c_bsdflags& UF_TRACKED){
...


if $ p>

并且被调用到所有地方,主要来自hfs_vnops.c


In the header stat.h on osx 10.7 I found define on fileflag UF_TRACKED. I googled that define but didn't find anything about flag. Can you describe me what does this flag mean? I encountered with it when I try to apply attributes to the file wich 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?

解决方案

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

这篇关于来自stat.h的UF_TRACKED文件标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 22:14