n->global_refcount = 0;
n->length = file_stat.st_size;
n->mtime = file_stat.st_mtime;
+#ifdef _STAT_VER_LINUX
+# if (defined __USE_MISC && defined st_mtime)
+ n->mtime_nsec = (unsigned long int)file_stat.st_mtim.tv_nsec;
+# else
+ n->mtime_nsec = (unsigned long int)file_stat.st_mtimensec;
+# endif
+#endif
n->inode = file_stat.st_ino;
n->refcount = 0;
n->fd = fd;
EAPI Eina_Iterator *
eina_xattr_ls(const char *file)
{
+#ifdef HAVE_XATTR
Eina_Xattr_Iterator *it;
ssize_t length;
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
-#ifdef HAVE_XATTR
length = listxattr(file, NULL, 0);
if (length <= 0) return NULL;
return &it->iterator;
#else
return NULL;
+ (void)file;
#endif
}
EAPI void *
eina_xattr_get(const char *file, const char *attribute, ssize_t *size)
{
+#ifdef HAVE_XATTR
void *ret = NULL;
ssize_t tmp;
EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL);
EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, NULL);
-#ifdef HAVE_XATTR
*size = getxattr(file, attribute, NULL, 0);
/* Size should be less than 2MB (already huge in my opinion) */
if (!(*size > 0 && *size < 2 * 1024 * 1024))
on_error:
free(ret);
-#endif
*size = 0;
return NULL;
+#else
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, NULL);
+ *size = 0;
+ return NULL;
+ (void)file;
+ (void)attribute;
+#endif
}
EAPI Eina_Bool
eina_xattr_set(const char *file, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags)
{
+#ifdef HAVE_XATTR
int iflags;
EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE);
EINA_SAFETY_ON_TRUE_RETURN_VAL(!(length > 0 && length < 2 * 1024 * 1024), EINA_FALSE);
-#ifdef HAVE_XATTR
switch (flags)
{
case EINA_XATTR_INSERT: iflags = 0; break;
return EINA_TRUE;
#else
return EINA_FALSE;
+ (void)file;
+ (void)attribute;
+ (void)data;
+ (void)length;
+ (void)flags;
#endif
}