DiskRead Event

Fires when the OS needs to read data from the virtual disk.

Syntax

// CBDiskDiskReadEventArgs carries the CBDisk DiskRead event's parameters.
type CBDiskDiskReadEventArgs struct {...}

func (args *CBDiskDiskReadEventArgs) Offset() int64
func (args *CBDiskDiskReadEventArgs) Buffer() []byte
func (args *CBDiskDiskReadEventArgs) SetBuffer(value []byte)
func (args *CBDiskDiskReadEventArgs) BytesToRead() int64
func (args *CBDiskDiskReadEventArgs) BytesRead() int64
func (args *CBDiskDiskReadEventArgs) SetBytesRead(value int64)
func (args *CBDiskDiskReadEventArgs) ResultCode() int32
func (args *CBDiskDiskReadEventArgs) SetResultCode(value int32)

// CBDiskDiskReadEvent defines the signature of the CBDisk DiskRead event's handler function.
type CBDiskDiskReadEvent func(sender *CBDisk, args *CBDiskDiskReadEventArgs)

func (obj *CBDisk) GetOnDiskReadHandler() CBDiskDiskReadEvent
func (obj *CBDisk) SetOnDiskReadHandler(handlerFunc CBDiskDiskReadEvent)

Remarks

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

To handle this event properly, applications must read BytesToRead bytes from the block of data associated with the virtual disk, copying it to the memory region pointed to by Buffer. Reading must begin at the specified Offset in the data block, and when reading is complete, applications must set BytesRead to reflect the actual number of bytes read into Buffer. Applications must not attempt to copy more than BytesToRead bytes of data into 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]