summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2010-01-07 18:08:21 +0000
committerroot <root>2010-01-07 18:08:21 +0000
commitb24913bdea04b6809a76e5976d533289d584741a (patch)
treefd369f991c5ccc510fce1c53c05d84fbcaed6c74
parentf729dd40abcc81fdd8d940a156fec32c9ca8e4d1 (diff)
*** empty log message ***rel-3_5
-rw-r--r--Changes1
-rw-r--r--eio.c16
-rw-r--r--eio.h18
3 files changed, 30 insertions, 5 deletions
diff --git a/Changes b/Changes
index f943689..7cba947 100644
--- a/Changes
+++ b/Changes
@@ -22,4 +22,5 @@ TODO: maybe add mincore support? available on at least darwin, solaris, linux, f
- also use sendfile emulation for ENOTSUP and EOPNOTSUPP
error codes.
- add OS-independent EIO_MT_* and EIO_MS_* flag enums.
+ - add eio_statvfs/eio_fstatvfs.
diff --git a/eio.c b/eio.c
index 609b28c..0f48a71 100644
--- a/eio.c
+++ b/eio.c
@@ -51,6 +51,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <limits.h>
#include <fcntl.h>
#include <assert.h>
@@ -1578,6 +1579,11 @@ static void eio_execute (etp_worker *self, eio_req *req)
case EIO_FSTAT: ALLOC (sizeof (EIO_STRUCT_STAT));
req->result = fstat (req->int1, (EIO_STRUCT_STAT *)req->ptr2); break;
+ case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
+ req->result = statvfs (req->ptr1, (EIO_STRUCT_STATVFS *)req->ptr2); break;
+ case EIO_FSTATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
+ req->result = fstatvfs (req->int1, (EIO_STRUCT_STATVFS *)req->ptr2); break;
+
case EIO_CHOWN: req->result = chown (req->ptr1, req->int2, req->int3); break;
case EIO_FCHOWN: req->result = fchown (req->int1, req->int2, req->int3); break;
case EIO_CHMOD: req->result = chmod (req->ptr1, (mode_t)req->int2); break;
@@ -1734,6 +1740,11 @@ eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data)
REQ (EIO_FSTAT); req->int1 = fd; SEND;
}
+eio_req *eio_fstatvfs (int fd, int pri, eio_cb cb, void *data)
+{
+ REQ (EIO_FSTATVFS); req->int1 = fd; SEND;
+}
+
eio_req *eio_futime (int fd, double atime, double mtime, int pri, eio_cb cb, void *data)
{
REQ (EIO_FUTIME); req->int1 = fd; req->nv1 = atime; req->nv2 = mtime; SEND;
@@ -1815,6 +1826,11 @@ eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data)
return eio__1path (EIO_LSTAT, path, pri, cb, data);
}
+eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data)
+{
+ return eio__1path (EIO_STATVFS, path, pri, cb, data);
+}
+
eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data)
{
return eio__1path (EIO_UNLINK, path, pri, cb, data);
diff --git a/eio.h b/eio.h
index 2008d85..1a5dc3d 100644
--- a/eio.h
+++ b/eio.h
@@ -60,6 +60,10 @@ typedef int (*eio_cb)(eio_req *req);
# define EIO_STRUCT_STAT struct stat
#endif
+#ifndef EIO_STRUCT_STATVFS
+# define EIO_STRUCT_STATVFS struct statvfs
+#endif
+
/* for readdir */
/* eio_readdir flags */
@@ -133,6 +137,7 @@ enum {
EIO_READ, EIO_WRITE,
EIO_READAHEAD, EIO_SENDFILE,
EIO_STAT, EIO_LSTAT, EIO_FSTAT,
+ EIO_STATVFS, EIO_FSTATVFS,
EIO_TRUNCATE, EIO_FTRUNCATE,
EIO_UTIME, EIO_FUTIME,
EIO_CHMOD, EIO_FCHMOD,
@@ -239,6 +244,7 @@ eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb,
eio_req *eio_read (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data);
eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data);
eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
+eio_req *eio_fstatvfs (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
eio_req *eio_futime (int fd, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data);
eio_req *eio_ftruncate (int fd, off_t offset, int pri, eio_cb cb, void *data);
eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data);
@@ -257,6 +263,7 @@ eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data);
eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
+eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data);
eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
@@ -277,13 +284,14 @@ void eio_grp_cancel (eio_req *grp); /* cancels all sub requests but not the g
/* request api */
/* true if the request was cancelled, useful in the invoke callback */
-#define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED)
+#define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED)
-#define EIO_RESULT(req) ((req)->result)
+#define EIO_RESULT(req) ((req)->result)
/* returns a pointer to the result buffer allocated by eio */
-#define EIO_BUF(req) ((req)->ptr2)
-#define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req))
-#define EIO_PATH(req) ((char *)(req)->ptr1)
+#define EIO_BUF(req) ((req)->ptr2)
+#define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req))
+#define EIO_STATVFS_BUF(req) ((EIO_STRUCT_STATVFS *)EIO_BUF(req))
+#define EIO_PATH(req) ((char *)(req)->ptr1)
/* submit a request for execution */
void eio_submit (eio_req *req);