| LLAPI_CHANGELOG_REGISTER(3) | Lustre Library Functions | LLAPI_CHANGELOG_REGISTER(3) |
NAME
llapi_changelog_register - Register changelog user on specific MDT device.
SYNOPSIS
#include <lustre/lustreapi.h>
int llapi_changelog_register(const char *mdtname, const char *username,
const char *usermask, char *regname, size_t reglen);
DESCRIPTION
The function llapi_changelog_register() registers a changelog username using an optional application-specific identifier (e.g. 'audit') on the specified MDT device mdtname (e.g. lustrefs-MDT0000) with user-specific usermask, and returns the registered full consumer name regname with reglen length. The llapi_changelog_register() command must run on the MDS where the MDT is mounted as the root user for each mdtname in the filesystem to be monitored.
The username must be under CHANGELOG_USER_NAMELEN bytes in size, as this length includes a trailing NUL character. The name must start with a letter and only contain ASCII alphanumeric (isalnum(3)), dash '-', and underscore '_' characters.
The regname argument is a character array that should be long enough to hold the username plus the changelog user number, with reglen at least CHANGELOG_USER_NAMELEN_FULL bytes in size.
The usermask argument contains a comma- or '+' separated list of changelog record type names that should be activated while this user is registered.
RETURN VALUES
Return changelog user ID on success or a negative errno value on failure.
ERRORS
- -EEXIST
- Username already exists.
- -EILSEQ
- Mask is in a wrong format.
- -EINVAL
- MDT device name is invalid or not found.
- -ENAMETOOLONG
- The specified username is too long, shorten it.
- -EOVERFLOW
- The regname buffer is too small, increase its size and its corresponding reglen and/or shorten username.
- -EPROTO
- Assigned username is invalid.
EXAMPLE
To register a new changelog user on the specified MDT:
#include <lustre/lustreapi.h>
int main(int argc, char *argv[])
{
char *mdtname = argv[1]; /* e.g. "testfs-MDT0000" */
char *username = argv[2]; /* e.g. "audit" */
char *usermask = argv[3]; /* e.g. "open,creat,renam,unlnk" */
char regname[CHANGELOG_USER_NAMELEN_FULL];
int rc;
rc = llapi_changelog_register(mdtname, username, usermask,
regname, sizeof(regname));
}
AVAILABILITY
llapi_changelog_register() is part of the lustre(7) user application interface library since release 2.18.0.
SEE ALSO
llapi_changelog_clear(3), llapi_changelog_deregister(3), llapi_changelog_get_fd(3), llapi_changelog_recv(3), llapi_changelog_start(3), lustreapi(7), lctl-changelog_register(8)
| 2026-09-12 | Lustre User API |