Xattrs

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Enumerations | Functions
Xattrs
Eina » Tools

Extended Attributes handling. More...

## Data Structures
struct | _Eina_Xattr

## Typedefs
typedef struct _Eina_Xattr | Eina_Xattr

## Enumerations
enum | Eina_Xattr_Flags { EINA_XATTR_INSERT = 0 , EINA_XATTR_REPLACE = 1 , EINA_XATTR_CREATED = 2 , EINA_XATTR_FLAGS_INSERT = 0 , EINA_XATTR_FLAGS_REPLACE = 1 , EINA_XATTR_FLAGS_CREATED = 2 }
| define extended attribute creation More...

## Functions
EINA_API Eina_Iterator * | eina_xattr_ls (const char *file)
| Gets an iterator that lists all extended attribute of a file.
EINA_API Eina_Iterator * | eina_xattr_value_ls (const char *file)
| Gets an iterator that list all extended attribute value related to a fd.
EINA_API Eina_Iterator * | eina_xattr_fd_ls (int fd)
| Gets an iterator that list all extended attribute related to a fd.
EINA_API Eina_Iterator * | eina_xattr_value_fd_ls (int fd)
| Gets an iterator that list all extended attribute value related to a fd.
EINA_API Eina_Bool | eina_xattr_copy (const char *src, const char *dst)
| Copies the extended attribute from one file to another.
EINA_API Eina_Bool | eina_xattr_fd_copy (int src, int dst)
| Copies the extended attribute from one file descriptor to another.
EINA_API void * | eina_xattr_get (const char *file, const char *attribute, ssize_t *size)
| Retrieves an extended attribute from a file.
EINA_API void * | eina_xattr_fd_get (int fd, const char *attribute, ssize_t *size)
| Retrieves an extended attribute from a file descriptor.
EINA_API Eina_Bool | eina_xattr_set (const char *file, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags)
| Sets an extended attribute on a file.
EINA_API Eina_Bool | eina_xattr_fd_set (int fd, const char *attribute, const void *data, ssize_t length, Eina_Xattr_Flags flags)
| Sets an extended attribute on a file descriptor.
EINA_API Eina_Bool | eina_xattr_del (const char *file, const char *attribute)
| Deletes (removes) an extended attribute from a file.
EINA_API Eina_Bool | eina_xattr_fd_del (int fd, const char *attribute)
| Deletes (removes) an extended attribute from a file descriptor.
EINA_API Eina_Bool | eina_xattr_string_set (const char *file, const char *attribute, const char *data, Eina_Xattr_Flags flags)
| Sets a string as a extended attribute properties.
EINA_API char * | eina_xattr_string_get (const char *file, const char *attribute)
| Gets a string from an extended attribute properties.
EINA_API Eina_Bool | eina_xattr_double_set (const char *file, const char *attribute, double value, Eina_Xattr_Flags flags)
| Sets a double as a extended attribute properties.
EINA_API Eina_Bool | eina_xattr_double_get (const char *file, const char *attribute, double *value)
| Gets a double from an extended attribute properties.
EINA_API Eina_Bool | eina_xattr_int_set (const char *file, const char *attribute, int value, Eina_Xattr_Flags flags)
| Sets an int as a extended attribute properties.
EINA_API Eina_Bool | eina_xattr_int_get (const char *file, const char *attribute, int *value)
| Gets a int from an extended attribute properties.

## Detailed Description

Extended Attributes handling.

## Enumeration Type Documentation

## ◆ Eina_Xattr_Flags

enum Eina_Xattr_Flags

define extended attribute creation

Since
  1.1

Enumerator
EINA_XATTR_INSERT | This is the default behavior, it will either create or replace the extended attribute.
EINA_XATTR_REPLACE | This will only succeed if the extended attribute previously existed.
EINA_XATTR_CREATED | This will only succeed if the extended attribute wasn't previously set.
EINA_XATTR_FLAGS_INSERT | This is the default behavior, it will either create or replace the extended attribute.
EINA_XATTR_FLAGS_REPLACE | This will only succeed if the extended attribute previously existed.
EINA_XATTR_FLAGS_CREATED | This will only succeed if the extended attribute wasn't previously set.

## Function Documentation

## ◆ eina_xattr_ls()

EINA_API Eina_Iterator * eina_xattr_ls | ( | const char * | file | ) |

Gets an iterator that lists all extended attribute of a file.

Parameters

  [in] | file | The filename to retrieve the extended attribute list from.

Returns
  an iterator.

The iterator will not allocate any data during the iteration step, so you need to copy them yourself if you need.

Since
  1.1

References EINA_MAGIC_SET, EINA_SAFETY_ON_NULL_RETURN_VAL, FUNC_ITERATOR_FREE, FUNC_ITERATOR_GET_CONTAINER, and FUNC_ITERATOR_NEXT.

## ◆ eina_xattr_value_ls()

