Dolda2000 GitWeb
/
doldaconnect.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated ChangeLog.
[doldaconnect.git]
/
daemon
/
reqstat.c
diff --git
a/daemon/reqstat.c
b/daemon/reqstat.c
index
34b7ce3
..
1834952
100644
(file)
--- a/
daemon/reqstat.c
+++ b/
daemon/reqstat.c
@@
-22,7
+22,6
@@
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
-#include <attr/xattr.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@
-31,6
+30,10
@@
#include "module.h"
#include "log.h"
#include "module.h"
#include "log.h"
+#ifdef HAVE_XATTR
+#include <attr/xattr.h>
+#endif
+
struct trdata {
size_t startpos;
};
struct trdata {
size_t startpos;
};
@@
-62,6
+65,7
@@
void filelog(char *format, ...)
fclose(out);
}
fclose(out);
}
+#ifdef HAVE_XATTR
void xainc(wchar_t *file, char *an, off_t inc)
{
char buf[32];
void xainc(wchar_t *file, char *an, off_t inc)
{
char buf[32];
@@
-69,6
+73,8
@@
void xainc(wchar_t *file, char *an, off_t inc)
off_t val;
char *fn;
off_t val;
char *fn;
+ if(file[0] != L'/')
+ return;
if((fn = icswcstombs(file, NULL, NULL)) == NULL) {
flog(LOG_WARNING, "could not convert filename %ls into local charset: %s", file, strerror(errno));
return;
if((fn = icswcstombs(file, NULL, NULL)) == NULL) {
flog(LOG_WARNING, "could not convert filename %ls into local charset: %s", file, strerror(errno));
return;
@@
-88,26
+94,33
@@
void xainc(wchar_t *file, char *an, off_t inc)
if(setxattr(fn, an, buf, al, 0) < 0)
flog(LOG_WARNING, "could not set xattr %s on %s: %s", an, fn, strerror(errno));
}
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);
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);
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);
}
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);
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);
}
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);
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)
}
static int chattr(struct transfer *transfer, wchar_t *attrib, struct trdata *data)