CMS 3D CMS Logo

LStoreFile.h
Go to the documentation of this file.
1 #ifndef LSTORE_ADAPTOR_LSTORE_FILE_H
2 #define LSTORE_ADAPTOR_LSTORE_FILE_H
3 
6 #include <string>
7 #include <pthread.h>
8 class LStoreFile : public Storage {
9 public:
10  LStoreFile(void);
11  LStoreFile(void *fd);
12  LStoreFile(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
13  LStoreFile(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
14  ~LStoreFile(void) override;
15 
16  virtual void create(const char *name, bool exclusive = false, int perms = 0666);
17  virtual void create(const std::string &name, bool exclusive = false, int perms = 0666);
18  virtual void open(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
19  virtual void open(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
20 
21  using Storage::position;
22  using Storage::read;
23  using Storage::write;
24 
25  IOSize read(void *into, IOSize n) override;
26  IOSize write(const void *from, IOSize n) override;
27 
28  IOOffset position(IOOffset offset, Relative whence = SET) override;
29  void resize(IOOffset size) override;
30 
31  void close(void) override;
32  virtual void abort(void);
33 
34  class MutexWrapper {
35  public:
36  MutexWrapper(pthread_mutex_t *lock);
37  ~MutexWrapper();
38  pthread_mutex_t *m_lock;
39  };
40 
41  static pthread_mutex_t m_dlopen_lock;
42 
43 private:
44  // functions
45 
46  void loadLibrary();
47  void closeLibrary();
48 
49  //data
50 
51  void *m_fd;
52  bool m_close;
56 
57  // Prototypes for functions
58  // These are data members that are function pointers.
59 
60  int32_t (*redd_init)();
61  int64_t (*redd_read)(void *, char *, int64_t);
62  int32_t (*redd_close)(void *);
63  int64_t (*redd_lseek)(void *, int64_t, uint32_t);
64  void *(*redd_open)(const char *, int32_t, int32_t);
65  int64_t (*redd_write)(void *, const char *, int64_t);
66  int32_t (*redd_term)();
67  int32_t (*redd_errno)();
68  const std::string &(*redd_strerror)();
69 };
70 
71 #endif // LSTORE_ADAPTOR_LSTORE_FILE_H
Storage::size
virtual IOOffset size(void) const
Definition: Storage.cc:77
LStoreFile::m_close
bool m_close
Definition: LStoreFile.h:52
LStoreFile::redd_write
int64_t(* redd_write)(void *, const char *, int64_t)
Definition: LStoreFile.h:65
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
LStoreFile::redd_term
int32_t(* redd_term)()
Definition: LStoreFile.h:66
LStoreFile::LStoreFile
LStoreFile(void)
Definition: LStoreFile.cc:16
LStoreFile::m_fd
void * m_fd
Definition: LStoreFile.h:51
Storage::SET
Definition: Storage.h:22
Storage::Relative
Relative
Definition: Storage.h:22
LStoreFile::create
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: LStoreFile.cc:141
LStoreFile::write
IOSize write(const void *from, IOSize n) override
Definition: LStoreFile.cc:247
Storage.h
LStoreFile::MutexWrapper::MutexWrapper
MutexWrapper(pthread_mutex_t *lock)
Definition: LStoreFile.cc:284
LStoreFile::open
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: LStoreFile.cc:157
LStoreFile::closeLibrary
void closeLibrary()
Definition: LStoreFile.cc:116
ztee.fd
fd
Definition: ztee.py:136
LStoreFile::m_is_loaded
bool m_is_loaded
Definition: LStoreFile.h:55
IOFlags.h
LStoreFile::m_library_handle
void * m_library_handle
Definition: LStoreFile.h:54
LStoreFile::loadLibrary
void loadLibrary()
Definition: LStoreFile.cc:84
IOFlags::OpenRead
Definition: IOFlags.h:7
LStoreFile::redd_lseek
int64_t(* redd_lseek)(void *, int64_t, uint32_t)
Definition: LStoreFile.h:63
LStoreFile
Definition: LStoreFile.h:8
LStoreFile::m_dlopen_lock
static pthread_mutex_t m_dlopen_lock
Definition: LStoreFile.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LStoreFile::redd_close
int32_t(* redd_close)(void *)
Definition: LStoreFile.h:62
CommonMethods.lock
def lock()
Definition: CommonMethods.py:82
LStoreFile::redd_read
int64_t(* redd_read)(void *, char *, int64_t)
Definition: LStoreFile.h:61
LStoreFile::close
void close(void) override
Definition: LStoreFile.cc:208
IOOffset
int64_t IOOffset
Definition: IOTypes.h:19
LStoreFile::redd_init
int32_t(* redd_init)()
Definition: LStoreFile.h:60
LStoreFile::~LStoreFile
~LStoreFile(void) override
Definition: LStoreFile.cc:64
LStoreFile::MutexWrapper::m_lock
pthread_mutex_t * m_lock
Definition: LStoreFile.h:38
LStoreFile::MutexWrapper::~MutexWrapper
~MutexWrapper()
Definition: LStoreFile.cc:289
LStoreFile::redd_errno
int32_t(* redd_errno)()
Definition: LStoreFile.h:67
generator_cfi.exclusive
exclusive
Definition: generator_cfi.py:24
Storage::position
virtual IOOffset position(void) const
Definition: Storage.cc:72
IOInput::read
int read(void)
Definition: IOInput.cc:52
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
IOSize
size_t IOSize
Definition: IOTypes.h:14
HLT_FULL_cff.flags
flags
Definition: HLT_FULL_cff.py:13216
Storage
Definition: Storage.h:20
LStoreFile::resize
void resize(IOOffset size) override
Definition: LStoreFile.cc:278
LStoreFile::m_name
std::string m_name
Definition: LStoreFile.h:53
LStoreFile::abort
virtual void abort(void)
Definition: LStoreFile.cc:226
LStoreFile::MutexWrapper
Definition: LStoreFile.h:34
Storage::write
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:44