Write Event

Fires when the OS needs to write data to an open file.

Syntax

// FUSEWriteEventArgs carries the FUSE Write event's parameters.
type FUSEWriteEventArgs struct {...}

func (args *FUSEWriteEventArgs) Path() string
func (args *FUSEWriteEventArgs) FileContext() int32
func (args *FUSEWriteEventArgs) WritePage() bool
func (args *FUSEWriteEventArgs) Offset() int64
func (args *FUSEWriteEventArgs) Buffer() []byte
func (args *FUSEWriteEventArgs) Size() int64
func (args *FUSEWriteEventArgs) Result() int32
func (args *FUSEWriteEventArgs) SetResult(value int32)

// FUSEWriteEvent defines the signature of the FUSE Write event's handler function.
type FUSEWriteEvent func(sender *FUSE, args *FUSEWriteEventArgs)

func (obj *FUSE) GetOnWriteHandler() FUSEWriteEvent
func (obj *FUSE) SetOnWriteHandler(handlerFunc FUSEWriteEvent)

Remarks

This event fires when the OS needs to write data to the already-open file, identified by either Path or FileContext.

To handle this event properly, applications should write Size bytes of data from the memory region pointed to by Buffer to the specified file. Writing must begin at the specified Offset in the file and all of the provided data is expected to be written.

Please refer to the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The WritePage parameter will be set to a non-zero value when writing is performed by the cache manager or another system component. If this is the case, FileContext may not match the value that would be passed in the case of a non-buffered write by a user-mode process.

When writing is complete, applications must set Result to the actual number of bytes written to the file.

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 Go Edition - Version 20.0 [Build 8348]