\section{xattr.h File Reference}
\label{xattr_8h}\index{xattr.h@{xattr.h}}
Extended file attribute support, particularly for MIME types. 

\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf ROX\_\-XATTR\_\-MIME\_\-TYPE}~\char`\"{}user.mime\_\-type\char`\"{}
\item 
\#define {\bf ROX\_\-XATTR\_\-HIDDEN}~\char`\"{}user.hidden\char`\"{}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf rox\_\-xattr\_\-init} (void)
\item 
int {\bf rox\_\-xattr\_\-supported} (const char $\ast$path)
\item 
int {\bf rox\_\-xattr\_\-have} (const char $\ast$path)
\item 
gchar $\ast$ {\bf rox\_\-xattr\_\-get} (const char $\ast$path, const char $\ast$attr, int $\ast$len)
\item 
int {\bf rox\_\-xattr\_\-set} (const char $\ast$path, const char $\ast$attr, const char $\ast$value, int value\_\-len)
\item 
GList $\ast$ {\bf rox\_\-xattr\_\-list} (const char $\ast$path)
\item 
int {\bf rox\_\-xattr\_\-delete} (const char $\ast$path, const char $\ast$attr)
\item 
gboolean {\bf rox\_\-xattr\_\-name\_\-valid} (const char $\ast$attr)
\item 
gboolean {\bf rox\_\-xattr\_\-binary\_\-value\_\-supported} (void)
\item 
{\bf ROXMIMEType} $\ast$ {\bf rox\_\-xattr\_\-type\_\-get} (const char $\ast$path)
\item 
int {\bf rox\_\-xattr\_\-type\_\-set} (const char $\ast$path, const {\bf ROXMIMEType} $\ast$type)
\end{CompactItemize}


\subsection{Detailed Description}
Extended file attribute support, particularly for MIME types. 

This provides an abstract interface to the supported extended attribute API.

\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]\doxyref{xattr.h}{p.}{xattr_8h},v 1.1 2006/10/03 20:45:58 stephen Exp \end{Desc}
\end{Desc}
\begin{Desc}
\item[Author:]Stephen Watson, Thomas Leonard \end{Desc}


\subsection{Define Documentation}
\index{xattr.h@{xattr.h}!ROX_XATTR_HIDDEN@{ROX\_\-XATTR\_\-HIDDEN}}
\index{ROX_XATTR_HIDDEN@{ROX\_\-XATTR\_\-HIDDEN}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ROX\_\-XATTR\_\-HIDDEN~\char`\"{}user.hidden\char`\"{}}\label{xattr_8h_b68943563ccdfffbf52ad90d9187e9a7}


User set hidden attribute on file \index{xattr.h@{xattr.h}!ROX_XATTR_MIME_TYPE@{ROX\_\-XATTR\_\-MIME\_\-TYPE}}
\index{ROX_XATTR_MIME_TYPE@{ROX\_\-XATTR\_\-MIME\_\-TYPE}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ROX\_\-XATTR\_\-MIME\_\-TYPE~\char`\"{}user.mime\_\-type\char`\"{}}\label{xattr_8h_9c82eb345c3702f7d7ae9d404bdf2ee8}


User defined MIME type of file 

\subsection{Function Documentation}
\index{xattr.h@{xattr.h}!rox_xattr_binary_value_supported@{rox\_\-xattr\_\-binary\_\-value\_\-supported}}
\index{rox_xattr_binary_value_supported@{rox\_\-xattr\_\-binary\_\-value\_\-supported}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gboolean rox\_\-xattr\_\-binary\_\-value\_\-supported (void)}\label{xattr_8h_a1171495a4861477c9029042a4023e4c}


\begin{Desc}
\item[Returns:]{\tt TRUE} if the value of an extended attribute can include the ASCII '$\backslash$0' character. \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_delete@{rox\_\-xattr\_\-delete}}
\index{rox_xattr_delete@{rox\_\-xattr\_\-delete}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rox\_\-xattr\_\-delete (const char $\ast$ {\em path}, const char $\ast$ {\em attr})}\label{xattr_8h_b25d5926a27d87c740bb921626bd6c18}


Remove an extended attributes from a file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]name of file to check \item[\mbox{$\leftarrow$} {\em attr}]name of attribute to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt 0} for success, or non-zero for an error (check errno). If the attribute was not set then this returns non-zero but sets errno to 0. \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_get@{rox\_\-xattr\_\-get}}
\index{rox_xattr_get@{rox\_\-xattr\_\-get}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gchar$\ast$ rox\_\-xattr\_\-get (const char $\ast$ {\em path}, const char $\ast$ {\em attr}, int $\ast$ {\em len})}\label{xattr_8h_bf75c6ac031c7ca0eae973ac759c057d}


