GetAttr Event

Fires when the OS needs information about a file or directory.

Syntax

ANSI (Cross Platform)
virtual int FireGetAttr(FUSEGetAttrEventParams *e);
typedef struct {
const char *Path;
int FileContext;
int64 *pIno;
int Mode;
int Uid;
int Gid;
int LinkCount;
int64 *pSize;
int64 *pATime;
int64 *pMTime;
int64 *pCTime;
int Result; int reserved; } FUSEGetAttrEventParams; Unicode (Windows) virtual INT FireGetAttr(FUSEGetAttrEventParams *e);
typedef struct {
LPCWSTR Path;
INT FileContext;
LONG64 *pIno;
INT Mode;
INT Uid;
INT Gid;
INT LinkCount;
LONG64 *pSize;
LONG64 *pATime;
LONG64 *pMTime;
LONG64 *pCTime;
INT Result; INT reserved; } FUSEGetAttrEventParams;
#define EID_FUSE_GETATTR 11

virtual INT CBFSFUSE_CALL FireGetAttr(LPWSTR &lpszPath, INT &iFileContext, LONG64 &lIno, INT &iMode, INT &iUid, INT &iGid, INT &iLinkCount, LONG64 &lSize, LONG64 &lATime, LONG64 &lMTime, LONG64 &lCTime, INT &iResult);

Remarks

This event fires when the OS needs information about the file or directory identified by either Path or FileContext (the latter in most cases will not be initialized). If the entry with the specified name does not exist, the handler must return ENOENT in Result parameter.

The Ino parameter should be set to the ID of the file, which must be unique within a filesystem. Ino is optional on Windows and is ignored on Linux, where FUSE internally generates internal IDs.

The Mode parameter is a combination of bit flags.
Windows: Mode may include 0x4000 (S_IFDIR) to indicate that the entry is a directory, and must include either 0x80 (S_IWUSR) to indicate a file that can be read and written or 0x100 (S_IRUSR) to indicate a read-only file. Other flags are ignored.
Linux: Mode may include any appropriate file mode flags. See inode(7) for more information.

Windows: The Uid, Gid, and LinkCount parameters are not used.
Linux: The Uid and Gid parameters must be set to the owner's user ID and group ID respectively. LinkCount should be set to the number of hard links that the file has (which usually is 1).

Size must be set to the size of the file's data. For directories, the parameter should be set to 0.

ATime, MTime, CTime: Set respectively to the Access Time, Modification Time, and Creation Time values of the file or directory. All date/time parameters in the class are specified as a number of 100-nanosecond intervals since Jan 1, 1601 00:00:00 UTC (Windows) or as a number of seconds since Jan 1, 1970 00:00:00 UTC (Linux).

To convert Unix time to the format, suitable for this event, use the UnixTimeToFileTime method.

Windows: Any non-applicable time values can be left unchanged, or set to 0.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a negative error code value (e.g. -ENOENT to indicate that the file does not exist) to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS FUSE 2020 C++ Edition - Version 20.0 [Build 8348]