AC_DEFINE(HAVE_NOTIFY)
fi
+# libattr check
+AH_TEMPLATE(HAVE_XATTR, [define to compile support for extended attributes])
+AC_ARG_WITH(xattr, [ --with-xattr Enable XATTR support])
+DOLDA_PKG([HAS_XATTR], [test "$with_xattr" = no && HAS_XATTR=no],
+ [AC_CHECK_LIB(attr, getxattr, [:], [HAS_XATTR=no])],
+ [DOLDA_CHECK_HEADER(attr/xattr.h, [], [HAS_XATTR=no])],
+ [XATTR_LIBS=-lattr])
+if test "$with_xattr" = yes -a "$HAS_XATTR" = no; then
+ AC_MSG_ERROR([*** cannot find xattr support on this system])
+fi
+if test "$HAS_XATTR" = yes; then
+ AC_DEFINE(HAVE_XATTR)
+fi
+AC_SUBST(XATTR_LIBS)
+
# libpanelapplet check
DOLDA_PKG([HAS_LIBPANELAPPLET], [PKG_CHECK_MODULES(PANELAPPLET, libpanelapplet-2.0, [], [HAS_LIBPANELAPPLET=no])])
#include <unistd.h>
#include <errno.h>
#include <time.h>
-#include <attr/xattr.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "module.h"
#include "log.h"
+#ifdef HAVE_XATTR
+#include <attr/xattr.h>
+#endif
+
struct trdata {
size_t startpos;
};
fclose(out);
}
+#ifdef HAVE_XATTR
void xainc(wchar_t *file, char *an, off_t inc)
{
char buf[32];
if(setxattr(fn, an, buf, al, 0) < 0)
flog(LOG_WARNING, "could not set xattr %s on %s: %s", an, fn, strerror(errno));
}
+#endif
void request(struct transfer *transfer, struct trdata *data)
{
filelog("request %ls", transfer->path);
+#ifdef HAVE_XATTR
if(confgetint("reqstat", "xa"))
xainc(transfer->path, "user.dc-req", 1);
+#endif
}
void start(struct transfer *transfer, struct trdata *data)
{
filelog("start %ls at %zi", transfer->path, data->startpos);
+#ifdef HAVE_XATTR
if(confgetint("reqstat", "xa"))
xainc(transfer->path, "user.dc-started", 1);
+#endif
}
void finish(struct transfer *transfer, struct trdata *data)
{
filelog("finish %ls at %zi, total %zi", transfer->path, transfer->curpos, transfer->curpos - data->startpos);
+#ifdef HAVE_XATTR
if(confgetint("reqstat", "xa"))
xainc(transfer->path, "user.dc-bytes", transfer->curpos - data->startpos);
+#endif
}
static int chattr(struct transfer *transfer, wchar_t *attrib, struct trdata *data)