]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/VOP_READDIR.9
Remove $FreeBSD$: two-line nroff pattern
[FreeBSD/FreeBSD.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 .Dd December 13, 2021
30 .Dt VOP_READDIR 9
31 .Os
32 .Sh NAME
33 .Nm VOP_READDIR
34 .Nd read contents of a directory
35 .Sh SYNOPSIS
36 .In sys/param.h
37 .In sys/dirent.h
38 .In sys/vnode.h
39 .Ft int
40 .Fn VOP_READDIR "struct vnode *vp" "struct uio *uio" "struct ucred *cred" "int *eofflag" "int *ncookies" "uint64_t **cookies"
41 .Sh DESCRIPTION
42 Read directory entries.
43 .Bl -tag -width ncookies
44 .It Fa vp
45 The vnode of the directory.
46 .It Fa uio
47 Where to read the directory contents.
48 .It Fa cred
49 The caller's credentials.
50 .It Fa eofflag
51 Return end of file status
52 .Dv ( NULL
53 if not wanted).
54 .It Fa ncookies
55 Number of directory cookies generated for NFS
56 .Dv ( NULL
57 if not wanted).
58 .It Fa cookies
59 Directory seek cookies generated for NFS
60 .Dv ( NULL
61 if not wanted).
62 .El
63 The directory contents are read into
64 .Vt struct dirent
65 structures.
66 If the on-disc data structures differ from this then they
67 should be translated.
68 .Sh LOCKS
69 The directory should be locked on entry and will still be locked on exit.
70 .Sh RETURN VALUES
71 Zero is returned on success, otherwise an error code is returned.
72 .Pp
73 If this is called from the NFS server, the extra arguments
74 .Fa eofflag ,
75 .Fa ncookies
76 and
77 .Fa cookies
78 are given.
79 The value of
80 .Fa *eofflag
81 should be set to TRUE if the end of the directory is reached while
82 reading.
83 The directory seek cookies are returned to the NFS client and may be used
84 later to restart a directory read part way through the directory.
85 There should be one cookie returned per directory entry.
86 The value of
87 the cookie should be the offset within the directory where the on-disc
88 version of the appropriate directory entry starts.
89 Memory for the cookies should be allocated using:
90 .Bd -literal
91         ...;
92         *ncookies = number of entries read;
93         *cookies = malloc(*ncookies * sizeof(**cookies), M_TEMP, M_WAITOK);
94 .Ed
95 .Sh ERRORS
96 .Bl -tag -width Er
97 .It Bq Er EINVAL
98 An attempt was made to read from an illegal offset in the directory.
99 .It Bq Er EIO
100 A read error occurred while reading the directory.
101 .It Bq Er EINTEGRITY
102 Corrupted data was detected 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 .