xref: /reactos/base/services/nfsd/name_cache.h (revision c2c66aff)
1 /* NFSv4.1 client for Windows
2  * Copyright � 2012 The Regents of the University of Michigan
3  *
4  * Olga Kornievskaia <aglo@umich.edu>
5  * Casey Bodley <cbodley@umich.edu>
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * without any warranty; without even the implied warranty of merchantability
14  * or fitness for a particular purpose.  See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  */
21 
22 #ifndef __NFS41_DAEMON_NAME_CACHE_H__
23 #define __NFS41_DAEMON_NAME_CACHE_H__
24 
25 #include "nfs41.h"
26 
27 
client_name_cache(IN nfs41_client * client)28 static __inline struct nfs41_name_cache* client_name_cache(
29     IN nfs41_client *client)
30 {
31     return client_server(client)->name_cache;
32 }
33 
session_name_cache(IN nfs41_session * session)34 static __inline struct nfs41_name_cache* session_name_cache(
35     IN nfs41_session *session)
36 {
37     return client_name_cache(session->client);
38 }
39 
40 
41 /* attribute cache */
42 int nfs41_attr_cache_lookup(
43     IN struct nfs41_name_cache *cache,
44     IN uint64_t fileid,
45     OUT nfs41_file_info *info_out);
46 
47 int nfs41_attr_cache_update(
48     IN struct nfs41_name_cache *cache,
49     IN uint64_t fileid,
50     IN const nfs41_file_info *info);
51 
52 
53 /* name cache */
54 int nfs41_name_cache_create(
55     OUT struct nfs41_name_cache **cache_out);
56 
57 int nfs41_name_cache_free(
58     IN OUT struct nfs41_name_cache **cache_out);
59 
60 int nfs41_name_cache_lookup(
61     IN struct nfs41_name_cache *cache,
62     IN const char *path,
63     IN const char *path_end,
64     OUT OPTIONAL const char **remaining_path_out,
65     OUT OPTIONAL nfs41_fh *parent_out,
66     OUT OPTIONAL nfs41_fh *target_out,
67     OUT OPTIONAL nfs41_file_info *info_out,
68     OUT OPTIONAL bool_t *is_negative);
69 
70 int nfs41_name_cache_insert(
71     IN struct nfs41_name_cache *cache,
72     IN const char *path,
73     IN const nfs41_component *name,
74     IN OPTIONAL const nfs41_fh *fh,
75     IN OPTIONAL const nfs41_file_info *info,
76     IN OPTIONAL const change_info4 *cinfo,
77     IN enum open_delegation_type4 delegation);
78 
79 int nfs41_name_cache_delegreturn(
80     IN struct nfs41_name_cache *cache,
81     IN uint64_t fileid,
82     IN const char *path,
83     IN const nfs41_component *name);
84 
85 int nfs41_name_cache_remove(
86     IN struct nfs41_name_cache *cache,
87     IN const char *path,
88     IN const nfs41_component *name,
89     IN uint64_t fileid,
90     IN const change_info4 *cinfo);
91 
92 int nfs41_name_cache_rename(
93     IN struct nfs41_name_cache *cache,
94     IN const char *src_path,
95     IN const nfs41_component *src_name,
96     IN const change_info4 *src_cinfo,
97     IN const char *dst_path,
98     IN const nfs41_component *dst_name,
99     IN const change_info4 *dst_cinfo);
100 
101 int nfs41_name_cache_remove_stale(
102     IN struct nfs41_name_cache *cache,
103     IN nfs41_session *session,
104     IN nfs41_abs_path *path);
105 
106 #endif /* !__NFS41_DAEMON_NAME_CACHE_H__ */
107