19 #define MAX_INTEGER_DIGITS 20
23 printf(
"(libcvmfs) %s\n", msg);
57 char* res =
reinterpret_cast<char *
>(smalloc(length));
82 const char *identifier)
87 file_ctx->
ctx = context;
88 file_ctx->
path = strdup(identifier);
98 if (handle->
fd == -1) {
109 if (res != 0)
return -1;
128 handle->
off += *read_len;
141 if (handle->
fd > 0) {
158 "Repository name must be specified");
171 size_t len = 3 + strlen(major) + strlen(minor) + strlen(rev);
172 char*
lib_version =
reinterpret_cast<char *
>(smalloc(len));
173 snprintf(lib_version, len,
"%s.%s:%s", major, minor, rev);
182 result->
size =
sizeof(*result);
183 result->
repo = strdup(repo);
191 result->
config = strdup(config);
193 size_t len = 8 + strlen(result->
repo);
194 char *def_config =
reinterpret_cast<char *
>(smalloc(len*
sizeof(
char)));
195 snprintf(def_config, len,
"%s.config", result->
repo);
196 result->
config = strdup(def_config);
200 for (
unsigned i = 0; i < config_files.size(); ++i) {
204 "CVMFS Options failed to parse from : %s", config_files[i].c_str());
221 result->
data = strdup(data);
227 "CVMFS Initialization failed : %s", repo);
237 "CVMFS Attach to %s failed", repo);
int cvmfs_options_parse(cvmfs_option_map *opts, const char *path)
int libcvmfs_get_stat(struct fs_traversal_context *ctx, const char *path, struct cvmfs_attr *stat_result, bool get_hash)
struct cvmcache_context * ctx
void cvmfs_detach_repo(LibContext *ctx)
int(* do_fopen)(void *file_ctx, fs_open_type op_mode)
int cvmfs_listdir_contents(LibContext *ctx, const char *path, char ***buf, size_t *listlen, size_t *buflen)
bool libcvmfs_has_file(struct fs_traversal_context *ctx, const char *ident)
#define MAX_INTEGER_DIGITS
void cvmfs_attr_free(struct cvmfs_attr *attr)
struct cvmfs_nc_attr * cvmfs_nc_attr_init()
cvmfs_errors cvmfs_init_v2(SimpleOptionsParser *opts)
int cvmfs_stat_attr(LibContext *ctx, const char *path, struct cvmfs_attr *attr)
struct fs_traversal * libcvmfs_get_interface()
int cvmfs_stat_nc(LibContext *ctx, const char *path, struct cvmfs_nc_attr *nc_attr)
void libcvmfs_sw_log(const char *msg)
void libcvmfs_finalize(struct fs_traversal_context *ctx)
int libcvmfs_do_fclose(void *file_ctx)
void cvmfs_options_set(cvmfs_option_map *opts, const char *key, const char *value)
void *(* get_handle)(struct fs_traversal_context *ctx, const char *identifier)
void(* do_ffree)(void *file_ctx)
#define LIBCVMFS_VERSION_MAJOR
int libcvmfs_do_fread(void *file_ctx, char *buff, size_t len, size_t *read_len)
int libcvmfs_do_fopen(void *file_ctx, fs_open_type op_mode)
struct fs_traversal_context * libcvmfs_initialize(const char *repo, const char *base, const char *data, const char *config, int num_threads)
void cvmfs_enable_threaded(LibContext *ctx)
void libcvmfs_do_ffree(void *file_ctx)
#define LIBCVMFS_REVISION
void(* finalize)(struct fs_traversal_context *ctx)
vector< string > SplitString(const string &str, char delim)
#define LIBCVMFS_VERSION_MINOR
cvmfs_errors cvmfs_attach_repo_v2(const char *fqrn, SimpleOptionsParser *opts, LibContext **ctx)
struct fs_traversal_context *(* initialize)(const char *repo, const char *base, const char *data, const char *config, int num_threads)
void(* list_dir)(struct fs_traversal_context *ctx, const char *dir, char ***buf, size_t *len)
char * cvmfs_options_get(cvmfs_option_map *opts, const char *key)
static void cvmfs_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
bool(* has_file)(struct fs_traversal_context *ctx, const char *identifier)
void cvmfs_nc_attr_free(struct cvmfs_nc_attr *nc_attr)
cvmfs_option_map * cvmfs_options_init_v2(int taint_environ)
int(* do_fclose)(void *file_ctx)
char * libcvmfs_get_identifier(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat)
int(* get_stat)(struct fs_traversal_context *ctx, const char *path, struct cvmfs_attr *stat, bool get_hash)
int(* do_fwrite)(void *file_ctx, const char *buff, size_t len)
ssize_t cvmfs_pread(LibContext *ctx, int fd, void *buf, size_t size, off_t off)
int libcvmfs_do_fwrite(void *file_ctx, const char *buff, size_t len)
int(* do_fread)(void *file_ctx, char *buff, size_t len, size_t *read_len)
int cvmfs_close(LibContext *ctx, int fd)
void * libcvmfs_get_handle(struct fs_traversal_context *ctx, const char *identifier)
char *(* get_identifier)(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat)
struct cvmfs_attr * cvmfs_attr_init()
void cvmfs_set_log_fn(void(*log_fn)(const char *msg))
void cvmfs_adopt_options(cvmfs_context *ctx, SimpleOptionsParser *opts)
void libcvmfs_list_dir(struct fs_traversal_context *ctx, const char *dir, char ***buf, size_t *len)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)