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

#include <magic_xattr.h>

Inheritance diagram for MagicXattrManager:
Collaboration diagram for MagicXattrManager:

Public Types

enum  EVisibility { kVisibilityAlways, kVisibilityNever, kVisibilityRootOnly }
 

Public Member Functions

 MagicXattrManager (MountPoint *mountpoint, EVisibility visibility, const std::set< std::string > &protected_xattrs, const std::set< gid_t > &privileged_xattr_gids)
 
BaseMagicXattrGetLocked (const std::string &name, PathString path, catalog::DirectoryEntry *d)
 
std::string GetListString (catalog::DirectoryEntry *dirent)
 
void Register (const std::string &name, BaseMagicXattr *magic_xattr)
 
void Freeze ()
 
bool IsPrivilegedGid (gid_t gid)
 
EVisibility visibility ()
 
std::set< gid_t > privileged_xattr_gids ()
 
MountPointmount_point ()
 
bool is_frozen () const
 

Protected Attributes

std::map< std::string,
BaseMagicXattr * > 
xattr_list_
 
MountPointmount_point_
 
EVisibility visibility_
 
const std::set< std::string > protected_xattrs_
 
const std::set< gid_t > privileged_xattr_gids_
 

Private Member Functions

void SanityCheckProtectedXattrs ()
 

Private Attributes

bool is_frozen_
 

Additional Inherited Members

- Protected Member Functions inherited from SingleCopy
 SingleCopy ()
 

Detailed Description

This class is acting as a user entry point for magic extended attributes. It instantiates all defined attributes in the constructor. Users can:

  1. Register additional attributes
  2. Get a string containing zero-byte delimited list of attribute names (used in "cvmfs.cc")
  3. Get an attribute by name. Specifically, get a RAII wrapper around a singleton attribute instance. This means that the attribute instance registered with the manager does not get cloned or copied inside Get(). Instead, member variables are set and the original instance is returned. A mutex prevents from race conditions in case of concurrent access.

Definition at line 220 of file magic_xattr.h.

Member Enumeration Documentation

Enumerator
kVisibilityAlways 
kVisibilityNever 
kVisibilityRootOnly 

Definition at line 222 of file magic_xattr.h.

Constructor & Destructor Documentation

MagicXattrManager::MagicXattrManager ( MountPoint mountpoint,
EVisibility  visibility,
const std::set< std::string > &  protected_xattrs,
const std::set< gid_t > &  priviledged_xattr_gids 
)

This file is part of the CernVM File System.

Definition at line 19 of file magic_xattr.cc.

Here is the call graph for this function:

Member Function Documentation

void MagicXattrManager::Freeze ( )
inline

Freezes the current setup of MagicXattrManager. No new extended attributes can be added. Only after freezing MagicXattrManager can registered attributes be accessed.

Definition at line 244 of file magic_xattr.h.

Referenced by RegisterMagicXattrs().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string MagicXattrManager::GetListString ( catalog::DirectoryEntry dirent)

Definition at line 77 of file magic_xattr.cc.

Referenced by cvmfs::cvmfs_listxattr().

Here is the call graph for this function:

Here is the caller graph for this function:

BaseMagicXattr * MagicXattrManager::GetLocked ( const std::string &  name,
PathString  path,
catalog::DirectoryEntry d 
)

The returned BaseMagicXattr* is supposed to be wrapped by a MagicXattrRAIIWrapper

Definition at line 119 of file magic_xattr.cc.

Referenced by cvmfs::cvmfs_getxattr().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MagicXattrManager::is_frozen ( ) const
inline

Definition at line 252 of file magic_xattr.h.

Referenced by BaseMagicXattr::PrepareValueFencedProtected().

Here is the caller graph for this function:

bool MagicXattrManager::IsPrivilegedGid ( gid_t  gid)

Definition at line 154 of file magic_xattr.cc.

Referenced by BaseMagicXattr::PrepareValueFencedProtected().

Here is the caller graph for this function:

MountPoint* MagicXattrManager::mount_point ( )
inline

