netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
ea_sys.c File Reference
#include <arpa/inet.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/compat.h>
#include <atalk/ea.h>
#include <atalk/logger.h>
#include <atalk/unix.h>
#include <atalk/util.h>
#include <atalk/vfs.h>
#include <atalk/volume.h>

Functions

static int sys_ea_attrname_invalid (const char *func, const char *attruname)
 
int sys_get_easize (const struct vol *vol, char *rbuf, size_t *rbuflen, const char *uname, int oflag, const char *attruname, int fd)
 get size of a native EA
 
int sys_get_eacontent (const struct vol *vol, char *rbuf, size_t *rbuflen, const char *uname, int oflag, const char *attruname, int maxreply, int fd)
 copy native EA into rbuf
 
int sys_list_eas (const struct vol *vol, char *attrnamebuf, size_t *buflen, const char *uname, int oflag, int fd)
 copy names of native EAs into attrnamebuf
 
int sys_set_ea (const struct vol *vol, const char *uname, const char *attruname, const char *ibuf, size_t attrsize, int oflag, int fd)
 set a native EA
 
int sys_remove_ea (const struct vol *vol, const char *uname, const char *attruname, int oflag, int fd)
 remove a native EA
 
int sys_ea_copyfile (const struct vol *vol, int sfd, const char *src, const char *dst)
 copy EAs
 

Function Documentation

◆ sys_ea_attrname_invalid()

static int sys_ea_attrname_invalid ( const char *  func,
const char *  attruname 
)
static

◆ sys_ea_copyfile()

int sys_ea_copyfile ( const struct vol vol,
int  sfd,
const char *  src,
const char *  dst 
)

copy EAs

Parameters
[in]volcurrent volume
[in]sfdsource file descriptor
[in]srcsource path
[in]dstdestination path
Returns
AFP code AFP_OK on success or appropriate AFP error code
Note
Copies EAs from source file to dest file.

◆ sys_get_eacontent()

int sys_get_eacontent ( const struct vol vol,
char *  rbuf,
size_t *  rbuflen,
const char *  uname,
int  oflag,
const char *  attruname,
int  maxreply,
int  fd 
)

copy native EA into rbuf

Parameters
[in]volcurrent volume
[out]rbufDSI reply buffer
[in,out]rbuflencurrent length of data in reply buffer
[in]unamefilename
[in]oflaglink and create flag
[in]attrunamename of attribute
[in]maxreplymaximum EA size as of current specs/real-life
[in]fdfile descriptor
Returns
AFP code: AFP_OK on success or appropriate AFP error code
Note
Copies EA into rbuf. Increments *rbuflen accordingly.

◆ sys_get_easize()

int sys_get_easize ( const struct vol vol,
char *  rbuf,
size_t *  rbuflen,
const char *  uname,
int  oflag,
const char *  attruname,
int  fd 
)

get size of a native EA

Parameters
[in]volcurrent volume
[out]rbufDSI reply buffer
[in,out]rbuflencurrent length of data in reply buffer
[in]unamefilename
[in]oflaglink and create flag
[in]attrunamename of attribute
[in]fdfile descriptor
Returns
AFP code: AFP_OK on success or appropriate AFP error code
Note
Copies EA size into rbuf in network order. Increments *rbuflen +4.

◆ sys_list_eas()

int sys_list_eas ( const struct vol vol,
char *  attrnamebuf,
size_t *  buflen,
const char *  uname,
int  oflag,
int  fd 
)

copy names of native EAs into attrnamebuf

Parameters
[in]volcurrent volume
[out]attrnamebufstore names a consecutive C strings here
[in,out]buflenlength of names in attrnamebuf
[in]unamefilename
[in]oflaglink and create flag
[in]fdfile descriptor
Returns
AFP code: AFP_OK on success or appropriate AFP error code
Note
Copies names of all EAs of uname as consecutive C strings into rbuf. Increments *rbuflen accordingly. We hide the adouble:ea extended attributes here, we do not allow reading, writing and deleting them.

◆ sys_remove_ea()

int sys_remove_ea ( const struct vol vol,
const char *  uname,
const char *  attruname,
int  oflag,
int  fd 
)

remove a native EA

Parameters
[in]volcurrent volume
[in]unamefilename
[in]attrunameEA name
[in]oflaglink and create flag
[in]fdfile descriptor
Returns
AFP code: AFP_OK on success or appropriate AFP error code
Note
Removes EA attruname from file uname.

◆ sys_set_ea()

int sys_set_ea ( const struct vol vol,
const char *  uname,
const char *  attruname,
const char *  ibuf,
size_t  attrsize,
int  oflag,
int  fd 
)

set a native EA

Parameters
[in]volcurrent volume
[in]unamefilename
[in]attrunameEA name
[in]ibufbuffer with EA content
[in]attrsizelength EA in ibuf
[in]oflaglink and create flag
[in]fdfile descriptor
Returns
AFP code: AFP_OK on success or appropriate AFP error code