CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XattrList Class Reference

#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 XattrListCreateFromFile (const std::string &path)
 
static XattrListDeserialize (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_
 

Detailed Description

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.

Definition at line 27 of file xattr.h.

Constructor & Destructor Documentation

XattrList::XattrList ( )
inline

Definition at line 31 of file xattr.h.

Member Function Documentation

void XattrList::Clear ( )
inline

Definition at line 41 of file xattr.h.

Referenced by catalog::WritableCatalogManager::CloneTreeImpl().

Here is the caller graph for this function:

XattrList * XattrList::CreateFromFile ( const std::string &  path)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

XattrList * XattrList::Deserialize ( const unsigned char *  inbuf,
const unsigned  size 
)
static

Definition at line 67 of file xattr.cc.

Referenced by catalog::SqlLookupXattrs::GetXattrs().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool XattrList::Has ( const std::string &  key) const

Definition at line 103 of file xattr.cc.

Referenced by publish::SyncUnionOverlayfs::HasXattr().

Here is the caller graph for this function:

bool XattrList::IsEmpty ( ) const
inline

Definition at line 40 of file xattr.h.

Referenced by catalog::WritableCatalog::MoveToNestedRecursively(), and catalog::WritableCatalog::TouchEntry().

Here is the caller graph for this function:

vector< string > XattrList::ListKeys ( ) const

Definition at line 119 of file xattr.cc.

Referenced by publish::SyncUnionOverlayfs::HasXattr(), and PosixSetMeta().

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool XattrList::Remove ( const std::string &  key)

Definition at line 182 of file xattr.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool XattrList::Set ( const std::string &  key,
const std::string &  value 
)

Definition at line 160 of file xattr.cc.

Referenced by CreateFromFile(), and Deserialize().

Here is the caller graph for this function:

uint8_t XattrList::version ( )
inline

Definition at line 48 of file xattr.h.

Member Data Documentation

const uint8_t XattrList::kVersion = 1
static

Definition at line 29 of file xattr.h.

uint8_t XattrList::version_
private

Definition at line 73 of file xattr.h.

Referenced by version().

std::map<std::string, std::string> XattrList::xattrs_
private

Definition at line 74 of file xattr.h.

Referenced by Clear(), and IsEmpty().


The documentation for this class was generated from the following files: