/*
- $Id: ea.h,v 1.6 2009-11-13 13:03:29 didg Exp $
+ $Id: ea.h,v 1.7 2009-11-17 11:41:37 franklahm Exp $
Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
This program is free software; you can redistribute it and/or modify
kXAttrReplace = 0x4
};
+#if !defined(HAVE_SETXATTR)
+#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
+#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
+#endif
+
+
+/****************************************************************************************
+ * Stuff for our implementation of storing EAs in files in .AppleDouble dirs
+ ****************************************************************************************/
+
#define EA_INITED 0xea494e54 /* ea"INT", for interfacing ea_open w. ea_close */
#define EA_MAGIC 0x61644541 /* "adEA" */
#define EA_VERSION1 0x01
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Samba 3.0.28, modified for netatalk.
- $Id: ad_ea.c,v 1.5 2009-11-13 13:31:13 didg Exp $
+ $Id: ad_ea.c,v 1.6 2009-11-17 11:41:37 franklahm Exp $
*/
#endif
#include <string.h>
-
#include <sys/types.h>
+#include <errno.h>
#if HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#include <sys/ea.h>
#endif
+#ifdef HAVE_ATTROPEN
+
+#include <dirent.h>
+#endif
+
#ifdef HAVE_SYS_EXTATTR_H
#include <sys/extattr.h>
#endif
#include <atalk/adouble.h>
#include <atalk/util.h>
#include <atalk/logger.h>
+#include <atalk/ea.h>
/******** Solaris EA helper function prototypes ********/
#ifdef HAVE_ATTROPEN
#endif
}
-#if !defined(HAVE_SETXATTR)
-#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
-#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
-#endif
-
int sys_setxattr (const char *path, const char *uname, const void *value, size_t size, int flags)
{
const char *name = prefix(uname);
struct stat sbuf;
if (fstat(attrfd, &sbuf) == -1) {
- errno = ENOATTR;
return -1;
}
/* check size and read xattr */
if (sbuf.st_size > size) {
- errno = ERANGE;
return -1;
}
while ((de = readdir(dirp))) {
size_t listlen;
if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") ||
- !strcmp(dp->d_name, "SUNWattr_ro") || !strcmp(dp->d_name, "SUNWattr_rw"))
+ !strcmp(de->d_name, "SUNWattr_ro") || !strcmp(de->d_name, "SUNWattr_rw"))
{
/* we don't want "." and ".." here: */
LOG(log_maxdebug, logtype_default, "skipped EA %s\n",de->d_name);
static int solaris_unlinkat(int attrdirfd, const char *name)
{
if (unlinkat(attrdirfd, name, 0) == -1) {
- if (errno == ENOENT) {
- errno = ENOATTR;
- }
return -1;
}
return 0;
int filedes = attropen(path, attrpath, oflag, mode);
if (filedes == -1) {
LOG(log_maxdebug, logtype_default, "attropen FAILED: path: %s, name: %s, errno: %s\n",path,attrpath,strerror(errno));
- if (errno == EINVAL) {
- errno = ENOTSUP;
- } else {
- errno = ENOATTR;
- }
}
return filedes;
}
int filedes = openat(fildes, path, oflag, mode);
if (filedes == -1) {
LOG(log_maxdebug, logtype_default, "openat FAILED: fd: %s, path: %s, errno: %s\n",filedes,path,strerror(errno));
- if (errno == EINVAL) {
- errno = ENOTSUP;
- } else {
- errno = ENOATTR;
- }
}
return filedes;
}