summaryrefslogtreecommitdiffstats
path: root/server/file.h
diff options
context:
space:
mode:
authorLars Müller2008-03-01 19:30:38 +0100
committerLars Müller2008-03-01 19:30:38 +0100
commit93b9103f7383d400616d222606c294e07b16e1aa (patch)
tree611a39f7bc1d1dd5a4335157ef95c101d64dddc8 /server/file.h
downloaddnbd2-93b9103f7383d400616d222606c294e07b16e1aa.tar.gz
dnbd2-93b9103f7383d400616d222606c294e07b16e1aa.tar.xz
dnbd2-93b9103f7383d400616d222606c294e07b16e1aa.zip
Import dnbd* from the former openslx-contrib repo as of revision 92.
openslx-contrib is currently read only and will get removed in some days. git-svn-id: http://svn.openslx.org/svn/openslx/contrib/dnbd2/trunk@1592 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'server/file.h')
-rw-r--r--server/file.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/file.h b/server/file.h
new file mode 100644
index 0000000..720cf9b
--- /dev/null
+++ b/server/file.h
@@ -0,0 +1,28 @@
+/*
+ * server/file.h - Functions to work with files.
+ */
+
+
+/*
+ * Open a file and test it with stat.
+ *
+ * Returns: File descriptor on success or -1 on failure.
+ */
+int file_open(char *filename);
+
+
+/*
+ * Store in @size the size in bytes of the file pointed to by @fd.
+ *
+ * Returns: 0 on success -1 on failure;
+ *
+ */
+int file_getsize(int fd, off_t *size);
+
+
+/*
+ * Copy @size bytes of @fd, starting at @pos, into @buf.
+ *
+ * Returns: 0 on success -1 on failure.
+ */
+int file_read(int fd, void *buf, size_t size, off_t pos);