xref: /freebsd/share/man/man9/VOP_VPTOCNP.9 (revision b3aaa0cc21c63d388230c7ef2a80abd631ff20d5)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2008 Joe Marcus Clarke
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 December 7, 2008
32.Os
33.Dt VOP_VPTOCNP 9
34.Sh NAME
35.Nm VOP_VPTOCNP
36.Nd translate a vnode to its component name
37.Sh SYNOPSIS
38.In sys/param.h
39.In sys/vnode.h
40.Ft int
41.Fn VOP_VPTOCNP "struct vnode *vp" "struct vnode **dvp" "char *buf" "int *buflen"
42.Sh DESCRIPTION
43This translates a vnode into its component name, and writes that name to
44the head of the buffer specified by
45.Fa buf
46.Bl -tag -width buflen
47.It Fa vp
48The vnode to translate.
49.It Fa dvp
50The vnode of the parent directory of
51.Fa vp .
52.It Fa buf
53The buffer into which to preprend the component name.
54.It Fa buflen
55The remaining size of the buffer.
56.El
57.Pp
58The default implementation of
59.Nm
60simply returns ENOENT.
61.Sh LOCKS
62The vnode should be locked on entry and will still be locked on exit.  The
63parent directory vnode will be unlocked on a successful exit.  However, it
64will have its hold count incremented.
65.Sh RETURN VALUES
66Zero is returned on success, otherwise an error code is returned.
67.Sh PSEUDOCODE
68.Bd -literal
69int
70vop_vptocnp(struct vnode *vp, struct vnode **dvp, char *buf, int *buflen)
71{
72    int error = 0;
73
74    /*
75     * Translate the vnode to its component name.
76     *
77     * Decrement the component name's length from buflen.
78     *
79     * Obtain the vnode's parent directory vnode.
80     */
81    ...;
82
83    /*
84     * Increment the parent directory's hold count.
85     */
86    vhold(*dvp);
87
88    return error;
89}
90.Ed
91.Sh ERRORS
92.Bl -tag -width Er
93.It Bq Er ENOMEM
94The buffer was not large enough to hold the vnode's component name.
95.It Bq Er ENOENT
96The vnode was not found on the file system.
97.El
98.Sh SEE ALSO
99.Xr VOP_LOOKUP 9 ,
100.Xr vnode 9
101.Sh NOTES
102This interface is a work in progress.
103.Sh HISTORY
104The function
105.Nm
106appeared in
107.Fx 8.0 .
108.Sh AUTHORS
109This manual page was written by
110.An Joe Marcus Clarke .
111