4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
21 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
22 /* All Rights Reserved */
26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <sys/errno.h>
33 #include <sys/vnode.h>
34 #include <sys/nvpair.h>
37 #include <fs/fs_subr.h>
38 #include <fs/fs_reparse.h>
42 * support functions for reparse point
43 * copied from uts/common/fs/fs_subr.c
49 * Read the symlink data of a reparse point specified by the vnode
50 * and return the reparse data as name-value pair in the nvlist.
53 reparse_vnode_parse(vnode_t
*vp
, nvlist_t
*nvl
)
60 if (vp
== NULL
|| nvl
== NULL
)
63 lkdata
= kmem_alloc(MAXREPARSELEN
, KM_SLEEP
);
66 * Set up io vector to read sym link data
68 iov
.iov_base
= lkdata
;
69 iov
.iov_len
= MAXREPARSELEN
;
72 uio
.uio_segflg
= UIO_SYSSPACE
;
73 uio
.uio_extflg
= UIO_COPY_CACHED
;
74 uio
.uio_loffset
= (offset_t
)0;
75 uio
.uio_resid
= MAXREPARSELEN
;
77 if ((err
= VOP_READLINK(vp
, &uio
, zone_kcred(), NULL
)) == 0) {
78 *(lkdata
+ MAXREPARSELEN
- uio
.uio_resid
) = '\0';
79 err
= reparse_parse(lkdata
, nvl
);
81 kmem_free(lkdata
, MAXREPARSELEN
); /* done with lkdata */