Previous section.

Protocols for Interworking: XNFS, Version 3W
Copyright © 1998 The Open Group

Name

NFSPROC_READDIR - Read From Directory

Call Arguments

struct readdirargs { fhandle dir; nfscookie cookie; unsigned count; };

fhandle and nfscookie are defined in Basic Data Types .

Return Arguments

struct entry { unsigned fileid; filename name; nfscookie cookie; entry *nextentry; };

filename and nfscookie are defined in Basic Data Types .

union readdirres switch (stat status) { case NFS_OK: struct { entry *entries; bool eof; } readdirok; default: void; };

RPC Procedure Description

readdirres NFSPROC_READDIR (readdirargs) = 16;

Description

A variable number of directory entries, with a total size of up to count bytes, are returned from the directory given by dir. If the returned value of status is NFS_OK, then it is followed by a variable number of entrys. Each entry contains a fileid which consists of a unique number to identify the file within a file system, the name of the file, and a cookie which is an opaque pointer to the next entry in the directory. The cookie is used in the next NFSPROC_READDIR call to get more entries starting at a given point in the directory. The special cookie zero (all bits zero) can be used to get the entries starting at the beginning of the directory. The fileid field must be the same number as the fileid in the attributes of the file. The eof flag has a value of TRUE if there are no more entries in the directory (see Basic Data Types ).

A cookie encodes (opaquely) the notion of a pointer into a directory. The length of time for which a cookie is valid is not defined by this specification. It is possible that directory operations on the server may mean that when a cookie is presented by a client, it is no longer possible to seek to the corresponding position in the directory, or it may be that seeking to that position might cause directory entries which had already been returned to be repeated. In these cases the server should return an eof indication even if this means that not all directory entries are returned.

Return Codes

NFS_OK
Indicates that the call completed successfully and the results are valid.

NFSERR_NOENT
No such file or directory. The file or directory specified does not exist.

NFSERR_IO
Some sort of hard error occurred when the operation was in progress. This could be a disk error, for example.

NFSERR_ACCES
Permission denied. The caller does not have the correct permission to perform the requested operation.

NFSERR_NOTDIR
Not a directory. The caller specified a non-directory in a directory operation.

NFSERR_STALE
The fhandle given in the arguments was invalid. That is, the file referred to by that file handle no longer exists, or access to it has been revoked.


Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index