]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man9/VOP_READDIR.9
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man9 / VOP_READDIR.9
1 .\" -*- nroff -*-
2 .\"
3 .\" Copyright (c) 1996 Doug Rabson
4 .\"
5 .\" All rights reserved.
6 .\"
7 .\" This program is free software.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 .\"
29 .\" $FreeBSD$
30 .\"
31 .Dd July 24, 1996
32 .Dt VOP_READDIR 9
33 .Os
34 .Sh NAME
35 .Nm VOP_READDIR
36 .Nd read contents of a directory
37 .Sh SYNOPSIS
38 .In sys/param.h
39 .In sys/dirent.h
40 .In sys/vnode.h
41 .Ft int
42 .Fn VOP_READDIR "struct vnode *vp" "struct uio *uio" "struct ucred *cred" "int *eofflag" "int *ncookies" "u_long **cookies"
43 .Sh DESCRIPTION
44 Read directory entries.
45 .Bl -tag -width ncookies
46 .It Fa vp
47 The vnode of the directory.
48 .It Fa uio
49 Where to read the directory contents.
50 .It Fa cred
51 The caller's credentials.
52 .It Fa eofflag
53 Return end of file status
54 .Dv ( NULL
55 if not wanted).
56 .It Fa ncookies
57 Number of directory cookies generated for NFS
58 .Dv ( NULL
59 if not wanted).
60 .It Fa cookies
61 Directory seek cookies generated for NFS
62 .Dv ( NULL
63 if not wanted).
64 .El
65 The directory contents are read into
66 .Vt struct dirent
67 structures.
68 If the on-disc data structures differ from this then they
69 should be translated.
70 .Sh LOCKS
71 The directory should be locked on entry and will still be locked on exit.
72 .Sh RETURN VALUES
73 Zero is returned on success, otherwise an error code is returned.
74 .Pp
75 If this is called from the NFS server, the extra arguments
76 .Fa eofflag ,
77 .Fa ncookies
78 and
79 .Fa cookies
80 are given.
81 The value of
82 .Fa *eofflag
83 should be set to TRUE if the end of the directory is reached while
84 reading.
85 The directory seek cookies are returned to the NFS client and may be used
86 later to restart a directory read part way through the directory.
87 There should be one cookie returned per directory entry.
88 The value of
89 the cookie should be the offset within the directory where the on-disc
90 version of the appropriate directory entry starts.
91 Memory for the cookies should be allocated using:
92 .Bd -literal
93         ...;
94         *ncookies = number of entries read;
95         *cookies = malloc(*ncookies * sizeof(u_long), M_TEMP, M_WAITOK);
96 .Ed
97 .Sh ERRORS
98 .Bl -tag -width Er
99 .It Bq Er EINVAL
100 An attempt was made to read from an illegal offset in the directory.
101 .It Bq Er EIO
102 A read error occurred while reading the directory.
103 .El
104 .Sh SEE ALSO
105 .Xr vnode 9
106 .Sh AUTHORS
107 This manual page was written by
108 .An Doug Rabson .