Definition at line 251 of file magic_xattr.h.

Referenced by AuthzMagicXattr::FinalizeValue(), ExternalHostMagicXattr::FinalizeValue(), ExternalTimeoutMagicXattr::FinalizeValue(), FqrnMagicXattr::FinalizeValue(), HostMagicXattr::FinalizeValue(), HostListMagicXattr::FinalizeValue(), LHashMagicXattr::FinalizeValue(), NCleanup24MagicXattr::FinalizeValue(), NDirOpenMagicXattr::FinalizeValue(), NDownloadMagicXattr::FinalizeValue(), NIOErrMagicXattr::FinalizeValue(), NOpenMagicXattr::FinalizeValue(), HitrateMagicXattr::FinalizeValue(), ProxyMagicXattr::FinalizeValue(), ProxyListMagicXattr::FinalizeValue(), ProxyListExternalMagicXattr::FinalizeValue(), RepoMetainfoMagicXattr::FinalizeValue(), RxMagicXattr::FinalizeValue(), SpeedMagicXattr::FinalizeValue(), TimeoutMagicXattr::FinalizeValue(), TimeoutDirectMagicXattr::FinalizeValue(), TimestampLastIOErrMagicXattr::FinalizeValue(), UsedFdMagicXattr::FinalizeValue(), UsedDirPMagicXattr::FinalizeValue(), ExternalURLMagicXattr::FinalizeValue(), AuthzMagicXattr::PrepareValueFenced(), CatalogCountersMagicXattr::PrepareValueFenced(), ChunkListMagicXattr::PrepareValueFenced(), ChunksMagicXattr::PrepareValueFenced(), NClgMagicXattr::PrepareValueFenced(), PubkeysMagicXattr::PrepareValueFenced(), RepoCountersMagicXattr::PrepareValueFenced(), RepoMetainfoMagicXattr::PrepareValueFenced(), RevisionMagicXattr::PrepareValueFenced(), RootHashMagicXattr::PrepareValueFenced(), and TagMagicXattr::PrepareValueFenced().

Here is the caller graph for this function:

std::set<gid_t> MagicXattrManager::privileged_xattr_gids ( )
inline

Definition at line 249 of file magic_xattr.h.

void MagicXattrManager::Register ( const std::string &  name,
BaseMagicXattr magic_xattr 
)

Registers a new extended attribute. Will fail if called after Freeze().

Definition at line 135 of file magic_xattr.cc.

Referenced by MagicXattrManager(), and RegisterMagicXattrs().

Here is the call graph for this function:

Here is the caller graph for this function:

void MagicXattrManager::SanityCheckProtectedXattrs ( )
private

Definition at line 167 of file magic_xattr.cc.

Referenced by Freeze().

Here is the call graph for this function:

Here is the caller graph for this function:

EVisibility MagicXattrManager::visibility ( )
inline

Definition at line 248 of file magic_xattr.h.

Referenced by cvmfs::cvmfs_listxattr(), and GetListString().

Here is the caller graph for this function:

Member Data Documentation

bool MagicXattrManager::is_frozen_
private

Definition at line 265 of file magic_xattr.h.

Referenced by Freeze(), is_frozen(), and Register().

MountPoint* MagicXattrManager::mount_point_
protected

Definition at line 256 of file magic_xattr.h.

Referenced by GetListString(), and mount_point().

const std::set<gid_t> MagicXattrManager::privileged_xattr_gids_
protected
const std::set<std::string> MagicXattrManager::protected_xattrs_
protected

Definition at line 261 of file magic_xattr.h.

Referenced by Register(), and SanityCheckProtectedXattrs().

EVisibility MagicXattrManager::visibility_
protected

Definition at line 257 of file magic_xattr.h.

Referenced by visibility().

std::map<std::string, BaseMagicXattr *> MagicXattrManager::xattr_list_
protected

Definition at line 255 of file magic_xattr.h.

Referenced by GetListString(), GetLocked(), Register(), and SanityCheckProtectedXattrs().


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