libnvmf_exclusion_write-libnvme32
Atomically replace a list's contents.
Usage
int libnvmf_exclusion_write
(struct
libnvme_global_ctx
*ctx
,
const
char
*name
,
const
char
*text
,
uint64_t
version
);
Arguments
- ctx
-
libnvme global context; must not be NULL
- name
-
list name
- text
-
full replacement contents (every "exclusion = ..." line is validated and must sit inside the [exclusions] section; invalid entries cause -EINVAL and no write)
- version
-
token from a prior
libnvmf_exclusion_read. The write proceeds only if the on-disk list still matches version; otherwise it returns -ESTALE and leaves the file untouched, so a concurrent editor's changes are never silently overwritten.
Overview
The replacement is installed atomically (temp file + rename) with mode 0644.
Return
0 on success, -ESTALE if the list changed since version was read, -EINVAL for an invalid entry or name, negative errno otherwise.