netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
fork.h File Reference
#include <arpa/inet.h>
#include <stdio.h>
#include <atalk/adouble.h>
#include "directory.h"
#include "volume.h"

Go to the source code of this file.

Data Structures

struct  file_key
 
struct  ofork
 

Macros

#define OPENFORK_DATA   (0)
 
#define OPENFORK_RSCS   (1<<7)
 
#define OPENACC_RD   (1<<0)
 
#define OPENACC_WR   (1<<1)
 
#define OPENACC_DRD   (1<<4)
 
#define OPENACC_DWR   (1<<5)
 
#define AFPFORK_DATA   (1<<0)
 
#define AFPFORK_RSRC   (1<<1)
 
#define AFPFORK_META   (1<<2)
 
#define AFPFORK_DIRTY   (1<<3)
 
#define AFPFORK_ACCRD   (1<<4)
 
#define AFPFORK_ACCWR   (1<<5)
 
#define AFPFORK_ACCMASK   (AFPFORK_ACCRD | AFPFORK_ACCWR)
 
#define AFPFORK_MODIFIED   (1<<6)
 
#define AFPFORK_ERROR   (1<<7)
 
#define AFPFORK_VIRTUAL   (1<<8)
 
#define of_name(a)   (a)->of_ad->ad_name
 

Functions

struct oforkof_alloc (struct vol *, struct dir *, char *, uint16_t *, const int, struct adouble *, struct stat *)
 
void of_dealloc (struct ofork *)
 
struct oforkof_find (const uint16_t)
 
struct oforkof_findname (const struct vol *vol, struct path *)
 
int of_rename (const struct vol *, struct ofork *, struct dir *, const char *, struct dir *, const char *)
 
int of_flush (const struct vol *)
 
void of_pforkdesc (FILE *)
 
int of_stat (const struct vol *vol, struct path *)
 
int of_statdir (struct vol *vol, struct path *)
 stat the current directory.
 
int of_closefork (const AFPObj *obj, struct ofork *ofork)
 
void of_closevol (const AFPObj *obj, const struct vol *vol)
 
void of_close_all_forks (const AFPObj *obj)
 
struct adoubleof_ad (const struct vol *, struct path *, struct adouble *)
 
struct oforkof_findnameat (int dirfd, struct path *path)
 Search for open fork by dirfd/name.
 
int of_fstatat (int dirfd, struct path *path)
 
int flushfork (struct ofork *)
 
int afp_openfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_bytelock (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_getforkparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_setforkparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_read (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_write (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_flushfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_flush (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_closefork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_bytelock_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_read_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_write_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_syncfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 

Macro Definition Documentation

◆ AFPFORK_ACCMASK

#define AFPFORK_ACCMASK   (AFPFORK_ACCRD | AFPFORK_ACCWR)

◆ AFPFORK_ACCRD

#define AFPFORK_ACCRD   (1<<4)

◆ AFPFORK_ACCWR

#define AFPFORK_ACCWR   (1<<5)

◆ AFPFORK_DATA

#define AFPFORK_DATA   (1<<0)

open datafork

◆ AFPFORK_DIRTY

#define AFPFORK_DIRTY   (1<<3)

◆ AFPFORK_ERROR

#define AFPFORK_ERROR   (1<<7)

used to indicate an error in opening the fork

◆ AFPFORK_META

#define AFPFORK_META   (1<<2)

open metadata

◆ AFPFORK_MODIFIED

#define AFPFORK_MODIFIED   (1<<6)

used in FCE for modified files

◆ AFPFORK_RSRC

#define AFPFORK_RSRC   (1<<1)

open rsrcfork

◆ AFPFORK_VIRTUAL

#define AFPFORK_VIRTUAL   (1<<8)

virtual file fork

◆ of_name

#define of_name (   a)    (a)->of_ad->ad_name

◆ OPENACC_DRD

#define OPENACC_DRD   (1<<4)

◆ OPENACC_DWR

#define OPENACC_DWR   (1<<5)

◆ OPENACC_RD

#define OPENACC_RD   (1<<0)

◆ OPENACC_WR

#define OPENACC_WR   (1<<1)

◆ OPENFORK_DATA

#define OPENFORK_DATA   (0)

◆ OPENFORK_RSCS

#define OPENFORK_RSCS   (1<<7)

Function Documentation

◆ afp_bytelock()

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

◆ afp_bytelock_ext()

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

◆ afp_closefork()

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

◆ afp_flush()

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

◆ afp_flushfork()

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

◆ afp_getforkparams()

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

◆ afp_openfork()

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

◆ afp_read()

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

◆ afp_read_ext()

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

◆ afp_setforkparams()

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

◆ afp_syncfork()

int afp_syncfork ( AFPObj obj,
char *  ibuf,
size_t  ibuflen,
char *  rbuf,
size_t *  rbuflen 
)
Bug:
There is a lot to tell about fsync, fdatasync, F_FULLFSYNC. fsync(2) on OSX is implemented differently than on other platforms.
See also
http://mirror.linux.org.au/pub/linux.conf.au/2007/video/talks/278.pdf

◆ afp_write()

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

◆ afp_write_ext()

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

◆ flushfork()

int flushfork ( struct ofork ofork)
extern

◆ of_ad()

struct adouble * of_ad ( const struct vol vol,
struct path path,
struct adouble ad 
)
extern

◆ of_alloc()

struct ofork * of_alloc ( struct vol vol,
struct dir dir,
char *  path,
uint16_t *  ofrefnum,
const int  eid,
struct adouble ad,
struct stat *  st 
)
extern

◆ of_close_all_forks()

void of_close_all_forks ( const AFPObj obj)
extern

close all forks

◆ of_closefork()

int of_closefork ( const AFPObj obj,
struct ofork ofork 
)
extern

◆ of_closevol()

void of_closevol ( const AFPObj obj,
const struct vol vol 
)
extern

close all forks for a volume

◆ of_dealloc()

void of_dealloc ( struct ofork of)
extern

◆ of_find()

struct ofork * of_find ( const uint16_t  ofrefnum)
extern

◆ of_findname()

struct ofork * of_findname ( const struct vol vol,
struct path path 
)
extern

◆ of_findnameat()

struct ofork * of_findnameat ( int  dirfd,
struct path path 
)
extern

Search for open fork by dirfd/name.

Function call of_fstatat with dirfd and path and uses dev and ino to search the open fork table.

Parameters
[in]dirfddirectory fd
[in,out]pathpointer to struct path

◆ of_flush()

int of_flush ( const struct vol vol)
extern

◆ of_fstatat()

int of_fstatat ( int  dirfd,
struct path path 
)
extern

◆ of_pforkdesc()

void of_pforkdesc ( FILE *  f)
extern

◆ of_rename()

int of_rename ( const struct vol vol,
struct ofork s_of,
struct dir olddir,
const char *  oldpath,
struct dir newdir,
const char *  newpath 
)
extern

◆ of_stat()

int of_stat ( const struct vol vol,
struct path path 
)
extern

◆ of_statdir()

int of_statdir ( struct vol vol,
struct path path 
)
extern

stat the current directory.

Note
stat(".") works even if "." is deleted thus we have to stat ../name because we want to know if it's there