EINA_API Eina_Iterator * eina_xattr_value_ls | ( | const char * | file | ) |

Gets an iterator that list all extended attribute value related to a fd.

Parameters

  [in] | file | The filename to retrieve the extended attribute list from.

Returns
  An iterator.

The iterator will not allocate any data during the iteration step, so you need to copy them yourself if you need. The iterator will provide an Eina_Xattr structure.

Since
  1.2

References EINA_MAGIC_SET, EINA_SAFETY_ON_NULL_RETURN_VAL, eina_stringshare_add(), FUNC_ITERATOR_FREE, FUNC_ITERATOR_GET_CONTAINER, and FUNC_ITERATOR_NEXT.

## ◆ eina_xattr_fd_ls()

EINA_API Eina_Iterator * eina_xattr_fd_ls | ( | int | fd | ) |

Gets an iterator that list all extended attribute related to a fd.

Parameters

  [in] | fd | The file descriptor to retrieve the extended attribute list from.

Returns
  an iterator.

The iterator will not allocate any data during the iteration step, so you need to copy them yourself if you need.

Since
  1.2

References EINA_MAGIC_SET, FUNC_ITERATOR_FREE, FUNC_ITERATOR_GET_CONTAINER, and FUNC_ITERATOR_NEXT.

Referenced by eina_file_xattr_get().

## ◆ eina_xattr_value_fd_ls()

EINA_API Eina_Iterator * eina_xattr_value_fd_ls | ( | int | fd | ) |

Gets an iterator that list all extended attribute value related to a fd.

Parameters

  [in] | fd | The file descriptor to retrieve the extended attribute list from.

Returns
  An iterator.

The iterator will not allocate any data during the iteration step, so you need to copy them yourself if you need. The iterator will provide an Eina_Xattr structure.

Since
  1.2

References EINA_MAGIC_SET, FUNC_ITERATOR_FREE, FUNC_ITERATOR_GET_CONTAINER, and FUNC_ITERATOR_NEXT.

Referenced by eina_file_xattr_value_get().

## ◆ eina_xattr_copy()

EINA_API Eina_Bool eina_xattr_copy | ( | const char * | src,
|  | const char * | dst
| ) |  |

Copies the extended attribute from one file to another.

Parameters

  [in] | src | source file to use as input.
  [in] | dst | destination file to use as output.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

See also
  eina_xattr_fd_copy()

Since
  1.8

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_GOTO, and eina_xattr_fd_copy().

## ◆ eina_xattr_fd_copy()

EINA_API Eina_Bool eina_xattr_fd_copy | ( | int | src,
|  | int | dst
| ) |  |

Copies the extended attribute from one file descriptor to another.

Parameters

  [in] | src | source file descriptor to use as input.
  [in] | dst | destination file descriptor to use as output.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

See also
  eina_xattr_copy()

Since
  1.8

References EINA_FALSE, EINA_SAFETY_ON_NULL_GOTO, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_GOTO, EINA_SAFETY_ON_TRUE_RETURN_VAL, and EINA_TRUE.

Referenced by eina_file_copy(), and eina_xattr_copy().

## ◆ eina_xattr_get()

EINA_API void * eina_xattr_get | ( | const char * | file,
|  | const char * | attribute,
|  | ssize_t * | size
| ) |  |

Retrieves an extended attribute from a file.

Parameters

  [in] | file | The file to retrieve the extended attribute from.
  [in] | attribute | The extended attribute name to retrieve.
  [out] | size | The size of the retrieved extended attribute.

Returns
  the allocated data that hold the extended attribute value.

It will return `NULL` and *size will be `0` if it fails.

Since
  1.1

References EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_SAFETY_ON_TRUE_RETURN_VAL.

Referenced by eet_data_xattr_cipher_get(), and eina_xattr_string_get().

## ◆ eina_xattr_fd_get()

EINA_API void * eina_xattr_fd_get | ( | int | fd,
|  | const char * | attribute,
|  | ssize_t * | size
| ) |  |

Retrieves an extended attribute from a file descriptor.

Parameters

  [in] | fd | The file descriptor to retrieve the extended attribute from.
  [in] | attribute | The extended attribute name to retrieve.
  [out] | size | The size of the retrieved extended attribute.

Returns
  the allocated data that hold the extended attribute value.

It will return `NULL` and *size will be `0` if it fails.

Since
  1.8

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eina_xattr_set()

EINA_API Eina_Bool eina_xattr_set | ( | const char * | file,
|  | const char * | attribute,
|  | const void * | data,
|  | ssize_t | length,
|  | Eina_Xattr_Flags | flags
| ) |  |

Sets an extended attribute on a file.

Parameters

  [in] | file | The file to set the extended attribute to.
  [in] | attribute | The attribute to set.
  [in] | data | The data to set.
  [in] | length | The length of the data to set.
  [in] | flags | Define the set policy.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.1

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, EINA_TRUE, EINA_XATTR_CREATED, EINA_XATTR_INSERT, and EINA_XATTR_REPLACE.

