XRootD
XrdCephXAttr Class Reference

#include <XrdCephXAttr.hh>

+ Inheritance diagram for XrdCephXAttr:
+ Collaboration diagram for XrdCephXAttr:

Public Member Functions

 XrdCephXAttr ()
 Constructor. More...
 
virtual ~XrdCephXAttr ()
 Destructor. More...
 
virtual int Del (const char *Aname, const char *Path, int fd=-1)
 
virtual void Free (AList *aPL)
 
virtual int Get (const char *Aname, void *Aval, int Avsz, const char *Path, int fd=-1)
 
virtual int List (AList **aPL, const char *Path, int fd=-1, int getSz=0)
 
virtual int Set (const char *Aname, const void *Aval, int Avsz, const char *Path, int fd=-1, int isNew=0)
 
- Public Member Functions inherited from XrdSysXAttr
 XrdSysXAttr ()
 Constructor and Destructor. More...
 
virtual ~XrdSysXAttr ()
 
virtual int Copy (const char *iPath, int iFD, const char *oPath, int oFD, const char *Aname=0)
 
virtual XrdSysErrorSetMsgRoute (XrdSysError *errP)
 

Additional Inherited Members

- Protected Attributes inherited from XrdSysXAttr
XrdSysErrorSay
 

Detailed Description

This class implements XrdSysXAttr interface for usage with a CEPH storage. It should be loaded via the ofs.xattrlib directive.

This plugin is able to use any pool of ceph with any userId. There are several ways to provide the pool and userId to be used for a given operation. Here is the ordered list of possibilities. First one defined wins :

  • the path can be prepended with userId and pool. Syntax is : [[userId@]pool:]<actual path>
  • the XrdOucEnv parameter, when existing, can have 'cephUserId' and/or 'cephPool' entries
  • the ofs.xattrlib directive can provide an argument with format : [userID@]pool
  • default are 'admin' and 'default' for userId and pool respectively

Note that the definition of a default via the ofs.xattrlib directive may clash with one used in a ofs.osslib directive. In case both directives have a default and they are different, the behavior is not defined. In case one of the two only has a default, it will be applied for both plugins.

Definition at line 52 of file XrdCephXAttr.hh.

Constructor & Destructor Documentation

◆ XrdCephXAttr()

XrdCephXAttr::XrdCephXAttr ( )

Constructor.

Definition at line 56 of file XrdCephXAttr.cc.

56 {}

◆ ~XrdCephXAttr()

XrdCephXAttr::~XrdCephXAttr ( )
virtual

Destructor.

Definition at line 58 of file XrdCephXAttr.cc.

58 {}

Member Function Documentation

◆ Del()

int XrdCephXAttr::Del ( const char *  Aname,
const char *  Path,
int  fd = -1 
)
virtual

Remove an extended attribute.

Parameters
Aname-> The attribute name.
Path-> Path of the file whose attribute is to be removed.
fdIf >=0 is the file descriptor of the opened subject file.
Returns
=0 Attribute was successfully removed or did not exist.
<0 Attribute was not removed, the return value is -errno that describes the reason for the failure.

Implements XrdSysXAttr.

Definition at line 60 of file XrdCephXAttr.cc.

60  {
61  try {
62  return ceph_posix_removexattr(0, Path, Aname);
63  } catch (std::exception &e) {
64  XrdCephXattrEroute.Say("Del : invalid syntax in file parameters", Path);
65  return -EINVAL;
66  }
67 }
int ceph_posix_removexattr(XrdOucEnv *env, const char *path, const char *name)
XrdSysError XrdCephXattrEroute(0)
Definition: XrdCephXAttr.cc:32
XrdOucString Path
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition: XrdSysError.cc:141

References ceph_posix_removexattr(), Path, XrdSysError::Say(), and XrdCephXattrEroute.

+ Here is the call graph for this function:

◆ Free()

void XrdCephXAttr::Free ( AList aPL)
virtual

Release storage occupied by the Alist structure returned by List().

Parameters
aPL-> The first element of the AList structure.

Implements XrdSysXAttr.

Definition at line 69 of file XrdCephXAttr.cc.

69  {
71 }
void ceph_posix_freexattrlist(XrdSysXAttr::AList *aPL)

References ceph_posix_freexattrlist().

+ Here is the call graph for this function:

◆ Get()

int XrdCephXAttr::Get ( const char *  Aname,
void *  Aval,
int  Avsz,
const char *  Path,
int  fd = -1 
)
virtual

Get an attribute value and its size.

