netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cnid.c File Reference
`#include <errno.h>`
`#include <signal.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/param.h>`
`#include <sys/stat.h>`
`#include <sys/time.h>`
`#include <sys/types.h>`
`#include <time.h>`
`#include <unistd.h>`
`#include <atalk/cnid.h>`
`#include <atalk/compat.h>`
`#include <atalk/list.h>`
`#include <atalk/logger.h>`
`#include <atalk/util.h>`
`#include <atalk/volume.h>`

## Macros
#define | USE_LIST

## Functions
void | cnid_register (struct _cnid_module *module)
static int | cnid_dir (const char *dir, mode_t mask)
struct _cnid_db * | cnid_open (struct vol *vol, char *type, int flags)
static void | block_signal (uint32_t flags)
static void | unblock_signal (uint32_t flags)
static cnid_t | valide (cnid_t id)
void | cnid_close (struct _cnid_db *db)
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)
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.
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_wipe (struct _cnid_db *cdb)

## Variables
static struct list_head | modules = ATALK_LIST_HEAD_INIT(modules)
static sigset_t | sigblockset

## Macro Definition Documentation

## ◆ USE_LIST

#define USE_LIST

## Function Documentation

## ◆ block_signal()

void block_signal | ( | uint32_t | flags | ) |
| static

## ◆ cnid_add()

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 )

## ◆ cnid_close()

void cnid_close | ( | struct _cnid_db * | db | ) |

Closes CNID database. Currently it's just a wrapper around db->cnid_close().

## ◆ cnid_delete()

int cnid_delete | ( | struct _cnid_db * | cdb,
|  | cnid_t | id )

## ◆ cnid_dir()

int cnid_dir | ( | const char * | dir,
|  | mode_t | mask )
| static

## ◆ cnid_find()

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)

## ◆ cnid_get()

cnid_t cnid_get | ( | struct _cnid_db * | cdb,
|  | const cnid_t | did,
|  | char * | name,
|  | const size_t | len )

## ◆ cnid_getstamp()

int cnid_getstamp | ( | struct _cnid_db * | cdb,
|  | void * | buffer,
|  | const size_t | len )

## ◆ cnid_lookup()

cnid_t cnid_lookup | ( | struct _cnid_db * | cdb,
|  | const struct stat * | st,
|  | const cnid_t | did,
|  | char * | name,
|  | const size_t | len )

## ◆ cnid_open()

struct _cnid_db * cnid_open | ( | struct vol * | vol,
|  | char * | type,
|  | int | flags )

Opens CNID database using particular back-end

## ◆ cnid_rebuild_add()

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 )

## ◆ cnid_register()

void cnid_register | ( | struct _cnid_module * | module | ) |

Once module has been registered, it cannot be unregistered.

## ◆ cnid_resolve()

char * cnid_resolve | ( | struct _cnid_db * | cdb,
|  | cnid_t * | id,
|  | void * | buffer,
|  | size_t | len )

## ◆ cnid_update()

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_wipe()

int cnid_wipe | ( | struct _cnid_db * | cdb | ) |

## ◆ unblock_signal()

void unblock_signal | ( | uint32_t | flags | ) |
| static

## ◆ valide()

cnid_t valide | ( | cnid_t | id | ) |
| static

protect against bogus value from the DB. adddir really doesn't like 2

## Variable Documentation

## ◆ modules

struct list_head modules = ATALK_LIST_HEAD_INIT(modules)
| static

List of all registered modules.

## ◆ sigblockset

sigset_t sigblockset
| static