netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
ofork.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <unistd.h>
#include <bstrlib.h>
#include <atalk/ea.h>
#include <atalk/fce_api.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/server_ipc.h>
#include <atalk/spotlight.h>
#include <atalk/util.h>
#include "ad_cache.h"
#include "desktop.h"
#include "dircache.h"
#include "directory.h"
#include "fork.h"
#include "virtual_icon.h"
#include "volume.h"

Macros

#define OFORK_HASHSIZE   64
 
#define min(a, b)   ((a)<(b)?(a):(b))
 

Functions

static unsigned long hashfn (const struct file_key *key)
 
static void of_hash (struct ofork *of)
 
static void of_unhash (struct ofork *of)
 
void of_pforkdesc (FILE *f)
 
int of_flush (const struct vol *vol)
 
int of_rename (const struct vol *vol, struct ofork *s_of, struct dir *olddir, const char *oldpath, struct dir *newdir, const char *newpath)
 
struct oforkof_alloc (struct vol *vol, struct dir *dir, char *path, uint16_t *ofrefnum, const int eid, struct adouble *ad, struct stat *st)
 
struct oforkof_find (const uint16_t ofrefnum)
 
int of_stat (const struct vol *vol, struct path *path)
 
int of_fstatat (int dirfd, struct path *path)
 
int of_statdir (struct vol *vol, struct path *path)
 stat the current directory.
 
struct oforkof_findname (const struct vol *vol, struct path *path)
 
struct oforkof_findnameat (int dirfd, struct path *path)
 Search for open fork by dirfd/name.
 
void of_dealloc (struct ofork *of)
 
int of_closefork (const AFPObj *obj, struct ofork *ofork)
 
struct adoubleof_ad (const struct vol *vol, struct path *path, struct adouble *ad)
 
void of_closevol (const AFPObj *obj, const struct vol *vol)
 
void of_close_all_forks (const AFPObj *obj)
 

Variables

static struct oforkofork_table [OFORK_HASHSIZE]
 
static struct ofork ** oforks = NULL
 
static int nforks = 0
 
static u_short lastrefnum = 0
 

Macro Definition Documentation

◆ min

#define min (   a,
 
)    ((a)<(b)?(a):(b))

◆ OFORK_HASHSIZE

#define OFORK_HASHSIZE   64

Function Documentation

◆ hashfn()

static unsigned long hashfn ( const struct file_key key)
static

◆ of_ad()

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

◆ 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 
)

◆ of_close_all_forks()

void of_close_all_forks ( const AFPObj obj)

close all forks

◆ of_closefork()

int of_closefork ( const AFPObj obj,
struct ofork ofork 
)

◆ of_closevol()

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

close all forks for a volume

◆ of_dealloc()

void of_dealloc ( struct ofork of)

◆ of_find()

struct ofork * of_find ( const uint16_t  ofrefnum)

◆ of_findname()

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

◆ of_findnameat()

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

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)

◆ of_fstatat()

int of_fstatat ( int  dirfd,
struct path path 
)

◆ of_hash()

static void of_hash ( struct ofork of)
static

◆ of_pforkdesc()

void of_pforkdesc ( FILE *  f)

◆ 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 
)

◆ of_stat()

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

◆ of_statdir()

int of_statdir ( struct vol vol,
struct path path 
)

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

◆ of_unhash()

static void of_unhash ( struct ofork of)
static

Variable Documentation

◆ lastrefnum

u_short lastrefnum = 0
static

◆ nforks

int nforks = 0
static

◆ ofork_table

struct ofork* ofork_table[OFORK_HASHSIZE]
static

◆ oforks

struct ofork** oforks = NULL
static