5. I/O Operations#
5.1. cuObjGet#
Performs a GET operation using cuObject.
ssize_t cuObjGet(void* ctx, void* ptr, size_t size, loff_t offset = 0,
loff_t buf_offset = 0);
Parameters:
ctx: User context pointer. This pointer is passed to the GET callback and can be retrieved withgetCtx().ptr: Pointer to user memory.size: Size of the GET operation in bytes.offset: Object offset. This value is reserved for future use and should be set to0.buf_offset: Buffer offset. This value is reserved for future use and should be set to0.
Returns:
Number of bytes transferred on success.
Negative failure value for I/O or callback failure.
CU_OBJ_FAILfor invalid arguments detected before I/O submission.
Notes:
The GET callback is invoked one or more times during this operation.
If
sizeexceedsMaxRequestCallbackSize, multiple callbacks are invoked.This is a synchronous operation. It returns after the operation completes.
ctxandptrmust be non-null.sizemust be greater than0.offsetandbuf_offsetare reserved. Pass0. Negative values returnCU_OBJ_FAIL.
5.2. cuObjPut#
Performs a PUT operation using cuObject.
ssize_t cuObjPut(void* ctx, void* ptr, size_t size, loff_t offset = 0,
loff_t buf_offset = 0);
Parameters:
ctx: User context pointer. This pointer is passed to the PUT callback and can be retrieved withgetCtx().ptr: Pointer to user memory.size: Size of the PUT operation in bytes.offset: Object offset. This value is reserved for future use and should be set to0.buf_offset: Buffer offset. This value is reserved for future use and should be set to0.
Returns:
Number of bytes transferred on success.
Negative failure value for I/O or callback failure.
CU_OBJ_FAILfor invalid arguments detected before I/O submission.
Notes:
The PUT callback is invoked one or more times during this operation.
If
sizeexceedsMaxRequestCallbackSize, multiple callbacks are invoked.This is a synchronous operation. It returns after the operation completes.
ctxandptrmust be non-null.sizemust be greater than0.offsetandbuf_offsetare reserved. Pass0. Negative values returnCU_OBJ_FAIL.