Get the value of an extended attribute. The returned value should be freed with g\_\-free() when done.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]file to get extended attribute from. \item[\mbox{$\leftarrow$} {\em attr}]name of the attribute \item[\mbox{$\rightarrow$} {\em len}]if not {\tt NULL} then the length of the data returned is stored here, but if the function returns {\tt NULL} then the contents of {\em len\/} are not changed. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the value of the extended attribute {\em attr\/} (pass to g\_\-free() when done, or {\tt NULL} if {\em attr\/} is not present or if an error occurred (check errno). \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_have@{rox\_\-xattr\_\-have}}
\index{rox_xattr_have@{rox\_\-xattr\_\-have}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rox\_\-xattr\_\-have (const char $\ast$ {\em path})}\label{xattr_8h_f83b729399d19c976b0ec16b7bd5a6cb}


Check for the presence of extended attributes on a file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]file to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt TRUE} if extended attributes are present, {\tt FALSE} if not or if an error occurred (check errno for ENOENT etc.). \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_init@{rox\_\-xattr\_\-init}}
\index{rox_xattr_init@{rox\_\-xattr\_\-init}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void rox\_\-xattr\_\-init (void)}\label{xattr_8h_abc74725bee5b41aff6c00b5fc8224a0}


Initialize the extended attrubute system. \index{xattr.h@{xattr.h}!rox_xattr_list@{rox\_\-xattr\_\-list}}
\index{rox_xattr_list@{rox\_\-xattr\_\-list}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}GList$\ast$ rox\_\-xattr\_\-list (const char $\ast$ {\em path})}\label{xattr_8h_25eaae948e7fcc914ccc8c626acb7f4f}


Return a list of extended attributes set on a file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]name of file to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]List of attribute names, pass to \doxyref{rox\_\-basedir\_\-free\_\-paths()}{p.}{basedir_8c_94a837190776a3e4982453bb3ab9b408} when done, or {\tt NULL} if no attributes found or an error occurred (check errno). \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_name_valid@{rox\_\-xattr\_\-name\_\-valid}}
\index{rox_xattr_name_valid@{rox\_\-xattr\_\-name\_\-valid}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}gboolean rox\_\-xattr\_\-name\_\-valid (const char $\ast$ {\em attr})}\label{xattr_8h_71b486d63d73020479106cf9dcd4e132}


Check validity of an extended attribute name.

Some implementations of extended attributes enforce restrictions on valid attribute names. This checks the name against the current rules.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em attr}]name of attribute to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt TRUE} if the name is valid \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_set@{rox\_\-xattr\_\-set}}
\index{rox_xattr_set@{rox\_\-xattr\_\-set}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rox\_\-xattr\_\-set (const char $\ast$ {\em path}, const char $\ast$ {\em attr}, const char $\ast$ {\em value}, int {\em value\_\-len})}\label{xattr_8h_c32d914a3b231fab83fe0c40642f4bd5}


Set the value of an extended attribute.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]file to set extended attribute on. \item[\mbox{$\leftarrow$} {\em attr}]name of the attribute \item[\mbox{$\leftarrow$} {\em value}]value of the attribute to set \item[\mbox{$\leftarrow$} {\em value\_\-len}]length of data in {\em value\/}, or {\tt -1} if {\em value\/} is a string in which case strlen(value) will be used. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt 0} for success, or non-zero for an error (check errno). \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_supported@{rox\_\-xattr\_\-supported}}
\index{rox_xattr_supported@{rox\_\-xattr\_\-supported}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rox\_\-xattr\_\-supported (const char $\ast$ {\em path})}\label{xattr_8h_cb5f65181824e352f8d38cea47ab6425}


Check for extended attribute support on the system or a specific file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]If {\tt NULL} then check for support on the system, otherwise check for xattr support on the named file name. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt TRUE} if extended attributes are supported. \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_type_get@{rox\_\-xattr\_\-type\_\-get}}
\index{rox_xattr_type_get@{rox\_\-xattr\_\-type\_\-get}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf ROXMIMEType}$\ast$ rox\_\-xattr\_\-type\_\-get (const char $\ast$ {\em path})}\label{xattr_8h_d62379f3b05be21b973626d4db7ffcd9}


Convinience function to check a file for the \doxyref{ROX\_\-XATTR\_\-MIME\_\-TYPE}{p.}{xattr_8h_9c82eb345c3702f7d7ae9d404bdf2ee8} attribute and return the appropriate ROXMIMEType.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]file to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]MIME type, or {\tt NULL} if not set or an error occurred (check errno). \end{Desc}
\index{xattr.h@{xattr.h}!rox_xattr_type_set@{rox\_\-xattr\_\-type\_\-set}}
\index{rox_xattr_type_set@{rox\_\-xattr\_\-type\_\-set}!xattr.h@{xattr.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rox\_\-xattr\_\-type\_\-set (const char $\ast$ {\em path}, const {\bf ROXMIMEType} $\ast$ {\em type})}\label{xattr_8h_7d828409f616f6652a925fd32593f916}


Convinience function to set the \doxyref{ROX\_\-XATTR\_\-MIME\_\-TYPE}{p.}{xattr_8h_9c82eb345c3702f7d7ae9d404bdf2ee8} attribute on a file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[\mbox{$\leftarrow$} {\em path}]file to set MIME type of \item[\mbox{$\leftarrow$} {\em type}]type to set. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt 0} for success, or non-zero for an error (check errno). \end{Desc}
