7 #include <gnu/libc-version.h>
11 #include <sys/types.h>
29 #if __GLIBC_MINOR__ < 6
30 #warning No lutimes support, glibc >= 2.6 required
32 #define CVMFS_HAS_LUTIMES 1
35 #define CVMFS_HAS_LUTIMES 1
53 fwrite(warning,
sizeof(
char), strlen(warning), f);
57 "Could not write warning file for posix file system!");
63 std::string result = ctx->
base;
74 std::string cur_path = ctx->
data;
80 const struct cvmfs_attr *stat_info,
bool set_permissions) {
82 if (set_permissions) {
83 res = chmod(path, stat_info->
st_mode);
84 if (res != 0)
return -1;
86 if (res != 0)
return -1;
88 std::string path_str = std::string(path);
92 std::vector<std::string> v = xlist->
ListKeys();
94 if (set_permissions) {
95 for (std::vector<std::string>::iterator it = v.begin();
98 xlist->
Get(*it, &val);
105 #ifdef CVMFS_HAS_LUTIMES
106 const struct timeval times[2] = {
107 {stat_info->
mtime, 0},
108 {stat_info->
mtime, 0}
110 res = lutimes(path, times);
111 if (res != 0)
return -1;
118 struct stat stat_buf;
119 int res = stat(path.c_str(), &stat_buf);
120 if (res != 0)
return false;
121 mtimes->actime = stat_buf.st_mtime;
122 mtimes->modtime = stat_buf.st_mtime;
struct cvmcache_context * ctx
void InitialFsOperations(struct fs_traversal_context *ctx)
int PosixSetMeta(const char *path, const struct cvmfs_attr *stat_info, bool set_permissions)
void FinalizeGarbageCollection(struct fs_traversal_context *ctx)
void FinalizeFsOperations(struct fs_traversal_context *ctx)
void InitializeDataDirectory(struct fs_traversal_context *ctx)
#define WARNING_FILE_NAME
void InitializeGarbageCollection(struct fs_traversal_context *ctx)
bool Get(const std::string &key, std::string *value) const
void InitializeWarningFile(struct fs_traversal_context *ctx)
std::string BuildPath(struct fs_traversal_context *ctx, const char *dir)
bool BackupMtimes(std::string path, struct utimbuf *mtimes)
std::string BuildHiddenPath(struct fs_traversal_context *ctx, const char *ident)
std::vector< std::string > ListKeys() const
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)