summaryrefslogtreecommitdiff
path: root/pkg/sshfs/patch/0001-Add-nocache.c-stub.patch
blob: 3f6669d625836dd3fb2b0038c2a746d1a470db7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
From d58fbf8ca4a9a72ad8d72c7a6a4d765b419122f6 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sun, 5 Jun 2016 17:13:58 -0700
Subject: [PATCH] Add nocache.c stub

---
 nocache.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 nocache.c

diff --git a/nocache.c b/nocache.c
new file mode 100644
index 0000000..58d7528
--- /dev/null
+++ b/nocache.c
@@ -0,0 +1,94 @@
+#include "cache.h"
+
+struct cache {
+	struct fuse_cache_operations *next_oper;
+};
+
+static struct cache cache;
+
+struct fuse_cache_dirhandle {
+	fuse_dirh_t h;
+	fuse_dirfil_t filler;
+};
+
+void cache_invalidate(const char *path)
+{
+}
+
+void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
+{
+}
+
+uint64_t cache_get_write_ctr(void)
+{
+	return 0;
+}
+
+static int cache_unity_dirfill(fuse_cache_dirh_t ch, const char *name,
+                               const struct stat *stbuf)
+{
+	(void) stbuf;
+	return ch->filler(ch->h, name, 0, 0);
+}
+
+static int cache_unity_getdir(const char *path, fuse_dirh_t h,
+                              fuse_dirfil_t filler)
+{
+	struct fuse_cache_dirhandle ch;
+	ch.h = h;
+	ch.filler = filler;
+	return cache.next_oper->cache_getdir(path, &ch, cache_unity_dirfill);
+}
+
+static void cache_unity_fill(struct fuse_cache_operations *oper,
+                             struct fuse_operations *cache_oper)
+{
+#if FUSE_VERSION >= 23
+	cache_oper->init        = oper->oper.init;
+#endif
+	cache_oper->getattr     = oper->oper.getattr;
+	cache_oper->access	= oper->oper.access;
+	cache_oper->readlink    = oper->oper.readlink;
+	cache_oper->getdir      = cache_unity_getdir;
+	cache_oper->mknod       = oper->oper.mknod;
+	cache_oper->mkdir       = oper->oper.mkdir;
+	cache_oper->symlink     = oper->oper.symlink;
+	cache_oper->unlink      = oper->oper.unlink;
+	cache_oper->rmdir       = oper->oper.rmdir;
+	cache_oper->rename      = oper->oper.rename;
+	cache_oper->link        = oper->oper.link;
+	cache_oper->chmod       = oper->oper.chmod;
+	cache_oper->chown       = oper->oper.chown;
+	cache_oper->truncate    = oper->oper.truncate;
+	cache_oper->utime       = oper->oper.utime;
+	cache_oper->open        = oper->oper.open;
+	cache_oper->read        = oper->oper.read;
+	cache_oper->write       = oper->oper.write;
+	cache_oper->flush       = oper->oper.flush;
+	cache_oper->release     = oper->oper.release;
+	cache_oper->fsync       = oper->oper.fsync;
+	cache_oper->statfs      = oper->oper.statfs;
+	cache_oper->setxattr    = oper->oper.setxattr;
+	cache_oper->getxattr    = oper->oper.getxattr;
+	cache_oper->listxattr   = oper->oper.listxattr;
+	cache_oper->removexattr = oper->oper.removexattr;
+#if FUSE_VERSION >= 25
+	cache_oper->create      = oper->oper.create;
+	cache_oper->ftruncate   = oper->oper.ftruncate;
+	cache_oper->fgetattr    = oper->oper.fgetattr;
+#endif
+}
+
+struct fuse_operations *cache_init(struct fuse_cache_operations *oper)
+{
+	static struct fuse_operations cache_oper;
+	cache.next_oper = oper;
+
+	cache_unity_fill(oper, &cache_oper);
+	return &cache_oper;
+}
+
+int cache_parse_options(struct fuse_args *args)
+{
+	return 0;
+}
-- 
2.9.0