FAllocate Event

Fires when the OS needs to allocate space for an open file.

Syntax

ANSI (Cross Platform)
virtual int FireFAllocate(FUSEFAllocateEventParams *e);
typedef struct {
const char *Path;
int FileContext;
int Mode;
int64 Offset;
int64 Length;
int Result; int reserved; } FUSEFAllocateEventParams; Unicode (Windows) virtual INT FireFAllocate(FUSEFAllocateEventParams *e);
typedef struct {
LPCWSTR Path;
INT FileContext;
INT Mode;
LONG64 Offset;
LONG64 Length;
INT Result; INT reserved; } FUSEFAllocateEventParams;
#define EID_FUSE_FALLOCATE 8

virtual INT CBFSFUSE_CALL FireFAllocate(LPWSTR &lpszPath, INT &iFileContext, INT &iMode, LONG64 &lOffset, LONG64 &lLength, INT &iResult);

Remarks

This event fires when the OS needs to allocate and zeroize space for an open file, which is identified by FileContext. The Path parameter contains the name of the file.

The allocation size of the file must be the greater of Offset+Length and current file size. The actual file size must be adjusted to match the new allocation size unless the Mode parameter includes the value 1 (FALLOC_FL_KEEP_SIZE).

Linux: The OS may send additional flags in the Mode parameter to manipulate file contents.

The range of the file data to zeroize starts from Offset and occupies Length bytes.

The event handler must ensure that the required space is allocated for specified file. If the event handler returns success then any subsequent write request to specified range must be guaranteed not to fail because of lack of space in the backend storage.

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]