Question about FILE_ATTRIBUTE_ARCHIVE flag when creating a new file.

25 views
Skip to first unread message

Ethan

unread,
Feb 20, 2025, 3:27:40 AMFeb 20
to WinFsp
Hi, I am trying to understand some behavior from Winfsp, especially for the FILE_ATTRIBUTE_ARCHIVE flag when creating a new file.

here is the source code link:


```
    if (0 != FileAttributes &&
        0 != (f->conn_want & FSP_FUSE_CAP_STAT_EX) && 0 != f->ops.chflags)
    {
        err = f->ops.chflags(contexthdr->PosixPath,
            fsp_fuse_intf_MapFileAttributesToFlags(CreateOptions & FILE_DIRECTORY_FILE ?
                FileAttributes : FileAttributes | FILE_ATTRIBUTE_ARCHIVE));
        Result = fsp_fuse_ntstatus_from_errno(f->env, err);
        if (!NT_SUCCESS(Result) && STATUS_INVALID_DEVICE_REQUEST != Result)
            goto exit;
    }
```

When creating a new file, I noticed that the winfsp.dll would call ops.chflags only when Fileattribute is non-zero. If the Fileattribute is zero, the underlying file system would have no chance to set the FILE_ATTRIBUTE_ARCHIVE flag.

So my question is: when implementing the fuse interface for a Windows file system, should we set the FILE_ATTRIBUTE_ARCHIVE by default when creating a file, instead of depending on the chflags callback from the winfsp.dll?

I read the document GetFileattribute API many times, but honestly, I don't know too much about this FILE_ATTRIBUTE_ARCHIVE flag. Is there anybody who can give me a hint? 

Any help is much appreciated!!

Bill Zissimopoulos

unread,
Feb 24, 2025, 4:40:40 AMFeb 24
to Ethan, WinFsp

Hello:

 

So my question is: when implementing the fuse interface for a Windows file system, should we set the FILE_ATTRIBUTE_ARCHIVE by default when creating a file, instead of depending on the chflags callback from the winfsp.dll?

 

The archive file attribute is actually not that useful in modern Windows. However if you wish to emulate it in a FUSE file system, then when a new file (but not directory) is created it needs to have the archive bit set.

 

Thanks.

 

Bill

 

 

--
You received this message because you are subscribed to the Google Groups "WinFsp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to winfsp+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/winfsp/43ff6e56-9b4e-4d8e-8ec7-3ff1726fc402n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages