netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cnid.c File Reference
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <bstrlib.h>
#include <atalk/cnid.h>
#include <atalk/errchk.h>
#include <atalk/logger.h>
#include <atalk/unicode.h>
#include <atalk/util.h>

Functions

bstring rel_path_in_vol (const char *path, const char *volpath)
cnid_t cnid_for_path (struct _cnid_db *cdb, const char *volpath, const char *path, cnid_t *did)

Function Documentation

◆ cnid_for_path()

cnid_t cnid_for_path ( struct _cnid_db * cdb,
const char * volpath,
const char * path,
cnid_t * did )

Resolves CNID of a given path

path might be: (a) relative: "dir/subdir" with cwd: "/afp_volume/topdir" (b) absolute: "/afp_volume/dir/subdir"

path MUST be pointing inside vol, this is usually the case as vol has been build from path using loadvolinfo and friends.

Parameters
cdb(r) CNID db handle
volpath(r) UNIX path of volume
path(r) path, see above
did(w) parent CNID of returned CNID
Returns
CNID of path

◆ rel_path_in_vol()

bstring rel_path_in_vol ( const char * path,
const char * volpath )

Build path relativ to volume root

path might be: (a) relative: "dir/subdir" with cwd: "/afp_volume/topdir" (b) absolute: "/afp_volume/dir/subdir"

Parameters
path(r) path relative to cwd() or absolute
volpath(r) volume path that path is a subdir of (has been computed in volinfo funcs)
Returns
relative path in new bstring, caller must bdestroy it