#include <assert.h>
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <utime.h>
#include <bstrlib.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/cnid.h>
#include <atalk/errchk.h>
#include <atalk/fce_api.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/unix.h>
#include <atalk/util.h>
#include <atalk/uuid.h>
#include <atalk/vfs.h>
#include "desktop.h"
#include "dircache.h"
#include "directory.h"
#include "file.h"
#include "filedir.h"
#include "fork.h"
#include "hash.h"
#include "mangle.h"
#include "unix.h"
#include "volume.h"
Functions | |
static int | netatalk_mkdir (const struct vol *vol, const char *name) |
static int | deletedir (const struct vol *vol, int dirfd, char *dir) |
static int | copydir (struct vol *vol, struct dir *ddir, int dirfd, char *src, char *dst) |
static int | diroffcnt (struct dir *dir, struct stat *st) |
static int | invisible_dots (const struct vol *vol, const char *name) |
static int | set_dir_errors (struct path *path, const char *where, int err) |
static int | cname_mtouname (const struct vol *vol, struct dir *dir, struct path *ret, int toUTF8) |
Convert name in client encoding to server encoding. | |
static struct path * | path_from_dir (struct vol *vol, struct dir *dir, struct path *ret) |
Build struct path from struct dir. | |
int | get_afp_errno (const int param) |
struct dir * | dirlookup (const struct vol *vol, cnid_t did) |
Resolve a DID. | |
struct dir * | dir_new (const char *m_name, const char *u_name, const struct vol *vol, cnid_t pdid, cnid_t did, bstring path, struct stat *st) |
Construct struct dir. | |
void | dir_free (struct dir *dir) |
Free a struct dir and all its members. | |
struct dir * | dir_add (struct vol *vol, const struct dir *dir, struct path *path, int len) |
Create struct dir from struct path. | |
void | dir_free_invalid_q (void) |
int | dir_remove (const struct vol *vol, struct dir *dir) |
Remove a file/directory from dircache. | |
struct path * | cname (struct vol *vol, struct dir *dir, char **cpath) |
Resolve a catalog node name path. | |
int | movecwd (const struct vol *vol, struct dir *dir) |
int | check_access (const AFPObj *obj, struct vol *vol, char *path, int mode) |
int | file_access (const AFPObj *obj, struct vol *vol, struct path *path, int mode) |
void | setdiroffcnt (struct dir *dir, struct stat *st, uint32_t count) |
int | dirreenumerate (struct dir *dir, struct stat *st) |
int | getdirparams (const AFPObj *obj, const struct vol *vol, uint16_t bitmap, struct path *s_path, struct dir *dir, char *buf, size_t *buflen) |
int | path_error (struct path *path, int error) |
int | afp_setdirparams (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen) |
int | setdirparams (struct vol *vol, struct path *path, uint16_t d_bitmap, char *buf) |
int | afp_syncdir (AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen) |
int | afp_createdir (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) |
int | renamedir (struct vol *vol, int dirfd, char *src, char *dst, struct dir *newparent, char *newname) |
int | deletecurdir (struct vol *vol) |
int | afp_mapid (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) |
int | afp_mapname (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) |
int | afp_closedir (AFPObj *obj _U_, char *ibuf _U_, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen) |
int | afp_opendir (AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) |
Variables | |
int | afp_errno |
struct dir | rootParent |
struct dir * | curdir = &rootParent |
struct path | Cur_Path |
q_t * | invalid_dircache_entries |
int afp_closedir | ( | AFPObj *obj | _U_, |
char *ibuf | _U_, | ||
size_t ibuflen | _U_, | ||
char *rbuf | _U_, | ||
size_t * | rbuflen ) |
int afp_createdir | ( | AFPObj * | obj, |
char * | ibuf, | ||
size_t ibuflen | _U_, | ||
char * | rbuf, | ||
size_t * | rbuflen ) |
int afp_mapid | ( | AFPObj * | obj, |
char * | ibuf, | ||
size_t ibuflen | _U_, | ||
char * | rbuf, | ||
size_t * | rbuflen ) |
int afp_mapname | ( | AFPObj * | obj, |
char * | ibuf, | ||
size_t ibuflen | _U_, | ||
char * | rbuf, | ||
size_t * | rbuflen ) |
int afp_setdirparams | ( | AFPObj * | obj, |
char * | ibuf, | ||
size_t ibuflen | _U_, | ||
char *rbuf | _U_, | ||
size_t * | rbuflen ) |
int afp_syncdir | ( | AFPObj *obj | _U_, |
char * | ibuf, | ||
size_t ibuflen | _U_, | ||
char *rbuf | _U_, | ||
size_t * | rbuflen ) |
Resolve a catalog node name path.
|
static |
Convert name in client encoding to server encoding.
Convert ret->m_name to ret->u_name from client encoding to server encoding. This only gets called from cname().
int deletecurdir | ( | struct vol * | vol | ) |
|
static |
Create struct dir from struct path.
Create a new struct dir from struct path. Then add it to the cache.
vol | (r) pointer to struct vol, possibly modified in callee |
dir | (r) pointer to parent directory |
path | (rw) pointer to struct path with valid path->u_name |
len | (r) strlen of path->u_name |
void dir_free | ( | struct dir * | dir | ) |
Free a struct dir and all its members.
dir | (rw) pointer to struct dir |
void dir_free_invalid_q | ( | void | ) |
Free the queue with invalid struct dirs
This gets called at the end of every AFP func.
struct dir * dir_new | ( | const char * | m_name, |
const char * | u_name, | ||
const struct vol * | vol, | ||
cnid_t | pdid, | ||
cnid_t | did, | ||
bstring | path, | ||
struct stat * | st ) |
Construct struct dir.
Construct struct dir from parameters.
m_name | (r) directory name in UTF8-dec |
u_name | (r) directory name in server side encoding |
vol | (r) pointer to struct vol |
pdid | (r) Parent CNID |
did | (r) CNID |
path | (r) Full unix path to object |
st | (r) struct stat of object |
Remove a file/directory from dircache.
vol | (r) volume pointer |
dir | (rw) directory/file entry to remove from cache |
Resolve a DID.
Resolve a DID, allocate a struct dir for it
vol | (r) pointer to struct vol |
did | (r) DID to resolve |
|
static |
int dirreenumerate | ( | struct dir * | dir, |
struct stat * | st ) |
int get_afp_errno | ( | const int | param | ) |
int getdirparams | ( | const AFPObj * | obj, |
const struct vol * | vol, | ||
uint16_t | bitmap, | ||
struct path * | s_path, | ||
struct dir * | dir, | ||
char * | buf, | ||
size_t * | buflen ) |
|
static |
|
static |
int path_error | ( | struct path * | path, |
int | error ) |
Build struct path from struct dir.
The final movecwd in cname failed, possibly with EPERM or ENOENT. We:
int renamedir | ( | struct vol * | vol, |
int | dirfd, | ||
char * | src, | ||
char * | dst, | ||
struct dir * | newparent, | ||
char * | newname ) |
|
static |
void setdiroffcnt | ( | struct dir * | dir, |
struct stat * | st, | ||
uint32_t | count ) |
int afp_errno |
struct path Cur_Path |
struct dir* curdir = &rootParent |
q_t* invalid_dircache_entries |
struct dir rootParent |