37 return fscache_register_netfs(&cifs_fscache_netfs);
45 fscache_unregister_netfs(&cifs_fscache_netfs);
63 static uint16_t cifs_server_get_key(
const void *cookie_netfs_data,
107 .name =
"CIFS.server",
109 .get_key = cifs_server_get_key,
119 static char *extract_sharename(
const char *treename)
129 delim =
strchr(src,
'\\');
146 static uint16_t cifs_super_get_key(
const void *cookie_netfs_data,
void *buffer,
149 const struct cifs_tcon *tcon = cookie_netfs_data;
153 sharename = extract_sharename(tcon->
treeName);
154 if (IS_ERR(sharename)) {
155 cFYI(1,
"%s: couldn't extract sharename", __func__);
164 memcpy(buffer, sharename, len);
172 cifs_fscache_super_get_aux(
const void *cookie_netfs_data,
void *buffer,
176 const struct cifs_tcon *tcon = cookie_netfs_data;
178 memset(&auxdata, 0,
sizeof(auxdata));
179 auxdata.resource_id = tcon->resource_id;
181 if (maxbuf >
sizeof(auxdata))
182 maxbuf =
sizeof(auxdata);
184 memcpy(buffer, &auxdata, maxbuf);
195 const struct cifs_tcon *tcon = cookie_netfs_data;
197 if (datalen !=
sizeof(auxdata))
200 memset(&auxdata, 0,
sizeof(auxdata));
201 auxdata.resource_id = tcon->resource_id;
203 if (
memcmp(data, &auxdata, datalen) != 0)
213 .name =
"CIFS.super",
215 .get_key = cifs_super_get_key,
216 .get_aux = cifs_fscache_super_get_aux,
217 .check_aux = cifs_fscache_super_check_aux,
229 static uint16_t cifs_fscache_inode_get_key(
const void *cookie_netfs_data,
246 cifs_fscache_inode_get_attr(
const void *cookie_netfs_data,
uint64_t *
size)
254 cifs_fscache_inode_get_aux(
const void *cookie_netfs_data,
void *buffer,
260 memset(&auxdata, 0,
sizeof(auxdata));
262 auxdata.last_write_time = cifsi->
vfs_inode.i_mtime;
263 auxdata.last_change_time = cifsi->
vfs_inode.i_ctime;
265 if (maxbuf >
sizeof(auxdata))
266 maxbuf =
sizeof(auxdata);
268 memcpy(buffer, &auxdata, maxbuf);
281 if (datalen !=
sizeof(auxdata))
284 memset(&auxdata, 0,
sizeof(auxdata));
286 auxdata.last_write_time = cifsi->
vfs_inode.i_mtime;
287 auxdata.last_change_time = cifsi->
vfs_inode.i_ctime;
289 if (
memcmp(data, &auxdata, datalen) != 0)
295 static void cifs_fscache_inode_now_uncached(
void *cookie_netfs_data)
302 pagevec_init(&pvec, 0);
305 cFYI(1,
"%s: cifs inode 0x%p now uncached", __func__, cifsi);
314 for (loop = 0; loop < nr_pages; loop++)
317 first = pvec.pages[nr_pages - 1]->index + 1;
320 pagevec_release(&pvec);
326 .name =
"CIFS.uniqueid",
328 .get_key = cifs_fscache_inode_get_key,
329 .get_attr = cifs_fscache_inode_get_attr,
330 .get_aux = cifs_fscache_inode_get_aux,
331 .check_aux = cifs_fscache_inode_check_aux,
332 .now_uncached = cifs_fscache_inode_now_uncached,