nbd_set_private_data3
Set the per-handle private data
Usage
#include <libnbd.h>uintptr_t nbd_set_private_data (struct nbd_handle *h, uintptr_t private_data);
Overview
Handles contain a private data field for applications to use for any purpose. This function sets the value of this field and returns the old value (or 0 if it was not previously set).
When calling libnbd from C, the type of this field is "uintptr_t" so it can be used to store an unsigned integer or a pointer.
In non-C bindings it can be used to store an unsigned integer.
Libnbd does not use or interpret the value at all (except to return it when you call nbd_get_private_data(3)). In particular, if the value is a pointer then it is not freed when the handle is closed.
Return value
This call returns a "uintptr_t".
Errors
This function does not fail.
The following parameters must not be NULL: "h". For more information see "Non-NULL parameters" in libnbd(3).
Version
This function first appeared in libnbd 1.8.
If you need to test if this function is available at compile time check if the following macro is defined:
#define LIBNBD_HAVE_NBD_SET_PRIVATE_DATA 1
Releases
3 releases since Debian 12 (Bookworm); the text changed 2 times.