00001 #pragma once
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00029 #define GFAL_MAX_LFCHOST_LEN 1024
00030
00031 #include <lfc/lfc_api.h>
00032 #include <lfc/serrno.h>
00033 #include <Cthread_api.h>
00034 #include <Cthread_typedef.h>
00035 #include <regex.h>
00036
00037 #include <common/gfal_prototypes.h>
00038 #include <common/gfal_types.h>
00039 #include <common/gfal_constants.h>
00040 #include <externals/gsimplecache/gcachemain.h>
00041
00042
00043 #define LFC_ENV_VAR_HOST "LFC_HOST"
00044
00045 typedef struct _lfc_checksum{
00046 char type[255];
00047 char value[GFAL_URL_MAX_LEN];
00048 } lfc_checksum;
00049
00050
00051 struct lfc_ops {
00052 char* lfc_endpoint;
00053 regex_t rex;
00054 gfal_handle handle;
00055 GSimpleCache* cache_stat;
00056 #if defined(_REENTRANT) || defined(_THREAD_SAFE) || (defined(_WIN32) && (defined(_MT) || defined(_DLL)))
00057 int* (*get_serrno)(void);
00058 #else
00059 int value_serrno;
00060 #endif
00061 char *(*sstrerror)(int);
00062 int (*addreplica)(const char *, struct lfc_fileid *, const char *, const char *, const char, const char, const char *, const char *);
00063 int (*creatg)(const char *, const char *, mode_t);
00064 int (*delreplica)(const char *, struct lfc_fileid *, const char *);
00065 int (*aborttrans)();
00066 int (*endtrans)();
00067 int (*getpath)(char *, u_signed64, char *);
00068 int (*getlinks)(const char *, const char *, int *, struct lfc_linkinfo **);
00069 int (*getreplica)(const char *, const char *, const char *, int *, struct lfc_filereplica **);
00070 int (*setcomment) (const char * path, char * comment );
00071 int (*getcomment) (const char * path, char * comment);
00072 int (*lstat)(const char *, struct lfc_filestat *);
00073 int (*readlink)(const char *, char *, size_t);
00074 int (*mkdirg)(const char *, const char *, mode_t);
00075 int (*seterrbuf)(char *, int);
00076 int (*setfsizeg)(const char *, u_signed64, const char *, char *);
00077 int (*setfsize)(const char *, struct lfc_fileid *, u_signed64);
00078 int (*starttrans)(char *, char *);
00079 int (*statg)(const char *, const char *, struct lfc_filestatg *);
00080 int (*statr)(const char *, struct lfc_filestatg *);
00081 int (*symlink)(const char *, const char *);
00082 int (*unlink)(const char *);
00083 int (*access)(const char *, int);
00084 int (*chmod)(const char *, mode_t);
00085 int (*closedir)(lfc_DIR*);
00086 int (*rename)(const char *, const char *);
00087 lfc_DIR *(*opendirg)(const char *, const char *);
00088 struct dirent* (*readdir)(lfc_DIR *);
00089 struct lfc_direnstat* (*readdirx)(lfc_DIR *dirp);
00090 int (*rmdir)(const char *);
00091 int (*startsess) (char *, char *);
00092 int (*endsess) ();
00093 int (*Cthread_init)();
00094 int (*_Cthread_addcid)(char *, int, char *, int, Cth_pid_t *, unsigned, void *(*)(void *), int);
00095 };
00096
00097 char* gfal_setup_lfchost(gfal_handle handle, GError ** err);
00098
00099 struct lfc_ops* gfal_load_lfc(const char* name, GError** err);
00100
00101
00102 int gfal_lfc_get_errno(struct lfc_ops* ops);
00103
00104 int gfal_lfc_regex_compile(regex_t* rex, GError** err);
00105
00106 char* gfal_lfc_get_strerror(struct lfc_ops* ops);
00107
00108 char* gfal_convert_guid_to_lfn(plugin_handle handle, char* guid, GError ** err);
00109
00110 int gfal_convert_guid_to_lfn_r(plugin_handle handle, const char* guid, char* buff_lfn, size_t sbuff_lfn, GError ** err);
00111
00112 int gfal_lfc_statg(struct lfc_ops* ops, const char*, struct lfc_filestatg* resu, GError** err);
00113
00114 int gfal_lfc_getComment(struct lfc_ops *ops, const char* lfn, char* buff, size_t s_buff, GError** err);
00115
00116 int gfal_lfc_setComment(struct lfc_ops * ops, const char* lfn, const char* buff, size_t s_buff, GError** err);
00117
00118 int gfal_lfc_getChecksum(struct lfc_ops* ops, const char* lfn, lfc_checksum* checksum, GError** err);
00119
00120 int gfal_lfc_convert_statg(struct stat* output, struct lfc_filestatg* input, GError** err);
00121
00122 int gfal_lfc_ifce_mkdirpG(struct lfc_ops* ops,const char* path, mode_t mode, gboolean pflag, GError** err);
00123
00124 char ** gfal_lfc_getSURL(struct lfc_ops* ops, const char* path, GError** err);
00125
00126 void gfal_lfc_init_thread(struct lfc_ops* ops);
00127
00128 int gfal_lfc_startSession(struct lfc_ops* ops, GError ** err);
00129
00130 void gfal_auto_maintain_session(struct lfc_ops* ops, GError ** err);
00131
00132 ssize_t g_strv_catbuff(char** strv, char* buff, size_t size);
00133
00134 int gfal_lfc_convert_lstat(struct stat* output, struct lfc_filestat* input, GError** err);
00135
00136 void gfal_generate_guidG(char* buf, GError** err);
00137
00138
00139 int gfal_lfc_set_host(const char* host, GError** err);
00140