ms-nfs41-client/daemon/name_cache.h
Casey Bodley 6bc86c1bff name cache: insert supports negative entries
marked nfs41_name_cache_insert() parameters fh and info as OPTIONAL; passing NULL designates a negative lookup entry
name_cache_entry_create() no longer calls attr_cache_find_or_create(), and doesn't need the 'fileid' argument
name_cache_entry_update() also makes fh and info OPTIONAL, and handles the cases where we switch from a negative <-> positive entry, calling attr_cache_find_or_create() or attr_cache_entry_deref() as appropriate
removed unused function name_cache_find_or_create(); everything uses name_cache_entry_find_or_create() instead, so renamed that to name_cache_find_or_create()

Signed-off-by: Casey Bodley <cbodley@umich.edu>
2010-10-12 10:35:43 -04:00

100 lines
3.2 KiB
C

/* Copyright (c) 2010
* The Regents of the University of Michigan
* All Rights Reserved
*
* Permission is granted to use, copy and redistribute this software
* for noncommercial education and research purposes, so long as no
* fee is charged, and so long as the name of the University of Michigan
* is not used in any advertising or publicity pertaining to the use
* or distribution of this software without specific, written prior
* authorization. Permission to modify or otherwise create derivative
* works of this software is not granted.
*
* This software is provided as is, without representation or warranty
* of any kind either express or implied, including without limitation
* the implied warranties of merchantability, fitness for a particular
* purpose, or noninfringement. The Regents of the University of
* Michigan shall not be liable for any damages, including special,
* indirect, incidental, or consequential damages, with respect to any
* claim arising out of or in connection with the use of the software,
* even if it has been or is hereafter advised of the possibility of
* such damages.
*/
#ifndef __NFS41_DAEMON_NAME_CACHE_H__
#define __NFS41_DAEMON_NAME_CACHE_H__
#include "nfs41.h"
static __inline struct nfs41_name_cache* client_name_cache(
IN nfs41_client *client)
{
return client_server(client)->name_cache;
}
static __inline struct nfs41_name_cache* session_name_cache(
IN nfs41_session *session)
{
return client_name_cache(session->client);
}
/* attribute cache */
int nfs41_attr_cache_lookup(
IN struct nfs41_name_cache *cache,
IN uint64_t fileid,
OUT nfs41_file_info *info_out);
int nfs41_attr_cache_update(
IN struct nfs41_name_cache *cache,
IN uint64_t fileid,
IN const nfs41_file_info *info);
/* name cache */
int nfs41_name_cache_create(
OUT struct nfs41_name_cache **cache_out);
int nfs41_name_cache_free(
IN OUT struct nfs41_name_cache **cache_out);
int nfs41_name_cache_lookup(
IN struct nfs41_name_cache *cache,
IN const char *path,
IN const char *path_end,
OUT OPTIONAL const char **remaining_path_out,
OUT OPTIONAL nfs41_fh *parent_out,
OUT OPTIONAL nfs41_fh *target_out,
OUT OPTIONAL nfs41_file_info *info_out,
OUT OPTIONAL bool_t *is_negative);
int nfs41_name_cache_insert(
IN struct nfs41_name_cache *cache,
IN const char *path,
IN const nfs41_component *name,
IN OPTIONAL const nfs41_fh *fh,
IN OPTIONAL const nfs41_file_info *info,
IN OPTIONAL const change_info4 *cinfo);
int nfs41_name_cache_remove(
IN struct nfs41_name_cache *cache,
IN const char *path,
IN const nfs41_component *name,
IN const change_info4 *cinfo);
int nfs41_name_cache_rename(
IN struct nfs41_name_cache *cache,
IN const char *src_path,
IN const nfs41_component *src_name,
IN const change_info4 *src_cinfo,
IN const char *dst_path,
IN const nfs41_component *dst_name,
IN const change_info4 *dst_cinfo);
int nfs41_name_cache_remove_stale(
IN struct nfs41_name_cache *cache,
IN nfs41_session *session,
IN nfs41_abs_path *path);
#endif /* !__NFS41_DAEMON_NAME_CACHE_H__ */