netatalk: ea_sys.c File Reference

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

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] | vol | current volume
  [in] | sfd | source file descriptor
  [in] | src | source path
  [in] | dst | destination 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] | vol | current volume
  [out] | rbuf | DSI reply buffer
  [in,out] | rbuflen | current length of data in reply buffer
  [in] | uname | filename
  [in] | oflag | link and create flag
  [in] | attruname | name of attribute
  [in] | maxreply | maximum EA size as of current specs/real-life
  [in] | fd | file 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] | vol | current volume
  [out] | rbuf | DSI reply buffer
  [in,out] | rbuflen | current length of data in reply buffer
  [in] | uname | filename
  [in] | oflag | link and create flag
  [in] | attruname | name of attribute
  [in] | fd | file 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] | vol | current volume
  [out] | attrnamebuf | store names a consecutive C strings here
  [in,out] | buflen | length of names in attrnamebuf
  [in] | uname | filename
  [in] | oflag | link and create flag
  [in] | fd | file 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] | vol | current volume
  [in] | uname | filename
  [in] | attruname | EA name
  [in] | oflag | link and create flag
  [in] | fd | file 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] | vol | current volume
  [in] | uname | filename
  [in] | attruname | EA name
  [in] | ibuf | buffer with EA content
  [in] | attrsize | length EA in ibuf
  [in] | oflag | link and create flag
  [in] | fd | file descriptor

Returns
  AFP code: AFP_OK on success or appropriate AFP error code