netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
file.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <utime.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/cnid.h>
#include <atalk/dsi.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/vfs.h>
#include "desktop.h"
#include "dircache.h"
#include "directory.h"
#include "file.h"
#include "filedir.h"
#include "fork.h"
#include "unix.h"
#include "volume.h"

Data Structures

struct  reenum

Macros

#define PARAM_NEED_ADP(b)
#define APPLETEMP   ".AppleTempXXXXXX"

Functions

static int default_type (void *finder)
void * get_finderinfo (const struct vol *vol, const char *upath, struct adouble *adp, void *data, int islink)
char * set_name (const struct vol *vol, char *data, cnid_t pid, char *name, cnid_t id, uint32_t utf8)
uint32_t get_id (struct vol *vol, struct adouble *adp, const struct stat *st, const cnid_t did, const char *upath, const int len)
 Get CNID for did/upath args both from database and adouble file.
int getmetadata (const AFPObj *obj, struct vol *vol, uint16_t bitmap, struct path *path, struct dir *dir, char *buf, size_t *buflen, struct adouble *adp)
int getfilparams (const AFPObj *obj, struct vol *vol, uint16_t bitmap, struct path *path, struct dir *dir, char *buf, size_t *buflen, int in_enumerate)
int afp_createfile (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
int afp_setfilparams (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
int setfilparams (const AFPObj *obj, struct vol *vol, struct path *path, uint16_t f_bitmap, char *buf)
int renamefile (struct vol *vol, struct dir *ddir, int sdir_fd, char *src, char *dst, char *newname, struct adouble *adp)
size_t mtoUTF8 (const struct vol *vol, const char *src, size_t srclen, char *dest, size_t destlen)
int copy_path_name (const struct vol *vol, char *newname, char *ibuf)
int afp_copyfile (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
int copyfile (struct vol *s_vol, struct vol *d_vol, struct dir *d_dir, int sfd, char *src, char *dst, char *newname, struct adouble *adp)
static int check_attrib (const struct vol *vol, struct adouble *adp)
int deletefile (const struct vol *vol, int dirfd, char *file, int checkAttrib)
int afp_createid (AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
static int reenumerate_loop (struct dirent *de, char *mname _U_, void *data)
static int reenumerate_id (struct vol *vol, char *name, struct dir *dir)
int afp_resolveid (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
int afp_deleteid (AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
static struct adoublefind_adouble (const AFPObj *obj, struct vol *vol, struct path *path, struct ofork **of, struct adouble *adp)
int afp_exchangefiles (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)

Variables

const uint8_t ufinderi [ADEDLEN_FINDERI]
static const uint8_t old_ufinderi []
struct path Cur_Path

Macro Definition Documentation

◆ APPLETEMP

#define APPLETEMP   ".AppleTempXXXXXX"

◆ PARAM_NEED_ADP

#define PARAM_NEED_ADP ( b)
Value:
((b) & ((1 << FILPBIT_ATTR) |\
(1 << FILPBIT_CDATE) |\
(1 << FILPBIT_MDATE) |\
(1 << FILPBIT_BDATE) |\
(1 << FILPBIT_FINFO) |\
(1 << FILPBIT_RFLEN) |\
(1 << FILPBIT_EXTRFLEN) |\
(1 << FILPBIT_PDINFO) |\
(1 << FILPBIT_FNUM) |\
(1 << FILPBIT_UNIXPR)))
#define FILPBIT_EXTRFLEN
Definition afpd/file.h:52
#define FILPBIT_FNUM
Definition afpd/file.h:47
#define FILPBIT_RFLEN
Definition afpd/file.h:49
#define FILPBIT_UNIXPR
Definition afpd/file.h:53
#define FILPBIT_MDATE
Definition afpd/file.h:42
#define FILPBIT_CDATE
Definition afpd/file.h:41
#define FILPBIT_ATTR
Definition afpd/file.h:39
#define FILPBIT_FINFO
Definition afpd/file.h:44
#define FILPBIT_BDATE
Definition afpd/file.h:43
#define FILPBIT_PDINFO
Definition afpd/file.h:51

Function Documentation

◆ afp_copyfile()

int afp_copyfile ( AFPObj * obj,
char * ibuf,
size_t ibuflen _U_,
char *rbuf _U_,
size_t * rbuflen )

◆ afp_createfile()

int afp_createfile ( AFPObj * obj,
char * ibuf,
size_t ibuflen _U_,
char *rbuf _U_,
size_t * rbuflen )

◆ afp_createid()

int afp_createid ( AFPObj *obj _U_,
char * ibuf,
size_t ibuflen _U_,
char * rbuf,
size_t * rbuflen )

◆ afp_deleteid()

int afp_deleteid ( AFPObj *obj _U_,
char * ibuf,
size_t ibuflen _U_,
char *rbuf _U_,
size_t * rbuflen )

◆ afp_exchangefiles()

int afp_exchangefiles ( AFPObj * obj,
char * ibuf,
size_t ibuflen _U_,
char *rbuf _U_,
size_t * rbuflen )

◆ afp_resolveid()

int afp_resolveid ( AFPObj * obj,
char * ibuf,
size_t ibuflen _U_,
char * rbuf,
size_t * rbuflen )

◆ afp_setfilparams()

int afp_setfilparams ( AFPObj * obj,
char * ibuf,
size_t ibuflen _U_,
char *rbuf _U_,
size_t * rbuflen )

◆ check_attrib()

int check_attrib ( const struct vol * vol,
struct adouble * adp )
static

◆ copy_path_name()

int copy_path_name ( const struct vol * vol,
char * newname,
char * ibuf )

◆ copyfile()

int copyfile ( struct vol * s_vol,
struct vol * d_vol,
struct dir * d_dir,
int sfd,
char * src,
char * dst,
char * newname,
struct adouble * adp )

◆ default_type()

int default_type ( void * finder)
static

◆ deletefile()

int deletefile ( const struct vol * vol,
int dirfd,
char * file,
int checkAttrib )

◆ find_adouble()

struct adouble * find_adouble ( const AFPObj * obj,
struct vol * vol,
struct path * path,
struct ofork ** of,
struct adouble * adp )
static

◆ get_finderinfo()

void * get_finderinfo ( const struct vol * vol,
const char * upath,
struct adouble * adp,
void * data,
int islink )

Only enter if no appledouble information and no finder information found.

◆ get_id()

uint32_t get_id ( struct vol * vol,
struct adouble * adp,
const struct stat * st,
const cnid_t did,
const char * upath,
const int len )

Get CNID for did/upath args both from database and adouble file.

  1. Get the objects CNID as stored in its adouble file
  2. Get the objects CNID from the database
  3. Store resource fork data
Parameters
vol(rw) volume
adp(rw) adouble struct of object upath, might be NULL
st(r) stat of upath, must NOT be NULL
did(r) parent CNID of upath
upath(r) name of object
len(r) strlen of upath

◆ getfilparams()

int getfilparams ( const AFPObj * obj,
struct vol * vol,
uint16_t bitmap,
struct path * path,
struct dir * dir,
char * buf,
size_t * buflen,
int in_enumerate )

◆ getmetadata()

int getmetadata ( const AFPObj * obj,
struct vol * vol,
uint16_t bitmap,
struct path * path,
struct dir * dir,
char * buf,
size_t * buflen,
struct adouble * adp )

◆ mtoUTF8()

size_t mtoUTF8 ( const struct vol * vol,
const char * src,
size_t srclen,
char * dest,
size_t destlen )

◆ reenumerate_id()

int reenumerate_id ( struct vol * vol,
char * name,
struct dir * dir )
static

◆ reenumerate_loop()

int reenumerate_loop ( struct dirent * de,
char *mname _U_,
void * data )
static

◆ renamefile()

int renamefile ( struct vol * vol,
struct dir * ddir,
int sdir_fd,
char * src,
char * dst,
char * newname,
struct adouble * adp )

◆ set_name()

char * set_name ( const struct vol * vol,
char * data,
cnid_t pid,
char * name,
cnid_t id,
uint32_t utf8 )

◆ setfilparams()

int setfilparams ( const AFPObj * obj,
struct vol * vol,
struct path * path,
uint16_t f_bitmap,
char * buf )

Variable Documentation

◆ Cur_Path

struct path Cur_Path
extern

◆ old_ufinderi

const uint8_t old_ufinderi[]
static
Initial value:
= {
'T', 'E', 'X', 'T', 'U', 'N', 'I', 'X'
}

◆ ufinderi

const uint8_t ufinderi[ADEDLEN_FINDERI]
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
}