name cache: avoid copying strings for dprintf
use printf("%.*s", len, string) to print non-null-terminated strings
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
a66dc99c48
commit
91f584ba4b
1 changed files with 6 additions and 14 deletions
|
|
@ -546,15 +546,12 @@ static struct name_cache_entry* name_cache_search(
|
||||||
IN struct name_cache_entry *parent,
|
IN struct name_cache_entry *parent,
|
||||||
IN const nfs41_component *component)
|
IN const nfs41_component *component)
|
||||||
{
|
{
|
||||||
char dbg_name[NFS41_MAX_COMPONENT_LEN];
|
|
||||||
struct rb_node *node;
|
struct rb_node *node;
|
||||||
struct name_cache_entry *entry;
|
struct name_cache_entry *entry;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
StringCchCopyNA(dbg_name, NFS41_MAX_COMPONENT_LEN,
|
dprintf(NCLVL2, "--> name_cache_search('%.*s' under '%s')\n",
|
||||||
component->name, component->len);
|
component->len, component->name, parent->component);
|
||||||
dprintf(NCLVL2, "--> name_cache_search('%s' under '%s')\n",
|
|
||||||
dbg_name, parent->component);
|
|
||||||
|
|
||||||
entry = NULL;
|
entry = NULL;
|
||||||
node = parent->rbchildren.rb_node;
|
node = parent->rbchildren.rb_node;
|
||||||
|
|
@ -699,13 +696,10 @@ static int name_cache_find_or_create(
|
||||||
IN const nfs41_component *component,
|
IN const nfs41_component *component,
|
||||||
OUT struct name_cache_entry **target_out)
|
OUT struct name_cache_entry **target_out)
|
||||||
{
|
{
|
||||||
char dbg_name[NFS41_MAX_COMPONENT_LEN];
|
|
||||||
int status = NO_ERROR;
|
int status = NO_ERROR;
|
||||||
|
|
||||||
StringCchCopyNA(dbg_name, NFS41_MAX_COMPONENT_LEN,
|
dprintf(NCLVL1, "--> name_cache_find_or_create('%.*s' under '%s')\n",
|
||||||
component->name, component->len);
|
component->len, component->name, parent->component);
|
||||||
dprintf(NCLVL1, "--> name_cache_find_or_create("
|
|
||||||
"'%s' under '%s')\n", dbg_name, parent->component);
|
|
||||||
|
|
||||||
*target_out = name_cache_search(cache, parent, component);
|
*target_out = name_cache_search(cache, parent, component);
|
||||||
if (*target_out)
|
if (*target_out)
|
||||||
|
|
@ -914,13 +908,11 @@ int nfs41_name_cache_insert(
|
||||||
IN OPTIONAL const nfs41_file_info *info,
|
IN OPTIONAL const nfs41_file_info *info,
|
||||||
IN OPTIONAL const change_info4 *cinfo)
|
IN OPTIONAL const change_info4 *cinfo)
|
||||||
{
|
{
|
||||||
char dbg_path[NFS41_MAX_PATH_LEN];
|
|
||||||
struct name_cache_entry *grandparent, *parent, *target;
|
struct name_cache_entry *grandparent, *parent, *target;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
StringCchCopyNA(dbg_path, NFS41_MAX_PATH_LEN, path,
|
dprintf(NCLVL1, "--> nfs41_name_cache_insert('%.*s')\n",
|
||||||
name->name + name->len - path);
|
name->name + name->len - path, path);
|
||||||
dprintf(NCLVL1, "--> nfs41_name_cache_insert('%s')\n", dbg_path);
|
|
||||||
|
|
||||||
AcquireSRWLockExclusive(&cache->lock);
|
AcquireSRWLockExclusive(&cache->lock);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue