simplifying logic in handle_readdir

This commit is contained in:
Olga Kornievskaia 2011-08-25 12:17:17 -04:00 committed by unknown
parent 32422a9d7f
commit 0e287a87be

View file

@ -463,27 +463,20 @@ static int handle_readdir(nfs41_upcall *upcall)
args->buf = NULL; args->buf = NULL;
args->query_reply_len = 0; args->query_reply_len = 0;
if (state->cookie.cookie) { /* cookie exists */ if (args->initial || args->restart) {
if (args->restart) { ZeroMemory(&state->cookie, sizeof(nfs41_readdir_cookie));
if (!state->cookie.cookie)
dprintf(1, "initializing the 1st readdir cookie\n");
else if (args->restart)
dprintf(1, "restarting; clearing previous cookie %llu\n", dprintf(1, "restarting; clearing previous cookie %llu\n",
state->cookie.cookie); state->cookie.cookie);
ZeroMemory(&state->cookie, sizeof(nfs41_readdir_cookie)); else if (args->initial)
} else if (args->initial) { /* shouldn't happen */
dprintf(1, "*** initial; clearing previous cookie %llu!\n", dprintf(1, "*** initial; clearing previous cookie %llu!\n",
state->cookie.cookie); state->cookie.cookie);
ZeroMemory(&state->cookie, sizeof(nfs41_readdir_cookie)); } else if (!state->cookie.cookie) {
} else dprintf(1, "handle_nfs41_readdir: EOF\n");
dprintf(1, "resuming enumeration with cookie %llu.\n", status = ERROR_NO_MORE_FILES;
state->cookie.cookie); goto out;
} else { /* cookie is null */
if (args->initial || args->restart) {
dprintf(1, "initializing the 1st readdir cookie\n");
ZeroMemory(&state->cookie, sizeof(nfs41_readdir_cookie));
} else {
dprintf(1, "handle_nfs41_readdir: EOF\n");
status = ERROR_NO_MORE_FILES;
goto out;
}
} }
entry_buf = malloc(max(args->buf_len, 4096)); entry_buf = malloc(max(args->buf_len, 4096));