|
| void | cnid_init (void) |
| void | cnid_register (struct _cnid_module *module) |
| struct _cnid_db * | cnid_open (struct vol *vol, char *type, int flags) |
| cnid_t | cnid_add (struct _cnid_db *cdb, const struct stat *st, const cnid_t did, const char *name, const size_t len, cnid_t hint) |
| int | cnid_delete (struct _cnid_db *cdb, cnid_t id) |
| cnid_t | cnid_get (struct _cnid_db *cdb, const cnid_t did, char *name, const size_t len) |
| int | cnid_getstamp (struct _cnid_db *cdb, void *buffer, const size_t len) |
| cnid_t | cnid_lookup (struct _cnid_db *cdb, const struct stat *st, const cnid_t did, char *name, const size_t len) |
| char * | cnid_resolve (struct _cnid_db *cdb, cnid_t *id, void *buffer, size_t len) |
| int | cnid_update (struct _cnid_db *cdb, const cnid_t id, const struct stat *st, const cnid_t did, char *name, const size_t len) |
| cnid_t | cnid_rebuild_add (struct _cnid_db *cdb, const struct stat *st, const cnid_t did, char *name, const size_t len, cnid_t hint) |
| int | cnid_find (struct _cnid_db *cdb, const char *name, size_t namelen, void *buffer, size_t buflen, bool *more_available) |
| | Search the CNID database for entries whose name contains a substring.
|
| int | cnid_wipe (struct _cnid_db *cdb) |
| void | cnid_close (struct _cnid_db *db) |
This file contains all generic CNID related stuff declarations. Included:
- CNID factory, which retrieves (eventually instantiates) CNID objects on demand
- selection of CNID backends (default, detected by volume)
- full set of CNID operations needed by server core.
| int cnid_find |
( |
struct _cnid_db * | cdb, |
|
|
const char * | name, |
|
|
size_t | namelen, |
|
|
void * | buffer, |
|
|
size_t | buflen, |
|
|
bool * | more_available ) |
Search the CNID database for entries whose name contains a substring.
Centralises parameter validation so all three CNID backends (dbd, sqlite, mysql) behave identically against bad input. The 4-byte upper-bound shrink on namelen leaves room for the DBD backend's pagination offset prefix in the wire payload; the constraint is applied uniformly here so callers see consistent behaviour regardless of the configured backend.
The optional more_available out-parameter, when non-NULL, is written unconditionally on entry to false and again by the backend: false on error, true iff the result set was truncated on success (more matches exist than fit in buffer, or were collected within the daemon's wall-clock budget).
- Parameters
-
| [in] | cdb | CNID database handle |
| [in] | name | UTF-8 substring to search for, not necessarily NUL-terminated |
| [in] | namelen | bytes in name, range 1..MAXPATHLEN-sizeof(uint32_t) |
| [out] | buffer | caller-provided buffer for matching CNIDs in network byte order |
| [in] | buflen | capacity of buffer in bytes, must be >= CNID_FIND_MIN_BUFLEN |
| [out] | more_available | set to true iff result set was truncated, NULL to opt out |
- Returns
- number of CNIDs written to
buffer on success, -1 on failure (errno = CNID_ERR_PARAM or CNID_ERR_DB)