xref: /freebsd/lib/libc/posix1e/extattr.3 (revision 10ff414c)
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
35vice 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
46The
47.Fn extattr_namespace_to_string
48function converts a VFS extended attribute identifier to a human-readable
49string;
50the
51.Fn extattr_string_to_namespace
52function undoes the aforementioned operation,
53and converts a human-readable string representing a namespace to a
54namespace identifier.
55Although a file system may implement arbitrary namespaces,
56these functions only support the
57.Dv EXTATTR_NAMESPACE_USER
58.Pq Dq user
59and
60.Dv EXTATTR_NAMESPACE_SYSTEM
61.Pq Dq system
62namespaces,
63which are defined in
64.Xr extattr 9 .
65.Pp
66These functions are meant to be used in error reporting and other
67interactive tasks.
68For example,
69instead of printing the integer identifying an extended attribute in
70an error message,
71a program might use
72.Fn extattr_namespace_to_string
73to obtain a human-readable representation.
74Likewise,
75instead of requiring a user to enter the integer representing a namespace,
76an interactive program might ask for a name and use
77.Fn extattr_string_to_namespace
78to get the desired identifier.
79.Sh RETURN VALUES
80If any of the calls are unsuccessful, the value \-1 is returned
81and the global variable
82.Va errno
83is set to indicate the error.
84.Sh ERRORS
85.Bl -tag -width Er
86.It Bq Er EINVAL
87The 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
95Extended attribute support was developed as part of the
96.Tn TrustedBSD
97Project, and introduced in
98.Fx 5.0 .
99It was developed to support security extensions requiring additional labels
100to be associated with each file or directory.
101