netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
nad_util.c File Reference
#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 <bstrlib.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sysexits.h>
#include <unistd.h>
#include <atalk/cnid.h>
#include <atalk/errchk.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/unicode.h>
#include <atalk/util.h>
#include "nad.h"

Functions

void _log (enum logtype lt, char *fmt,...)
int openvol (AFPObj *obj, const char *path, afpvol_t *vol)
void closevol (afpvol_t *vol)
char * utompath (const struct vol *vol, const char *upath)
int convert_dots_encoding (const afpvol_t *svol, const afpvol_t *dvol, char *path)
cnid_t cnid_for_paths_parent (const afpvol_t *vol, const char *path, cnid_t *did)

Variables

int log_verbose

Function Documentation

◆ _log()

void _log ( enum logtype lt,
char * fmt,
... )

◆ closevol()

void closevol ( afpvol_t * vol)

◆ cnid_for_paths_parent()

cnid_t cnid_for_paths_parent ( const afpvol_t * vol,
const char * path,
cnid_t * did )

Resolves CNID of a given paths parent directory

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
vol(r) pointer to afpvol_t
path(r) path, see above
did(rw) parent CNID of returned CNID
Returns
CNID of path

◆ convert_dots_encoding()

int convert_dots_encoding ( const afpvol_t * svol,
const afpvol_t * dvol,
char * path )

Convert dot encoding of basename in place

path arg can be "[/][dir/ | ...]filename". It will be converted in place possible encoding ".file" as ":2efile" which means the result will be longer then the original which means provide a big enough buffer.

Parameters
svol(r) source volume
dvol(r) destination volume
path(rw) path to convert in place
Returns
0 on success, -1 on error

◆ openvol()

int openvol ( AFPObj * obj,
const char * path,
afpvol_t * vol )

Load volinfo and initialize struct vol

Parameters
obj(r) AFPObj of the current connection
path(r) path to evaluate
vol(rw) structure to initialize
Returns
0 on success, exits on error

◆ utompath()

char * utompath ( const struct vol * vol,
const char * upath )

Variable Documentation

◆ log_verbose

int log_verbose