summaryrefslogtreecommitdiff
path: root/pgsql.h
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-04-10 11:17:13 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-04-10 11:17:13 +0200
commite269892480767b089cb999e87cc05becfdef26d2 (patch)
tree54e753888077ac1f179b9cc65f2ab8167ff33c6c /pgsql.h
parent0037bc92adbe3e00250e8a3e8e080f88e9adbeca (diff)
downloadpgfuse-e269892480767b089cb999e87cc05becfdef26d2.tar.gz
pgfuse-e269892480767b089cb999e87cc05becfdef26d2.tar.bz2
some rearangements
Diffstat (limited to 'pgsql.h')
-rw-r--r--pgsql.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/pgsql.h b/pgsql.h
new file mode 100644
index 0000000..cdf90bb
--- /dev/null
+++ b/pgsql.h
@@ -0,0 +1,42 @@
+/*
+ Copyright (C) 2012 Andreas Baumann <abaumann@yahoo.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <sys/types.h> /* size_t */
+#include <sys/stat.h> /* mode_t */
+
+#include <fuse.h> /* for user-land filesystem */
+
+#include <libpq-fe.h> /* for Postgresql database access */
+
+typedef struct PgMeta {
+ size_t size; /* the size of the file */
+ int isdir; /* whether we have a directory or a file */
+} PgMeta;
+
+int psql_get_meta( PGconn *conn, const char *path, PgMeta *meta );
+
+int psql_create_file( PGconn *conn, const int parent_id, const char *path, const char *new_file, mode_t mode );
+
+int psql_read_buf( PGconn *conn, const int id, const char *path, char **buf, const size_t len );
+
+int psql_readdir( PGconn *conn, const int parent_id, void *buf, fuse_fill_dir_t filler );
+
+int psql_create_dir( PGconn *conn, const int parent_id, const char *path, const char *new_dir, mode_t mode );
+
+int psql_write_buf( PGconn *conn, const int id, const char *path, const char *buf, const size_t len );
+
+int psql_write_meta( PGconn *conn, const int id, const char *path, PgMeta meta );