ewmscp  ..
Public Member Functions | Private Attributes | List of all members
aclBuffer Class Reference
Collaboration diagram for aclBuffer:
[legend]

Public Member Functions

 aclBuffer (const std::string &aPath, bool aIsDir=false)
 
 operator void * ()
 

Private Attributes

gpfs_opaque_acl_t acls
 
char spaceForData [0x10000 - sizeof(gpfs_opaque_acl_t)]
 
const std::string & path
 
bool isDir
 
bool initialized
 

Detailed Description

Definition at line 24 of file fixGpfsAcls.cpp.

Constructor & Destructor Documentation

◆ aclBuffer()

aclBuffer::aclBuffer ( const std::string &  aPath,
bool  aIsDir = false 
)
inline

Definition at line 31 of file fixGpfsAcls.cpp.

31  : path(aPath), isDir(aIsDir), initialized(false) {
32  acls.acl_buffer_len = sizeof(spaceForData);
33  acls.acl_version = 0;
34  acls.acl_type = GPFS_ACL_TYPE_ACCESS;
35  };

References acls, and spaceForData.

Member Function Documentation

◆ operator void *()

aclBuffer::operator void * ( )
inline

Definition at line 36 of file fixGpfsAcls.cpp.

36  {
37  if (!initialized) {
38  static const std::string pattern("/.aclgetXXXXXX");
39  std::vector<char> tmpName;
40  tmpName.reserve(path.size() + pattern.size());
41  tmpName.insert(tmpName.end(), path.cbegin(), path.cend());
42  tmpName.insert(tmpName.end(), pattern.cbegin(), pattern.cend());
43  tmpName.push_back('\0');
44  if (isDir) {
45  throwcall::badval(mkdtemp(tmpName.data()), nullptr, "can't create tmp dir '", tmpName.data(), "'");
46  } else {
47  auto fd = throwcall::badval(mkstemp(tmpName.data()), -1, "can't create tmp file '", tmpName.data(), "'");
48  throwcall::good0(close(fd), "can't close ", tmpName.data());
49  }
50  throwcall::good0(gpfs_getacl(tmpName.data(), 0, &acls), "can't get acl for '", tmpName.data(), "'");
51  if (isDir) {
52  throwcall::good0(rmdir(tmpName.data()), "can't remove '", tmpName.data(), "'");
53  } else {
54  throwcall::good0(unlink(tmpName.data()), "can't remove '", tmpName.data(), "'");
55  }
56  initialized = true;
57  }
58  return &acls;
59  }

References acls, throwcall::badval(), throwcall::good0(), initialized, isDir, and path.

Here is the call graph for this function:

Member Data Documentation

◆ acls

gpfs_opaque_acl_t aclBuffer::acls
private

Definition at line 25 of file fixGpfsAcls.cpp.

Referenced by aclBuffer(), and operator void *().

◆ initialized

bool aclBuffer::initialized
private

Definition at line 29 of file fixGpfsAcls.cpp.

Referenced by operator void *().

◆ isDir

bool aclBuffer::isDir
private

Definition at line 28 of file fixGpfsAcls.cpp.

Referenced by operator void *().

◆ path

const std::string& aclBuffer::path
private

Definition at line 27 of file fixGpfsAcls.cpp.

Referenced by operator void *().

◆ spaceForData

char aclBuffer::spaceForData[0x10000 - sizeof(gpfs_opaque_acl_t)]
private

Definition at line 26 of file fixGpfsAcls.cpp.

Referenced by aclBuffer().


The documentation for this class was generated from the following file:
throwcall::badval
T badval(T call, t badvalue, const Args &... args)
template function to wrap system calls that return a special bad value on failure
Definition: throwcall.h:54
aclBuffer::acls
gpfs_opaque_acl_t acls
Definition: fixGpfsAcls.cpp:25
aclBuffer::initialized
bool initialized
Definition: fixGpfsAcls.cpp:29
aclBuffer::spaceForData
char spaceForData[0x10000 - sizeof(gpfs_opaque_acl_t)]
Definition: fixGpfsAcls.cpp:26
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40
aclBuffer::path
const std::string & path
Definition: fixGpfsAcls.cpp:27
aclBuffer::isDir
bool isDir
Definition: fixGpfsAcls.cpp:28