readdir: generalized lookup_entry() for use with referrals

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-10-12 09:52:11 -04:00
parent 827a1b7368
commit 30decd1af7

View file

@ -369,24 +369,17 @@ out:
return status; return status;
} }
static int single_lookup( static int lookup_entry(
IN nfs41_root *root, IN nfs41_root *root,
IN nfs41_session *session, IN nfs41_session *session,
IN nfs41_path_fh *parent, IN nfs41_path_fh *parent,
IN const char *filter,
IN bitmap4 *attr_request,
OUT nfs41_readdir_entry *entry) OUT nfs41_readdir_entry *entry)
{ {
nfs41_abs_path path; nfs41_abs_path path;
nfs41_path_fh file; nfs41_path_fh file;
int status; int status;
entry->cookie = 0; /* format an absolute path 'parent\name' */
entry->name_len = (uint32_t)strlen(filter) + 1;
StringCbCopyA(entry->name, entry->name_len, filter);
entry->next_entry_offset = 0;
/* format an absolute path 'parent\filter' */
InitializeSRWLock(&path.lock); InitializeSRWLock(&path.lock);
abs_path_copy(&path, parent->path); abs_path_copy(&path, parent->path);
if (path.len + entry->name_len >= NFS41_MAX_PATH_LEN) { if (path.len + entry->name_len >= NFS41_MAX_PATH_LEN) {
@ -400,7 +393,7 @@ static int single_lookup(
path_fh_init(&file, &path); path_fh_init(&file, &path);
status = nfs41_lookup(root, session, &path, status = nfs41_lookup(root, session, &path,
NULL, &file, &entry->attr_info, NULL); NULL, NULL, &entry->attr_info, NULL);
if (status) { if (status) {
dprintf(1, "nfs41_lookup failed with %s\n", nfs_error_string(status)); dprintf(1, "nfs41_lookup failed with %s\n", nfs_error_string(status));
status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP); status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
@ -508,8 +501,8 @@ fetch_entries:
StringCbCopyA(entry->name, entry->name_len, args->filter); StringCbCopyA(entry->name, entry->name_len, args->filter);
entry->next_entry_offset = 0; entry->next_entry_offset = 0;
status = single_lookup(args->root, state->session, status = lookup_entry(args->root,
&state->file, args->filter, &attr_request, entry); state->session, &state->file, entry);
if (status) { if (status) {
dprintf(1, "single_lookup failed with %d\n", status); dprintf(1, "single_lookup failed with %d\n", status);
goto out_free_cookie; goto out_free_cookie;