10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 59668SCasper.Dik@Sun.COM * Common Development and Distribution License (the "License"). 69668SCasper.Dik@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*12789SRoger.Faulkner@Oracle.COM 220Sstevel@tonic-gate /* 23*12789SRoger.Faulkner@Oracle.COM * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 4.3 BSD 310Sstevel@tonic-gate * under license from the Regents of the University of California. 320Sstevel@tonic-gate */ 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifndef _SYS_PATHNAME_H 350Sstevel@tonic-gate #define _SYS_PATHNAME_H 360Sstevel@tonic-gate 370Sstevel@tonic-gate #include <sys/vnode.h> 380Sstevel@tonic-gate #include <sys/cred.h> 390Sstevel@tonic-gate #include <sys/uio.h> 400Sstevel@tonic-gate #include <sys/dirent.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate #ifdef __cplusplus 430Sstevel@tonic-gate extern "C" { 440Sstevel@tonic-gate #endif 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * Pathname structure. 480Sstevel@tonic-gate * System calls that operate on path names gather the path name 490Sstevel@tonic-gate * from the system call into this structure and reduce it by 500Sstevel@tonic-gate * peeling off translated components. If a symbolic link is 510Sstevel@tonic-gate * encountered the new path name to be translated is also 520Sstevel@tonic-gate * assembled in this structure. 530Sstevel@tonic-gate * 540Sstevel@tonic-gate * By convention pn_buf is not changed once it's been set to point 550Sstevel@tonic-gate * to the underlying storage; routines which manipulate the pathname 560Sstevel@tonic-gate * do so by changing pn_path and pn_pathlen. pn_pathlen is redundant 570Sstevel@tonic-gate * since the path name is null-terminated, but is provided to make 580Sstevel@tonic-gate * some computations faster. 590Sstevel@tonic-gate */ 600Sstevel@tonic-gate typedef struct pathname { 610Sstevel@tonic-gate char *pn_buf; /* underlying storage */ 620Sstevel@tonic-gate char *pn_path; /* remaining pathname */ 630Sstevel@tonic-gate size_t pn_pathlen; /* remaining length */ 640Sstevel@tonic-gate size_t pn_bufsize; /* total size of pn_buf */ 650Sstevel@tonic-gate } pathname_t; 660Sstevel@tonic-gate 670Sstevel@tonic-gate #define pn_pathleft(pnp) ((pnp)->pn_pathlen) 680Sstevel@tonic-gate 690Sstevel@tonic-gate extern void pn_alloc(struct pathname *); 700Sstevel@tonic-gate extern int pn_get(char *, enum uio_seg, struct pathname *); 710Sstevel@tonic-gate extern int pn_get_buf(char *, enum uio_seg, struct pathname *, 720Sstevel@tonic-gate void *, size_t); 730Sstevel@tonic-gate extern int pn_set(struct pathname *, char *); 740Sstevel@tonic-gate extern int pn_insert(struct pathname *, struct pathname *, size_t); 750Sstevel@tonic-gate extern int pn_getsymlink(vnode_t *, struct pathname *, cred_t *); 760Sstevel@tonic-gate extern int pn_getcomponent(struct pathname *, char *); 770Sstevel@tonic-gate extern void pn_setlast(struct pathname *); 780Sstevel@tonic-gate extern void pn_skipslash(struct pathname *); 790Sstevel@tonic-gate extern int pn_fixslash(struct pathname *); 800Sstevel@tonic-gate extern int pn_addslash(struct pathname *); 810Sstevel@tonic-gate extern void pn_free(struct pathname *); 820Sstevel@tonic-gate 83*12789SRoger.Faulkner@Oracle.COM extern int lookupname(char *, enum uio_seg, int follow, 840Sstevel@tonic-gate vnode_t **, vnode_t **); 85*12789SRoger.Faulkner@Oracle.COM extern int lookupnameat(char *, enum uio_seg, int follow, 860Sstevel@tonic-gate vnode_t **, vnode_t **, vnode_t *); 87*12789SRoger.Faulkner@Oracle.COM extern int lookupnameatcred(char *, enum uio_seg, int follow, 889668SCasper.Dik@Sun.COM vnode_t **, vnode_t **, vnode_t *, cred_t *); 89*12789SRoger.Faulkner@Oracle.COM extern int lookuppn(struct pathname *, struct pathname *, int follow, 900Sstevel@tonic-gate vnode_t **, vnode_t **); 91*12789SRoger.Faulkner@Oracle.COM extern int lookuppnat(struct pathname *, struct pathname *, int follow, 920Sstevel@tonic-gate vnode_t **, vnode_t **, vnode_t *); 93*12789SRoger.Faulkner@Oracle.COM extern int lookuppnatcred(struct pathname *, struct pathname *, int follow, 949668SCasper.Dik@Sun.COM vnode_t **, vnode_t **, vnode_t *, cred_t *); 950Sstevel@tonic-gate 960Sstevel@tonic-gate extern int lookuppnvp(struct pathname *, struct pathname *, int follow, 970Sstevel@tonic-gate vnode_t **, vnode_t **, vnode_t *, vnode_t *, cred_t *); 980Sstevel@tonic-gate extern int traverse(vnode_t **); 990Sstevel@tonic-gate 1000Sstevel@tonic-gate extern int vnodetopath(vnode_t *, vnode_t *, char *, size_t, cred_t *); 1010Sstevel@tonic-gate extern int dogetcwd(char *, size_t); 1020Sstevel@tonic-gate extern int dirfindvp(vnode_t *, vnode_t *, vnode_t *, cred_t *, char *, 1030Sstevel@tonic-gate size_t, dirent64_t **); 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #ifdef __cplusplus 1060Sstevel@tonic-gate } 1070Sstevel@tonic-gate #endif 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #endif /* _SYS_PATHNAME_H */ 110