Defines | |
#define | ROX_XATTR_MIME_TYPE "user.mime_type" |
#define | ROX_XATTR_HIDDEN "user.hidden" |
Functions | |
void | rox_xattr_init (void) |
int | rox_xattr_supported (const char *path) |
int | rox_xattr_have (const char *path) |
gchar * | rox_xattr_get (const char *path, const char *attr, int *len) |
int | rox_xattr_set (const char *path, const char *attr, const char *value, int value_len) |
GList * | rox_xattr_list (const char *path) |
int | rox_xattr_delete (const char *path, const char *attr) |
gboolean | rox_xattr_name_valid (const char *attr) |
gboolean | rox_xattr_binary_value_supported (void) |
ROXMIMEType * | rox_xattr_type_get (const char *path) |
int | rox_xattr_type_set (const char *path, const ROXMIMEType *type) |
This provides an abstract interface to the supported extended attribute API.
#define ROX_XATTR_HIDDEN "user.hidden" |
User set hidden attribute on file
#define ROX_XATTR_MIME_TYPE "user.mime_type" |
User defined MIME type of file
gboolean rox_xattr_binary_value_supported | ( | void | ) |
TRUE
if the value of an extended attribute can include the ASCII '\0' character. int rox_xattr_delete | ( | const char * | path, | |
const char * | attr | |||
) |
Remove an extended attributes from a file.
[in] | path | name of file to check |
[in] | attr | name of attribute to check |
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. gchar* rox_xattr_get | ( | const char * | path, | |
const char * | attr, | |||
int * | len | |||
) |
Get the value of an extended attribute. The returned value should be freed with g_free() when done.
[in] | path | file to get extended attribute from. |
[in] | attr | name of the attribute |
[out] | len | if not NULL then the length of the data returned is stored here, but if the function returns NULL then the contents of len are not changed. |
NULL
if attr is not present or if an error occurred (check errno). int rox_xattr_have | ( | const char * | path | ) |
Check for the presence of extended attributes on a file.
[in] | path | file to check |
TRUE
if extended attributes are present, FALSE
if not or if an error occurred (check errno for ENOENT etc.). void rox_xattr_init | ( | void | ) |
Initialize the extended attrubute system.
GList* rox_xattr_list | ( | const char * | path | ) |
Return a list of extended attributes set on a file.
[in] | path | name of file to check |
NULL
if no attributes found or an error occurred (check errno). gboolean rox_xattr_name_valid | ( | const char * | attr | ) |
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.
[in] | attr | name of attribute to check |
TRUE
if the name is valid int rox_xattr_set | ( | const char * | path, | |
const char * | attr, | |||
const char * | value, | |||
int | value_len | |||
) |
Set the value of an extended attribute.
[in] | path | file to set extended attribute on. |
[in] | attr | name of the attribute |
[in] | value | value of the attribute to set |
[in] | value_len | length of data in value, or -1 if value is a string in which case strlen(value) will be used. |
0
for success, or non-zero for an error (check errno). int rox_xattr_supported | ( | const char * | path | ) |
Check for extended attribute support on the system or a specific file.
[in] | path | If NULL then check for support on the system, otherwise check for xattr support on the named file name. |
TRUE
if extended attributes are supported. ROXMIMEType* rox_xattr_type_get | ( | const char * | path | ) |
Convinience function to check a file for the ROX_XATTR_MIME_TYPE attribute and return the appropriate ROXMIMEType.
[in] | path | file to check |
NULL
if not set or an error occurred (check errno). int rox_xattr_type_set | ( | const char * | path, | |
const ROXMIMEType * | type | |||
) |
Convinience function to set the ROX_XATTR_MIME_TYPE attribute on a file.
[in] | path | file to set MIME type of |
[in] | type | type to set. |
0
for success, or non-zero for an error (check errno).