#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 mode_t | ea_header_mode (mode_t mode) |
| static mode_t | ea_mode (mode_t mode) |
| static char * | mtoupath (const struct vol *vol, const char *mpath) |
| static int | unpack_header (struct ea *ea) |
| unpack and verify header file data buffer at ea->ea_data into struct ea | |
| static int | pack_header (struct ea *ea) |
| pack everything from struct ea into buffer at ea->ea_data | |
| static int | ea_addentry (struct ea *ea, const char *attruname, size_t attrsize, int bitmap) |
| add one EA into ea->ea_entries[] | |
| static int | create_ea_header (const char *uname, struct ea *ea) |
| create EA header file, only called from ea_open | |
| static int | write_ea (const struct ea *ea, const char *attruname, const char *ibuf, size_t attrsize) |
| write an EA to disk | |
| static int | ea_delentry (struct ea *ea, const char *attruname) |
| delete one EA from ea->ea_entries[] | |
| static int | delete_ea_file (const struct ea *ea, const char *eaname) |
| delete EA file from disk | |
| char * | ea_path (const struct ea *ea, const char *eaname, int macname) |
| return name of ea header filename | |
| int | ea_open (const struct vol *vol, const char *uname, eaflags_t eaflags, struct ea *ea) |
| open EA header file, create if it doesnt exits and called with O_CREATE | |
| int | ea_openat (const struct vol *vol, int dirfd, const char *uname, eaflags_t eaflags, struct ea *ea) |
| openat like wrapper for ea_open, takes a additional file descriptor | |
| int | ea_close (struct ea *ea) |
| flushes and closes an ea handle | |
| int | get_easize (const struct vol *vol, char *rbuf, size_t *rbuflen, const char *uname, int oflag, const char *attruname, int fd) |
| get size of an EA | |
| int | get_eacontent (const struct vol *vol, char *rbuf, size_t *rbuflen, const char *uname, int oflag, const char *attruname, int maxreply, int fd) |
| copy EA into rbuf | |
| int | list_eas (const struct vol *vol, char *attrnamebuf, size_t *buflen, const char *uname, int oflag, int fd) |
| copy names of EAs into attrnamebuf | |
| int | set_ea (const struct vol *vol, const char *uname, const char *attruname, const char *ibuf, size_t attrsize, int oflag, int fd) |
| set a Solaris native EA | |
| int | remove_ea (const struct vol *vol, const char *uname, const char *attruname, int oflag, int fd) |
| remove a EA from a file | |
| int | ea_deletefile (const struct vol *vol, int dirfd, const char *file) |
| int | ea_renamefile (const struct vol *vol, int dirfd, const char *src, const char *dst) |
| int | ea_copyfile (const struct vol *vol, int sfd, const char *src, const char *dst) |
| copy EAs | |
| int | ea_chown (const struct vol *vol, const char *path, uid_t uid, gid_t gid) |
| int | ea_chmod_file (const struct vol *vol, const char *name, mode_t mode, struct stat *st) |
| int | ea_chmod_dir (const struct vol *vol, const char *name, mode_t mode, struct stat *st) |
Store Extended Attributes inside .AppleDouble folders as follows:
filename "fileWithEAs" with EAs "testEA1" and "testEA2"
|
static |
create EA header file, only called from ea_open
| [in] | uname | filename for which we have to create a header |
| [in,out] | ea | ea handle with already allocated storage pointed to by ea->ea_data |
|
static |
delete EA file from disk
| [in] | ea | struct ea handle |
| [in] | eaname | EA name |
|
static |
add one EA into ea->ea_entries[]
| [in,out] | ea | pointer to struct ea |
| [in] | attruname | name of EA |
| [in] | attrsize | size of ea |
| [in] | bitmap | bitmap from FP func |
| int ea_chmod_dir | ( | const struct vol * | vol, |
| const char * | name, | ||
| mode_t | mode, | ||
| struct stat * | st ) |
| int ea_chmod_file | ( | const struct vol * | vol, |
| const char * | name, | ||
| mode_t | mode, | ||
| struct stat * | st ) |
| int ea_chown | ( | const struct vol * | vol, |
| const char * | path, | ||
| uid_t | uid, | ||
| gid_t | gid ) |
| int ea_close | ( | struct ea * | ea | ) |
flushes and closes an ea handle
| [in,out] | ea | pointer to ea handle |
| int ea_copyfile | ( | const struct vol * | vol, |
| int | sfd, | ||
| const char * | src, | ||
| const char * | dst ) |
copy EAs
| [in] | vol | current volume |
| [in] | sfd | source file descriptor |
| [in] | src | source path |
| [in] | dst | destination path |
|
static |
delete one EA from ea->ea_entries[]
| [in,out] | ea | pointer to struct ea |
| [in] | attruname | EA name |
| int ea_deletefile | ( | const struct vol * | vol, |
| int | dirfd, | ||
| const char * | file ) |
|
inlinestatic |
Build mode for EA header from file mode
|
inlinestatic |
Build mode for EA file from file mode
open EA header file, create if it doesnt exits and called with O_CREATE
| [in] | vol | current volume |
| [in] | uname | filename for which we have to open a header |
| [in] | eaflags | flag to control open behavior:
|
| [out] | ea | pointer to a struct ea that we fill |
| int ea_openat | ( | const struct vol * | vol, |
| int | dirfd, | ||
| const char * | uname, | ||
| eaflags_t | eaflags, | ||
| struct ea * | ea ) |
openat like wrapper for ea_open, takes a additional file descriptor
| [in] | vol | current volume |
| [in] | dirfd | openat like file descriptor |
| [in] | uname | filename for which we have to open a header |
| [in] | eaflags | flag to control open behavior:
|
| [out] | ea | pointer to a struct ea that we fill |
| char * ea_path | ( | const struct ea * | ea, |
| const char * | eaname, | ||
| int | macname ) |
return name of ea header filename
| [in] | ea | ea handle |
| [in] | eaname | name of EA or NULL |
| [in] | macname | if != 0 call mtoupath on eaname |
| int ea_renamefile | ( | const struct vol * | vol, |
| int | dirfd, | ||
| const char * | src, | ||
| const char * | dst ) |
| int get_eacontent | ( | const struct vol * | vol, |
| char * | rbuf, | ||
| size_t * | rbuflen, | ||
| const char * | uname, | ||
| int | oflag, | ||
| const char * | attruname, | ||
| int | maxreply, | ||
| int | fd ) |
copy EA into rbuf
| [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 |
| int get_easize | ( | const struct vol * | vol, |
| char * | rbuf, | ||
| size_t * | rbuflen, | ||
| const char * | uname, | ||
| int | oflag, | ||
| const char * | attruname, | ||
| int | fd ) |
get size of an EA
| [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 |
| int list_eas | ( | const struct vol * | vol, |
| char * | attrnamebuf, | ||
| size_t * | buflen, | ||
| const char * | uname, | ||
| int | oflag, | ||
| int | fd ) |
copy names of EAs into attrnamebuf
| [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 |
|
static |
|
static |
pack everything from struct ea into buffer at ea->ea_data
| [in,out] | ea | handle to struct ea |
| int remove_ea | ( | const struct vol * | vol, |
| const char * | uname, | ||
| const char * | attruname, | ||
| int | oflag, | ||
| int | fd ) |
remove a EA from a file
| [in] | vol | current volume |
| [in] | uname | filename |
| [in] | attruname | EA name |
| [in] | oflag | link and create flag |
| [in] | fd | file descriptor |
| int set_ea | ( | const struct vol * | vol, |
| const char * | uname, | ||
| const char * | attruname, | ||
| const char * | ibuf, | ||
| size_t | attrsize, | ||
| int | oflag, | ||
| int | fd ) |
set a Solaris native EA
| [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 |
|
static |
unpack and verify header file data buffer at ea->ea_data into struct ea
| [in,out] | ea | handle to struct ea |
|
static |
write an EA to disk
| [in] | ea | struct ea handle |
| [in] | attruname | EA name |
| [in] | ibuf | buffer with EA content |
| [in] | attrsize | size of EA |