![]() |
CernVM-FS
2.12.0
|
#include <xattr.h>
Classes | |
struct | XattrEntry |
struct | XattrHeader |
Public Member Functions | |
XattrList () | |
std::vector< std::string > | ListKeys () const |
std::string | ListKeysPosix (const std::string &merge_with) const |
bool | Has (const std::string &key) const |
bool | Get (const std::string &key, std::string *value) const |
bool | Set (const std::string &key, const std::string &value) |
bool | Remove (const std::string &key) |
bool | IsEmpty () const |
void | Clear () |
void | Serialize (unsigned char **outbuf, unsigned *size, const std::vector< std::string > *blacklist=NULL) const |
uint8_t | version () |
Static Public Member Functions | |
static XattrList * | CreateFromFile (const std::string &path) |
static XattrList * | Deserialize (const unsigned char *inbuf, const unsigned size) |
Static Public Attributes | |
static const uint8_t | kVersion = 1 |
Private Attributes | |
uint8_t | version_ |
std::map< std::string, std::string > | xattrs_ |
This file is part of the CernVM File System. Represents extended attributes that are maintained by the system or the user and just blindly stored and returned by cvmfs. Note that cvmfs' magic extended attributes (e.g. user.pid) will hide the ones maintained by the user but they are still present in the file catalogs.
First application of the extended attributes is security.capability in order to support POSIX file capabilities. Cvmfs' support for custom extended attributes is limited to 256 attributes, with names <= 256 characters and values <= 256 bytes. Thus there is no need for big endian/little endian conversion. The name must not be the empty string and must not contain the zero character. There are no restrictions on the content.
|
inline |
Definition at line 41 of file xattr.h.
Referenced by catalog::WritableCatalogManager::CloneTreeImpl().
|
static |
Converts all the extended attributes of path into a XattrList. Attributes that violate the XattrList restrictions are ignored. If path does not exist or on I/O errors, NULL is returned. The list of extended attributes is not supposed to change during the runtime of this method. The list of values must not exceed 64kB.
Definition at line 30 of file xattr.cc.
Referenced by publish::SyncMediator::AddDirectory(), publish::SyncMediator::AddFile(), publish::SyncMediator::AddHardlinkGroup(), publish::SyncUnionOverlayfs::HasXattr(), posix_get_stat(), publish::SyncMediator::PublishFilesCallback(), and publish::SyncMediator::TouchDirectory().
|
static |
Definition at line 67 of file xattr.cc.
Referenced by catalog::SqlLookupXattrs::GetXattrs().
bool XattrList::Get | ( | const std::string & | key, |
std::string * | value | ||
) | const |
Definition at line 108 of file xattr.cc.
Referenced by cvmfs::cvmfs_getxattr(), and PosixSetMeta().
bool XattrList::Has | ( | const std::string & | key | ) | const |
Definition at line 103 of file xattr.cc.
Referenced by publish::SyncUnionOverlayfs::HasXattr().
|
inline |
Definition at line 40 of file xattr.h.
Referenced by catalog::WritableCatalog::MoveToNestedRecursively(), and catalog::WritableCatalog::TouchEntry().
vector< string > XattrList::ListKeys | ( | ) | const |
Definition at line 119 of file xattr.cc.
Referenced by publish::SyncUnionOverlayfs::HasXattr(), and PosixSetMeta().
string XattrList::ListKeysPosix | ( | const std::string & | merge_with | ) | const |
The format of extended attribute lists in the (l)listxattr call is an array of all the keys concatenated and separated by null characters. If merge_with is not empty, the final list will be have the keys from the XattrList and the keys from merge_with without duplicates. The merge_with list is supposed to be in POSIX format.
Definition at line 137 of file xattr.cc.
Referenced by cvmfs::cvmfs_listxattr().
void XattrList::Serialize | ( | unsigned char ** | outbuf, |
unsigned * | size, | ||
const std::vector< std::string > * | blacklist = NULL |
||
) | const |
If the list of attributes is empty, Serialize returns NULL. Deserialize can deal with NULL pointers.
Definition at line 196 of file xattr.cc.
Referenced by catalog::SqlDirentTouch::BindXattr(), catalog::SqlDirentInsert::BindXattr(), and HashMeta().
bool XattrList::Set | ( | const std::string & | key, |
const std::string & | value | ||
) |
Definition at line 160 of file xattr.cc.
Referenced by CreateFromFile(), and Deserialize().
|
private |