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

class for handling gpfs_fcnt calls with their very special parameter handling More...

#include <gpfsFcntlHandler.h>

Public Member Functions

 gpfs_fcntl_handler ()
 
void call (int fd, const std::string &path)
 
void dump () const
 

Public Attributes

union {
   gpfsFcntlHeader_t   header
 
   char   justCharsProvidingSpace [GPFS_MAX_FCNTL_LENGTH]
 
buffer
 

Detailed Description

class for handling gpfs_fcnt calls with their very special parameter handling

Definition at line 6 of file gpfsFcntlHandler.h.

Constructor & Destructor Documentation

◆ gpfs_fcntl_handler()

gpfs_fcntl_handler::gpfs_fcntl_handler ( )

Definition at line 8 of file gpfsFcntlHandler.cpp.

8  {
9  buffer.header.totalLength = sizeof(buffer.header);
10  buffer.header.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
11  buffer.header.errorOffset = -1;
12  buffer.header.fcntlReserved = 0;
13 }

References buffer.

Member Function Documentation

◆ call()

void gpfs_fcntl_handler::call ( int  fd,
const std::string &  path 
)

Definition at line 15 of file gpfsFcntlHandler.cpp.

15  {
16  auto result = gpfs_fcntl(fd, &buffer);
17  if (result) {
18  if (errno == ENOSYS) {
19  throw unimplementedActionError("gpfs_fcntl not implemented here");
20  }
21  switch (buffer.header.errorOffset) {
22  case -1: // unchanged, happens if fd does not point to a file on gpfs
23  throwcall::good0(result, "can't fcntl ", path, ", is not on a gpfs file system");
24  break;
25  case 0:
26 
27  throwcall::good0(result, "can't fcntl ", path,
28  ", wrong version number ", buffer.header.fcntlVersion);
29  break;
30  default:
31  int i = 0;
32  int o = 0;
33  while (o < buffer.header.errorOffset) {
34  std::cerr << o << "\n";
35  o += *reinterpret_cast<const int*>(&buffer.justCharsProvidingSpace[o]);
36  i++;
37  }
38  throwcall::good0(result, "can't fcntl ", path,
39  ", wrong parameter in hint ", i,
40  " at offset ", buffer.header.errorOffset);
41  }
42  }
43 };

References buffer, and throwcall::good0().

Referenced by outputHandler::Gpfs::writerGpfs::doSpecialFdHandling(), main(), inputHandler::Gpfs::readerGpfs::readerGpfs(), gpfsIoCommon::releaseUsedBlocks(), inputHandler::Gpfs::readerGpfs::~readerGpfs(), and outputHandler::Gpfs::writerGpfs::~writerGpfs().

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

◆ dump()

void gpfs_fcntl_handler::dump ( ) const

Definition at line 45 of file gpfsFcntlHandler.cpp.

45  {
46  std::cerr << "dump of fcntl struct at " << (void*)this << "\n";
47  for (int i = 0; i < buffer.header.totalLength; i += sizeof(int)) {
48  std::cerr << *reinterpret_cast<const int*>(&buffer.justCharsProvidingSpace[i]) << "\n";
49  }
50 }

References buffer.

Member Data Documentation

◆ buffer

union { ... } gpfs_fcntl_handler::buffer

◆ header

gpfsFcntlHeader_t gpfs_fcntl_handler::header

Definition at line 9 of file gpfsFcntlHandler.h.

◆ justCharsProvidingSpace

char gpfs_fcntl_handler::justCharsProvidingSpace[GPFS_MAX_FCNTL_LENGTH]

Definition at line 10 of file gpfsFcntlHandler.h.


The documentation for this class was generated from the following files:
unimplementedActionError
class for exceptions that result from unimplemented functions Exceptions of this kind are to be throw...
Definition: copyRequestTypes.h:32
gpfs_fcntl_handler::buffer
union gpfs_fcntl_handler::@2 buffer
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40