DiskWrite Event

Fires when the OS needs to write data to the virtual disk.

Syntax

// CBDiskDiskWriteEventArgs carries the CBDisk DiskWrite event's parameters.
type CBDiskDiskWriteEventArgs struct {...}

func (args *CBDiskDiskWriteEventArgs) Offset() int64
func (args *CBDiskDiskWriteEventArgs) Buffer() []byte
func (args *CBDiskDiskWriteEventArgs) BytesToWrite() int64
func (args *CBDiskDiskWriteEventArgs) ResultCode() int32
func (args *CBDiskDiskWriteEventArgs) SetResultCode(value int32)

// CBDiskDiskWriteEvent defines the signature of the CBDisk DiskWrite event's handler function.
type CBDiskDiskWriteEvent func(sender *CBDisk, args *CBDiskDiskWriteEventArgs)

func (obj *CBDisk) GetOnDiskWriteHandler() CBDiskDiskWriteEvent
func (obj *CBDisk) SetOnDiskWriteHandler(handlerFunc CBDiskDiskWriteEvent)

Remarks

This event fires when the OS needs to write data to the virtual disk.

To handle this event properly, applications must write BytesToWrite bytes to the block of data associated with the virtual disk, copying it from the memory region pointed to by Buffer. Writing must begin at the specified Offset in the data block; and applications must either write exactly BytesToWrite bytes, or return an error via ResultCode (i.e., partial writes are not a successful outcome). Applications must not attempt to copy more than BytesToWrite bytes of data from Buffer.

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

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 non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Storage 2020 Go Edition - Version 20.0 [Build 8031]