netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
pfd_cache.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <atalk/directory.h>
#include <atalk/logger.h>
#include <atalk/util.h>
#include "dircache.h"
#include "directory.h"
#include "pfd_cache.h"
#include "volume.h"

Data Structures

struct  pfd_slot

Macros

#define PFD_SLOTS   16
#define PFD_OPEN_FLAGS   (O_RDONLY | O_DIRECTORY)

Functions

static void pfd_init_once (void)
static void slot_retire (struct pfd_slot *s)
static int slot_fill (struct pfd_slot *s, const struct vol *vol, const struct dir *parent)
static void slot_move_to_front (int i)
static int pfd_get (const struct vol *vol, const struct dir *parent)
static void pfd_repair_path (struct dir *entry, const struct dir *parent)
int pfd_ostat (const struct vol *vol, struct dir *entry, struct stat *st, int options)
 ostat(cfrombstr(entry->d_fullpath), st, options), accelerated.
void pfd_purge (uint16_t vid, cnid_t did)
void pfd_purge_vol (uint16_t vid)
void pfd_shutdown (void)
void pfd_stats_get (struct pfd_stats *out)
void pfd_log_stats (void)

Variables

static struct pfd_slot pfd_slots [PFD_SLOTS]
static int pfd_initialized
static struct pfd_stats pfd_stat

Macro Definition Documentation

◆ PFD_OPEN_FLAGS

#define PFD_OPEN_FLAGS   (O_RDONLY | O_DIRECTORY)

◆ PFD_SLOTS

#define PFD_SLOTS   16

Function Documentation

◆ pfd_get()

int pfd_get ( const struct vol * vol,
const struct dir * parent )
static

◆ pfd_init_once()

void pfd_init_once ( void )
static

◆ pfd_log_stats()

void pfd_log_stats ( void )

◆ pfd_ostat()

int pfd_ostat ( const struct vol * vol,
struct dir * entry,
struct stat * st,
int options )

ostat(cfrombstr(entry->d_fullpath), st, options), accelerated.

Resolves entry's parent to a cached dir fd and fstatat()s the leaf name; any impediment (no parent entry, ghost parent, open failure) falls back to the full-path ostat internally. Callers cannot observe which path ran: return value and errno are exactly what ostat would produce.

On success the entry's d_fullpath is additionally repaired against the parent's — the relative stat can outlive a rename the path string hasn't caught up with (see pfd_repair_path).

◆ pfd_purge()

void pfd_purge ( uint16_t vid,
cnid_t did )

◆ pfd_purge_vol()

void pfd_purge_vol ( uint16_t vid)

◆ pfd_repair_path()

void pfd_repair_path ( struct dir * entry,
const struct dir * parent )
static

◆ pfd_shutdown()

void pfd_shutdown ( void )

◆ pfd_stats_get()

void pfd_stats_get ( struct pfd_stats * out)

◆ slot_fill()

int slot_fill ( struct pfd_slot * s,
const struct vol * vol,
const struct dir * parent )
static

◆ slot_move_to_front()

void slot_move_to_front ( int i)
static

◆ slot_retire()

void slot_retire ( struct pfd_slot * s)
static

Variable Documentation

◆ pfd_initialized

int pfd_initialized
static

◆ pfd_slots

struct pfd_slot pfd_slots[PFD_SLOTS]
static

◆ pfd_stat

struct pfd_stats pfd_stat
static