1
2
3
4
5
6
7
8
9
10
11
12#define FSCACHE_DEBUG_LEVEL CACHE
13#include <linux/module.h>
14#include "internal.h"
15
16static
17enum fscache_checkaux fscache_fsdef_netfs_check_aux(void *cookie_netfs_data,
18 const void *data,
19 uint16_t datalen,
20 loff_t object_size);
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
46static struct fscache_cookie_def fscache_fsdef_index_def = {
47 .name = ".FS-Cache",
48 .type = FSCACHE_COOKIE_TYPE_INDEX,
49};
50
51struct fscache_cookie fscache_fsdef_index = {
52 .usage = ATOMIC_INIT(1),
53 .n_active = ATOMIC_INIT(1),
54 .lock = __SPIN_LOCK_UNLOCKED(fscache_fsdef_index.lock),
55 .backing_objects = HLIST_HEAD_INIT,
56 .def = &fscache_fsdef_index_def,
57 .flags = 1 << FSCACHE_COOKIE_ENABLED,
58 .type = FSCACHE_COOKIE_TYPE_INDEX,
59};
60EXPORT_SYMBOL(fscache_fsdef_index);
61
62
63
64
65
66
67struct fscache_cookie_def fscache_fsdef_netfs_def = {
68 .name = "FSDEF.netfs",
69 .type = FSCACHE_COOKIE_TYPE_INDEX,
70 .check_aux = fscache_fsdef_netfs_check_aux,
71};
72
73
74
75
76
77static enum fscache_checkaux fscache_fsdef_netfs_check_aux(
78 void *cookie_netfs_data,
79 const void *data,
80 uint16_t datalen,
81 loff_t object_size)
82{
83 struct fscache_netfs *netfs = cookie_netfs_data;
84 uint32_t version;
85
86 _enter("{%s},,%hu", netfs->name, datalen);
87
88 if (datalen != sizeof(version)) {
89 _leave(" = OBSOLETE [dl=%d v=%zu]", datalen, sizeof(version));
90 return FSCACHE_CHECKAUX_OBSOLETE;
91 }
92
93 memcpy(&version, data, sizeof(version));
94 if (version != netfs->version) {
95 _leave(" = OBSOLETE [ver=%x net=%x]", version, netfs->version);
96 return FSCACHE_CHECKAUX_OBSOLETE;
97 }
98
99 _leave(" = OKAY");
100 return FSCACHE_CHECKAUX_OKAY;
101}
102