xref: /freebsd/sys/contrib/openzfs/include/sys/pathname.h (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1 // SPDX-License-Identifier: CDDL-1.0
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License (the "License").
7  * You may not use this file except in compliance with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or https://opensource.org/licenses/CDDL-1.0.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * Portions of this source code were derived from Berkeley 4.3 BSD
32  * under license from the Regents of the University of California.
33  */
34 
35 #ifndef _SYS_PATHNAME_H
36 #define	_SYS_PATHNAME_H
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Pathname structure.
44  * System calls that operate on path names gather the path name
45  * from the system call into this structure and reduce it by
46  * peeling off translated components.  If a symbolic link is
47  * encountered the new path name to be translated is also
48  * assembled in this structure.
49  *
50  * By convention pn_buf is not changed once it's been set to point
51  * to the underlying storage; routines which manipulate the pathname
52  * do so by changing pn_path and pn_pathlen.  pn_pathlen is redundant
53  * since the path name is null-terminated, but is provided to make
54  * some computations faster.
55  */
56 typedef struct pathname {
57 	char	*pn_buf;		/* underlying storage */
58 	size_t	pn_bufsize;		/* total size of pn_buf */
59 } pathname_t;
60 
61 extern void	pn_alloc(struct pathname *);
62 extern void	pn_alloc_sz(struct pathname *, size_t);
63 extern void	pn_free(struct pathname *);
64 
65 #ifdef	__cplusplus
66 }
67 #endif
68 
69 #endif	/* _SYS_PATHNAME_H */
70