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 with getCtx().

  • 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 to 0.

  • buf_offset: Buffer offset. This value is reserved for future use and should be set to 0.

Returns:

  • Number of bytes transferred on success.

  • Negative failure value for I/O or callback failure.

  • CU_OBJ_FAIL for invalid arguments detected before I/O submission.

Notes:

  • The GET callback is invoked one or more times during this operation.

  • If size exceeds MaxRequestCallbackSize, multiple callbacks are invoked.

  • This is a synchronous operation. It returns after the operation completes.

  • ctx and ptr must be non-null.

  • size must be greater than 0.

  • offset and buf_offset are reserved. Pass 0. Negative values return CU_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 with getCtx().

  • 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 to 0.

  • buf_offset: Buffer offset. This value is reserved for future use and should be set to 0.

Returns:

  • Number of bytes transferred on success.

  • Negative failure value for I/O or callback failure.

  • CU_OBJ_FAIL for invalid arguments detected before I/O submission.

Notes:

  • The PUT callback is invoked one or more times during this operation.

  • If size exceeds MaxRequestCallbackSize, multiple callbacks are invoked.

  • This is a synchronous operation. It returns after the operation completes.

  • ctx and ptr must be non-null.

  • size must be greater than 0.

  • offset and buf_offset are reserved. Pass 0. Negative values return CU_OBJ_FAIL.