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