ewmscp  ..
Public Member Functions | Private Attributes | List of all members
gpfs_acl_handler Class Reference

class for handling non-opaque gpfs acls More...

#include <gpfsFcntlHandler.h>

Public Member Functions

 gpfs_acl_handler ()
 creates struct for getAcl More...
 
 gpfs_acl_handler (gpfs_aclCount_t nEntries)
 creates struct for putAcl More...
 
gpfs_acl_t & acl ()
 
size_t size () const
 
const gpfs_ace_v4_t * begin () const
 
const gpfs_ace_v4_t * end () const
 
gpfs_ace_v4_t * begin ()
 
gpfs_ace_v4_t * end ()
 
void get (int fd, const std::string &path)
 
void set (int fd, const std::string &path)
 

Private Attributes

union {
   char   justTheSpace [0x10000]
 
   gpfs_acl_t   acl
 
buffer
 

Detailed Description

class for handling non-opaque gpfs acls

Definition at line 33 of file gpfsFcntlHandler.h.

Constructor & Destructor Documentation

◆ gpfs_acl_handler() [1/2]

gpfs_acl_handler::gpfs_acl_handler ( )

creates struct for getAcl

Definition at line 52 of file gpfsFcntlHandler.cpp.

52  {
53  buffer.acl.acl_len = sizeof(buffer);
54  buffer.acl.acl_level = GPFS_ACL_LEVEL_BASE;
55  buffer.acl.acl_version = 0;
56  buffer.acl.acl_type = GPFS_ACL_TYPE_NFS4;
57 }

References buffer.

◆ gpfs_acl_handler() [2/2]

gpfs_acl_handler::gpfs_acl_handler ( gpfs_aclCount_t  nEntries)

creates struct for putAcl

Definition at line 58 of file gpfsFcntlHandler.cpp.

58  {
59  buffer.acl.acl_len = reinterpret_cast<char*>(&buffer.acl.ace_v4[nEntries])
60  - reinterpret_cast<char*>(&buffer.acl.acl_len);
61  if (buffer.acl.acl_len > sizeof(buffer)) {
62  throw std::runtime_error("to many entries for gpfs acl");
63  }
64  buffer.acl.acl_level = GPFS_ACL_LEVEL_BASE;
65  buffer.acl.acl_version = GPFS_ACL_VERSION_NFS4;
66  buffer.acl.acl_type = GPFS_ACL_TYPE_NFS4;
67  buffer.acl.acl_nace = nEntries;
68 }

References buffer.

Member Function Documentation

◆ acl()

gpfs_acl_t& gpfs_acl_handler::acl ( )
inline

Definition at line 41 of file gpfsFcntlHandler.h.

41  {
42  return buffer.acl;
43  }

References buffer.

◆ begin() [1/2]

gpfs_ace_v4_t* gpfs_acl_handler::begin ( )

◆ begin() [2/2]

gpfs_ace_v4_t * gpfs_acl_handler::begin ( ) const

Definition at line 70 of file gpfsFcntlHandler.cpp.

70  {
71  if (buffer.acl.acl_version == GPFS_ACL_VERSION_NFS4) {
72  return &buffer.acl.ace_v4[0];
73  } else {
74  return &buffer.acl.v4Level1.ace_v4[0];
75  }
76 }

References buffer.

Referenced by outputHandler::Gpfs::writerGpfs::setAclData().

Here is the caller graph for this function:

◆ end() [1/2]

gpfs_ace_v4_t* gpfs_acl_handler::end ( )

◆ end() [2/2]

gpfs_ace_v4_t * gpfs_acl_handler::end ( ) const

Definition at line 77 of file gpfsFcntlHandler.cpp.

77  {
78  if (buffer.acl.acl_version == GPFS_ACL_VERSION_NFS4) {
79  return &buffer.acl.ace_v4[buffer.acl.acl_nace];
80  } else {
81  return &buffer.acl.v4Level1.ace_v4[buffer.acl.acl_nace];
82  }
83 }

References buffer.

◆ get()

void gpfs_acl_handler::get ( int  fd,
const std::string &  path 
)

Definition at line 99 of file gpfsFcntlHandler.cpp.

99  {
100  // use LWE_DATA_LWESEND as test for the existence of gpfs_getacl_fd
101 #ifdef LWE_DATA_LWESEND
102  if (fd != -1) {
103  timerInst(gpfs_getacl_fd);
104  throwcall::good0(gpfs_getacl_fd(fd,
105  GPFS_GETACL_STRUCT,
106  buffer.justTheSpace),
107  "can't get acl for ", path);
108  } else
109 #endif
110  {
111  timerInst(gpfs_getacl);
112  throwcall::good0(gpfs_getacl(path.c_str(),
113  GPFS_GETACL_STRUCT,
114  buffer.justTheSpace),
115  "can't get acl for ", path);
116  }
117  if (buffer.acl.acl_version != GPFS_ACL_VERSION_NFS4 &&
118  buffer.acl.acl_version != GPFS_ACL_VERSION_NFS4F) {
119  throw std::runtime_error("wrong acl version on " + path);
120  }
121 }

References buffer, throwcall::good0(), and timerInst.

Referenced by gpfsIoCommon::getAclData(), and inputHandler::Gpfs::getAclData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

void gpfs_acl_handler::set ( int  fd,
const std::string &  path 
)

Definition at line 123 of file gpfsFcntlHandler.cpp.

123  {
124 #ifdef LWE_DATA_LWESEND
125  if (fd != -1) {
126  timerInst(gpfs_putacl_fd);
127  throwcall::good0(gpfs_putacl_fd(fd,
128  GPFS_PUTACL_STRUCT,
129  buffer.justTheSpace),
130  "can't set acl for ", path);
131  } else
132 #endif
133  {
134  timerInst(gpfs_putacl);
135  throwcall::good0(gpfs_putacl(path.c_str(),
136  GPFS_PUTACL_STRUCT,
137  buffer.justTheSpace),
138  "can't set acl for ", path);
139  }
140 }

References buffer, throwcall::good0(), and timerInst.

Referenced by outputHandler::Gpfs::writerGpfs::setAclData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

size_t gpfs_acl_handler::size ( ) const
inline

Definition at line 44 of file gpfsFcntlHandler.h.

44  {
45  return buffer.acl.acl_nace;
46  };

References buffer.

Referenced by gpfsIoCommon::aclFromGpfs().

Here is the caller graph for this function:

Member Data Documentation

◆ acl

gpfs_acl_t gpfs_acl_handler::acl

Definition at line 36 of file gpfsFcntlHandler.h.

◆ buffer

union { ... } gpfs_acl_handler::buffer

◆ justTheSpace

char gpfs_acl_handler::justTheSpace[0x10000]

Definition at line 35 of file gpfsFcntlHandler.h.


The documentation for this class was generated from the following files:
gpfs_acl_handler::buffer
union gpfs_acl_handler::@3 buffer
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40