netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
netatalk_conf.h File Reference
#include <stdint.h>
#include <atalk/globals.h>
#include <atalk/volume.h>

Go to the source code of this file.

Macros

#define NETATALK_READBUF_LIMIT   ((uint64_t)1 << 30)

Functions

int afp_config_parse (AFPObj *obj, char *processname)
void afp_config_free (AFPObj *obj)
int load_charset (struct vol *vol)
int load_afp_conf_vols (AFPObj *obj, lv_flags_t flags)
 Initialize volumes and load ini configfile.
void unload_volumes (AFPObj *obj)
struct volgetvolumes (void)
int conf_cnid_scheme_in_use (const AFPObj *obj, const char *scheme)
 Whether any configured volume resolves to the given CNID scheme.
struct volgetvolbyvid (const uint16_t)
struct volgetvolbypath (AFPObj *obj, const char *path)
 Search volume by path, creating user home vols as necessary.
struct volgetvolbyname (const char *name)
void volume_free (struct vol *vol)
 Free all resources allocated in a struct vol in load_afp_conf_vols().
void volume_unlink (struct vol *volume)
int netatalk_readbuf_clamp (int readbuf, uint32_t quantum, uint64_t limit)
struct extmapgetdefextmap (void)
struct extmapgetextmap (const char *path)

Macro Definition Documentation

◆ NETATALK_READBUF_LIMIT

#define NETATALK_READBUF_LIMIT   ((uint64_t)1 << 30)

ceiling for dsireadbuf x server quantum per session (1 GiB)

Function Documentation

◆ afp_config_free()

void afp_config_free ( AFPObj * obj)
extern

get rid of any allocated afp_option buffers.

◆ afp_config_parse()

int afp_config_parse ( AFPObj * AFPObj,
char * processname )
extern

Initialize an AFPObj and options from ini config file

◆ conf_cnid_scheme_in_use()

int conf_cnid_scheme_in_use ( const AFPObj * obj,
const char * scheme )
extern

Whether any configured volume resolves to the given CNID scheme.

Scans the loaded volume list, then the [Homes] section: homes volumes are instantiated per-user at login, so outside AFP sessions they never appear in the list. The section's scheme is resolved the same way creatvol() resolves it (section -> preset -> global -> compiled default).

◆ getdefextmap()

struct extmap * getdefextmap ( void )

◆ getextmap()

struct extmap * getextmap ( const char * path)

◆ getvolbyname()

struct vol * getvolbyname ( const char * name)
extern

◆ getvolbypath()

struct vol * getvolbypath ( AFPObj * obj,
const char * path )
extern

Search volume by path, creating user home vols as necessary.

Path may be absolute or relative. Ordinary volume structs are created when the ini config is initially parsed (load_afp_conf_vols()), but user volumes are as load_afp_conf_vols() only can create the user volume of the logged in user in an AFP session in afpd, but not when called from e.g. cnid_metad or dbd. Both cnid_metad and dbd thus need a way to lookup and create struct vols for user home by path. This is what this func does as well.

  1. Search "normal" volume list
  2. Check if theres a [Homes] section, load_afp_conf_vols() remembers this for us
  3. If there is, match "path" with "basedir regex" to get the user home parent dir
  4. Built user home path by appending the basedir matched in (3) and appending the username
  5. The next path element then is the username
    • getvolbypath() assumes that the user home directory has the same name as the username. If that is not true, getuserbypath() is called and tries to retrieve the username from the directory owner, checking its validity
  6. Append [Homes]->path subdirectory if defined
  7. Create volume
Parameters
[in,out]objhandle
[in]pathpath, may be relative or absolute

◆ getvolbyvid()

struct vol * getvolbyvid ( const uint16_t vid)
extern

◆ getvolumes()

struct vol * getvolumes ( void )
extern

◆ load_afp_conf_vols()

int load_afp_conf_vols ( AFPObj * obj,
lv_flags_t flags )
extern

Initialize volumes and load ini configfile.

Parameters
[in]objhandle
[in]flagsflags controlling volume load behaviour:
  • LV_DEFAULT: load shares in a user/session context, this honors authorization
  • LV_ALL: load shares that are available in the config file
  • LV_FORCE: reload file even though the timestamp wasn't changed

◆ load_charset()

int load_charset ( struct vol * vol)
extern

Load charsets for a volume

◆ netatalk_readbuf_clamp()

int netatalk_readbuf_clamp ( int readbuf,
uint32_t quantum,
uint64_t limit )
extern

Bound dsireadbuf so dsireadbuf * quantum never exceeds limit. The limit always wins: on a constrained platform the result may drop below the usual dsireadbuf floor of 6, but never below 1. The quantum is never reduced here: frame acceptance must not change as a side effect of read-ahead sizing. A zero quantum cannot occur in the config path and is treated as "no limit".

◆ unload_volumes()

void unload_volumes ( AFPObj * obj)
extern

◆ volume_free()

void volume_free ( struct vol * vol)
extern

Free all resources allocated in a struct vol in load_afp_conf_vols().

Actually opening a volume (afp_openvol()) will allocate additional resources which are freed in closevol()

◆ volume_unlink()

void volume_unlink ( struct vol * volume)
extern

Remove a volume from the linked list of volumes