]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/posix1e/extattr.3
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / posix1e / extattr.3
1 .\"
2 .\" Copyright (c) 2001 Dima Dorfman <dd@FreeBSD.org>
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd June 24, 2001
29 .Dt EXTATTR 3
30 .Os
31 .Sh NAME
32 .Nm extattr_namespace_to_string ,
33 .Nm extattr_string_to_namespace
34 .Nd convert an extended attribute namespace identifier to a string and
35 vice versa
36 .Sh LIBRARY
37 .Lb libutil
38 .Sh SYNOPSIS
39 .In sys/extattr.h
40 .In libutil.h
41 .Ft int
42 .Fn extattr_namespace_to_string "int attrnamespace" "char **string"
43 .Ft int
44 .Fn extattr_string_to_namespace "const char *string" "int *attrnamespace"
45 .Sh DESCRIPTION
46 The
47 .Fn extattr_namespace_to_string
48 function converts a VFS extended attribute identifier to a human-readable
49 string;
50 the
51 .Fn extattr_string_to_namespace
52 function undoes the aforementioned operation,
53 and converts a human-readable string representing a namespace to a
54 namespace identifier.
55 Although a file system may implement arbitrary namespaces,
56 these functions only support the
57 .Dv EXTATTR_NAMESPACE_USER
58 .Pq Dq user
59 and
60 .Dv EXTATTR_NAMESPACE_SYSTEM
61 .Pq Dq system
62 namespaces,
63 which are defined in
64 .Xr extattr 9 .
65 .Pp
66 These functions are meant to be used in error reporting and other
67 interactive tasks.
68 For example,
69 instead of printing the integer identifying an extended attribute in
70 an error message,
71 a program might use
72 .Fn extattr_namespace_to_string
73 to obtain a human-readable representation.
74 Likewise,
75 instead of requiring a user to enter the integer representing a namespace,
76 an interactive program might ask for a name and use
77 .Fn extattr_string_to_namespace
78 to get the desired identifier.
79 .Sh RETURN VALUES
80 If any of the calls are unsuccessful, the value \-1 is returned
81 and the global variable
82 .Va errno
83 is set to indicate the error.
84 .Sh ERRORS
85 .Bl -tag -width Er
86 .It Bq Er EINVAL
87 The requested namespace could not be identified.
88 .El
89 .Sh SEE ALSO
90 .Xr extattr 2 ,
91 .Xr getextattr 8 ,
92 .Xr setextattr 8 ,
93 .Xr extattr 9
94 .Sh HISTORY
95 Extended attribute support was developed as part of the
96 .Tn TrustedBSD
97 Project, and introduced in
98 .Fx 5.0 .
99 It was developed to support security extensions requiring additional labels
100 to be associated with each file or directory.