CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
libcvmfs_int.h
Go to the documentation of this file.
1 
13 #ifndef CVMFS_LIBCVMFS_INT_H_
14 #define CVMFS_LIBCVMFS_INT_H_
15 
16 #include <syslog.h>
17 #include <time.h>
18 #include <unistd.h>
19 
20 #include <string>
21 #include <vector>
22 
23 #include "backoff.h"
24 #include "catalog_mgr.h"
25 #include "file_chunk.h"
26 #include "loader.h"
27 #include "lru.h"
28 #include "mountpoint.h"
29 #include "options.h"
30 
31 
32 class CacheManager;
33 namespace catalog {
34 class ClientCatalogManager;
35 }
36 namespace signature {
37 class SignatureManager;
38 }
39 namespace download {
40 class DownloadManager;
41 }
42 namespace perf {
43 class Statistics;
44 }
45 
46 namespace cvmfs {
47 extern pid_t pid_;
48 extern std::string *repository_name_;
49 extern bool foreground_;
50 class Fetcher;
51 }
52 
53 struct cvmfs_stat_t;
54 
55 
61  public:
62  static loader::Failures Initialize(OptionsManager *options_mgr);
63  static void CleanupInstance();
64  static LibGlobals* GetInstance();
65 
67  void set_options_mgr(OptionsManager *value) { options_mgr_ = value; }
68 
69  private:
70  LibGlobals();
71  ~LibGlobals();
72  static void CallbackLibcryptoLock(int mode, int type,
73  const char *file, int line);
74  // unsigned long type required by libcrypto (openssl)
75  static unsigned long CallbackLibcryptoThreadId(); // NOLINT
76 
78 
85 
86  pthread_mutex_t *libcrypto_locks_;
87 };
88 
89 
96  public:
97  static LibContext *Create(const std::string &fqrn,
98  OptionsManager *options_mgr);
99  ~LibContext();
100 
101  void EnableMultiThreaded();
102  int GetAttr(const char *c_path, struct stat *info);
103  int Readlink(const char *path, char *buf, size_t size);
104  int ListDirectory(const char *path,
105  char ***buf,
106  size_t *listlen,
107  size_t *buflen,
108  bool self_reference);
109  int ListDirectoryStat(const char *c_path,
110  cvmfs_stat_t **buf,
111  size_t *listlen,
112  size_t *buflen);
113 
114  int Open(const char *c_path);
115  int64_t Pread(int fd, void *buf, uint64_t size, uint64_t off);
116  int Close(int fd);
117 
118  int GetExtAttr(const char *c_path, struct cvmfs_attr *info);
119  int GetNestedCatalogAttr(const char *c_path, struct cvmfs_nc_attr *nc_attr);
120  int ListNestedCatalogs(const char *path, char ***buf, size_t *buflen);
121 
122  int Remount();
123  uint64_t GetRevision();
124 
126  void set_options_mgr(OptionsManager *value) { options_mgr_ = value; }
127 
128  private:
132  static const int kFdChunked = 1 << 30;
136  LibContext();
138 
139  void AppendStringToList(char const *str,
140  char ***buf,
141  size_t *listlen,
142  size_t *buflen);
143  void AppendStatToList(const cvmfs_stat_t st,
144  cvmfs_stat_t **buf,
145  size_t *listlen,
146  size_t *buflen);
147  bool GetDirentForPath(const PathString &path,
148  catalog::DirectoryEntry *dirent);
150  struct cvmfs_attr *attr);
151 
158 };
159 
160 #endif // CVMFS_LIBCVMFS_INT_H_
uint64_t GetRevision()
static LibContext * Create(const std::string &fqrn, OptionsManager *options_mgr)
void EnableMultiThreaded()
static const int kFdChunked
Definition: libcvmfs_int.h:132
int GetNestedCatalogAttr(const char *c_path, struct cvmfs_nc_attr *nc_attr)
static unsigned long CallbackLibcryptoThreadId()
bool foreground_
Definition: loader.cc:135
int Close(int fd)
static void CallbackLibcryptoLock(int mode, int type, const char *file, int line)
int GetAttr(const char *c_path, struct stat *info)
void set_options_mgr(OptionsManager *value)
Definition: libcvmfs_int.h:126
int GetExtAttr(const char *c_path, struct cvmfs_attr *info)
OptionsManager * options_mgr_
Definition: libcvmfs_int.h:156
bool GetDirentForPath(const PathString &path, catalog::DirectoryEntry *dirent)
static LibGlobals * instance_
Definition: libcvmfs_int.h:77
pid_t pid_
Definition: cvmfs.cc:146
int64_t Pread(int fd, void *buf, uint64_t size, uint64_t off)
static loader::Failures Initialize(OptionsManager *options_mgr)
Definition: libcvmfs_int.cc:94
int ListNestedCatalogs(const char *path, char ***buf, size_t *buflen)
MountPoint * mount_point_
Definition: libcvmfs_int.h:157
FileSystem * file_system()
Definition: libcvmfs_int.h:137
pthread_mutex_t * libcrypto_locks_
Definition: libcvmfs_int.h:86
void AppendStatToList(const cvmfs_stat_t st, cvmfs_stat_t **buf, size_t *listlen, size_t *buflen)
Failures
Definition: loader.h:27
int ListDirectoryStat(const char *c_path, cvmfs_stat_t **buf, size_t *listlen, size_t *buflen)
static LibGlobals * GetInstance()
Definition: libcvmfs_int.cc:85
int Open(const char *c_path)
MountPoint * mount_point()
Definition: libcvmfs_int.h:125
int ListDirectory(const char *path, char ***buf, size_t *listlen, size_t *buflen, bool self_reference)
FileSystem * file_system_
Definition: libcvmfs_int.h:84
void AppendStringToList(char const *str, char ***buf, size_t *listlen, size_t *buflen)
int Readlink(const char *path, char *buf, size_t size)
void CvmfsAttrFromDirent(const catalog::DirectoryEntry dirent, struct cvmfs_attr *attr)
OptionsManager * options_mgr_
Definition: libcvmfs_int.h:83
static void size_t size
Definition: smalloc.h:47
void set_options_mgr(OptionsManager *value)
Definition: libcvmfs_int.h:67
static void CleanupInstance()
FileSystem * file_system()
Definition: libcvmfs_int.h:66
std::string * repository_name_
Definition: loader.cc:127