19 unsigned min_buffer_size =
sizeof(mode_t)/
sizeof(
unsigned char)
21 +
sizeof(uid_t)/
sizeof(
unsigned char)
23 +
sizeof(gid_t)/
sizeof(
unsigned char)
26 unsigned xlist_buffer_size = 0;
27 unsigned char *xlist_buffer;
28 std::vector<std::string> serialize_blacklist;
29 serialize_blacklist.push_back(
"security.selinux");
31 xlist->
Serialize(&xlist_buffer, &xlist_buffer_size, &serialize_blacklist);
33 unsigned char buffer[min_buffer_size+xlist_buffer_size];
34 for (
unsigned i = 0; i < (min_buffer_size+xlist_buffer_size); i++) {
39 mode_t hash_mode = stat_info->
st_mode & 0777;
40 memcpy(buffer+offset, &hash_mode,
sizeof(mode_t));
41 offset+=
sizeof(mode_t)/
sizeof(
unsigned char);
45 memcpy(buffer+offset, &(stat_info->
st_uid),
sizeof(uid_t));
46 offset+=
sizeof(uid_t)/
sizeof(
unsigned char);
50 memcpy(buffer+offset, &(stat_info->
st_gid),
sizeof(gid_t));
51 offset+=
sizeof(gid_t)/
sizeof(
unsigned char);
56 memcpy(buffer+offset, xlist_buffer, xlist_buffer_size);
60 shash::HashMem(buffer, min_buffer_size+xlist_buffer_size, &meta_hash);
68 if (*listlen + 1 >= *buflen) {
69 size_t newbuflen = (*listlen)*2 + 5;
70 *buf =
reinterpret_cast<char **
>(
71 realloc(*buf,
sizeof(
char *) * newbuflen));
74 assert(*listlen < *buflen);
77 (*buf)[(*listlen)] = strdup(str);
79 (*buf)[++(*listlen)] = NULL;
81 (*buf)[(*listlen)] = NULL;
assert((mem||(size==0))&&"Out Of Memory")
void Serialize(unsigned char **outbuf, unsigned *size, const std::vector< std::string > *blacklist=NULL) const
shash::Any HashMeta(const struct cvmfs_attr *stat_info)
void HashMem(const unsigned char *buffer, const unsigned buffer_size, Any *any_digest)
void AppendStringToList(char const *str, char ***buf, size_t *listlen, size_t *buflen)