Parameters
Aname-> The attribute name.
Aval-> Buffer to receive the attribute value.
AvszLength of the buffer in bytes. Only up to this number of bytes should be returned. However, should Avsz be zero the the size of the attribute value should be returned and the Aval argument should be ignored.
Path-> Path of the file whose attribute is to be fetched.
fd-> If >=0 is the file descriptor of the opened subject file.
Returns
>0 The number of bytes placed in Aval. However, if avsz is zero then the value is the actual size of the attribute value.
=0 The attribute does not exist.
<0 The attribute value could not be returned. The returned value is -errno describing the reason.

Implements XrdSysXAttr.

Definition at line 73 of file XrdCephXAttr.cc.

74  {
75  if (fd >= 0) {
76  return ceph_posix_fgetxattr(fd, Aname, Aval, Avsz);
77  } else {
78  try {
79  return ceph_posix_getxattr(0, Path, Aname, Aval, Avsz);
80  } catch (std::exception &e) {
81  XrdCephXattrEroute.Say("Get : invalid syntax in file parameters", Path);
82  return -EINVAL;
83  }
84  }
85 }
ssize_t ceph_posix_getxattr(XrdOucEnv *env, const char *path, const char *name, void *value, size_t size)
ssize_t ceph_posix_fgetxattr(int fd, const char *name, void *value, size_t size)

References ceph_posix_fgetxattr(), ceph_posix_getxattr(), Path, XrdSysError::Say(), and XrdCephXattrEroute.

+ Here is the call graph for this function:

◆ List()

int XrdCephXAttr::List ( AList **  aPL,
const char *  Path,
int  fd = -1,
int  getSz = 0 
)
virtual

Get all of the attributes associated with a file.

Parameters
aPL-> the pointer to hold the first element of AList. The storage occupied by the returned AList must be released by calling Free().
Path-> Path of the file whose attributes are t be returned.
fd-> If >=0 is the file descriptor of the opened subject file.
getSzWhen != 0 then the size of the maximum attribute value should be returned. Otherwise, upon success 0 is returned.
Returns
>0 Attributes were returned and aPL points to the first attribute value. The returned value is the largest size of an attribute value encountered (getSz != 0).
=0 Attributes were returned and aPL points to the first attribute value (getSz == 0).
<0 The attribute values could not be returned. The returned value is -errno describing the reason.

Implements XrdSysXAttr.

Definition at line 87 of file XrdCephXAttr.cc.

87  {
88  if (fd > 0) {
89  return ceph_posix_flistxattrs(fd, aPL, getSz);
90  } else {
91  try {
92  return ceph_posix_listxattrs(0, Path, aPL, getSz);
93  } catch (std::exception &e) {
94  XrdCephXattrEroute.Say("List : invalid syntax in file parameters", Path);
95  return -EINVAL;
96  }
97  }
98 }
int ceph_posix_listxattrs(XrdOucEnv *env, const char *path, XrdSysXAttr::AList **aPL, int getSz)
int ceph_posix_flistxattrs(int fd, XrdSysXAttr::AList **aPL, int getSz)

References ceph_posix_flistxattrs(), ceph_posix_listxattrs(), Path, XrdSysError::Say(), and XrdCephXattrEroute.

+ Here is the call graph for this function:

◆ Set()

int XrdCephXAttr::Set ( const char *  Aname,
const void *  Aval,
int  Avsz,
const char *  Path,
int  fd = -1,
int  isNew = 0 
)
virtual

Set an attribute.

Parameters
Aname-> The attribute name.
Aval-> Buffer holding the attribute value.
AvszLength of the buffer in bytes. This is the length of the attribute value which may contain binary data.
Path-> Path of the file whose attribute is to be set.
fd-> If >=0 is the file descriptor of the opened subject file.
isNewWhen !0 then the attribute must not exist (i.e. new). Otherwise, if it does exist, the value is replaced. In either case, if it does not exist it should be created.
Returns
=0 The attribute was successfully set.
<0 The attribute values could not be set. The returned value is -errno describing the reason.

Implements XrdSysXAttr.

Definition at line 100 of file XrdCephXAttr.cc.

101  {
102  if (fd >= 0) {
103  return ceph_posix_fsetxattr(fd, Aname, Aval, Avsz, 0);
104  } else {
105  try {
106  return ceph_posix_setxattr(0, Path, Aname, Aval, Avsz, 0);
107  } catch (std::exception &e) {
108  XrdCephXattrEroute.Say("Set : invalid syntax in file parameters", Path);
109  return -EINVAL;
110  }
111  }
112 }
int ceph_posix_fsetxattr(int fd, const char *name, const void *value, size_t size, int flags)
ssize_t ceph_posix_setxattr(XrdOucEnv *env, const char *path, const char *name, const void *value, size_t size, int flags)

References ceph_posix_fsetxattr(), ceph_posix_setxattr(), Path, XrdSysError::Say(), and XrdCephXattrEroute.

+ Here is the call graph for this function:

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