Referenced by eet_data_xattr_cipher_set(), and eina_xattr_string_set().

## ◆ eina_xattr_fd_set()

EINA_API Eina_Bool eina_xattr_fd_set | ( | int | fd,
|  | const char * | attribute,
|  | const void * | data,
|  | ssize_t | length,
|  | Eina_Xattr_Flags | flags
| ) |  |

Sets an extended attribute on a file descriptor.

Parameters

  [in] | fd | The file descriptor to set the extended attribute to.
  [in] | attribute | The attribute to set.
  [in] | data | The data to set.
  [in] | length | The length of the data to set.
  [in] | flags | Define the set policy.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.8

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, EINA_TRUE, EINA_XATTR_CREATED, EINA_XATTR_INSERT, and EINA_XATTR_REPLACE.

## ◆ eina_xattr_del()

EINA_API Eina_Bool eina_xattr_del | ( | const char * | file,
|  | const char * | attribute
| ) |  |

Deletes (removes) an extended attribute from a file.

Parameters

  [in] | file | The file to del the extended attribute from.
  [in] | attribute | The attribute to del.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.8

References EINA_FALSE, and EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eina_xattr_fd_del()

EINA_API Eina_Bool eina_xattr_fd_del | ( | int | fd,
|  | const char * | attribute
| ) |  |

Deletes (removes) an extended attribute from a file descriptor.

Parameters

  [in] | fd | The file descriptor to del the extended attribute from.
  [in] | attribute | The attribute to del.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.8

References EINA_FALSE, and EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eina_xattr_string_set()

EINA_API Eina_Bool eina_xattr_string_set | ( | const char * | file,
|  | const char * | attribute,
|  | const char * | data,
|  | Eina_Xattr_Flags | flags
| ) |  |

Sets a string as a extended attribute properties.

Parameters

  [in] | file | The file to set the string to.
  [in] | attribute | The attribute to set.
  [in] | data | The NULL-terminated string to set.
  [in] | flags | Define the set policy.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.1

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and eina_xattr_set().

Referenced by eina_xattr_double_set(), and eina_xattr_int_set().

## ◆ eina_xattr_string_get()

EINA_API char * eina_xattr_string_get | ( | const char * | file,
|  | const char * | attribute
| ) |  |

Gets a string from an extended attribute properties.

Parameters

  [in] | file | The file to get the string from.
  [in] | attribute | The attribute to get.

Returns
  A valid string on success, `NULL` otherwise.

This call check that the string is properly NULL-terminated before returning it.

Since
  1.1

References eina_xattr_get().

Referenced by eina_xattr_double_get(), and eina_xattr_int_get().

## ◆ eina_xattr_double_set()

EINA_API Eina_Bool eina_xattr_double_set | ( | const char * | file,
|  | const char * | attribute,
|  | double | value,
|  | Eina_Xattr_Flags | flags
| ) |  |

Sets a double as a extended attribute properties.

Parameters

  [in] | file | The file to set the double to.
  [in] | attribute | The attribute to set.
  [in] | value | The NULL-terminated double to set.
  [in] | flags | Define the set policy.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.1

References eina_convert_dtoa(), and eina_xattr_string_set().

Referenced by emotion_object_last_position_save().

## ◆ eina_xattr_double_get()

EINA_API Eina_Bool eina_xattr_double_get | ( | const char * | file,
|  | const char * | attribute,
|  | double * | value
| ) |  |

Gets a double from an extended attribute properties.

Parameters

  [in] | file | The file to get the string from.
  [in] | attribute | The attribute to get.
  [out] | value | Where to put the extracted value

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

This call check that the double is correctly set.

Since
  1.1

References eina_convert_atod(), EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_TRUE, and eina_xattr_string_get().

Referenced by emotion_object_last_position_load().

## ◆ eina_xattr_int_set()

EINA_API Eina_Bool eina_xattr_int_set | ( | const char * | file,
|  | const char * | attribute,
|  | int | value,
|  | Eina_Xattr_Flags | flags
| ) |  |

Sets an int as a extended attribute properties.

Parameters

  [in] | file | The file to set the int to.
  [in] | attribute | The attribute to set.
  [in] | value | The NULL-terminated int to set.
  [in] | flags | Define the set policy.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

Since
  1.1

References eina_convert_itoa(), and eina_xattr_string_set().

## ◆ eina_xattr_int_get()

EINA_API Eina_Bool eina_xattr_int_get | ( | const char * | file,
|  | const char * | attribute,
|  | int * | value
| ) |  |

Gets a int from an extended attribute properties.

Parameters

  [in] | file | The file to get the string from.
  [in] | attribute | The attribute to get.
  [out] | value | Where to put the extracted value

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

This call check that the int is correctly set.

Since
  1.1

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and eina_xattr_string_get().