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