1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! # extattr
//! [](https://cirrus-ci.com/github/SteveLauC/extattr)
//! [](https://crates.io/crates/extattr)
//! [](https://docs.rs/extattr)
//!
//! Yet another Extended Attributes library for Rust.
//!
//! ## Why another crate for EA? Any difference from [`xattr`](https://crates.io/crates/xattr)?
//!
//! Extended Attributes syscalls vary across implementations, for example, to set an EA:
//!
//! ```c
//! // Linux
//! int setxattr(const char *path, const char *name, const void *value,
//! size_t size, int flags);
//!
//! // FreeBSD
//! ssize_t extattr_set_file(const char *path, int attrnamespace,
//! const char *attrname, const void *data, size_t nbytes);
//!
//! // macOS
//! int setxattr(const char *path, const char *name, void *value, size_t size,
//! u_int32_t position, int options);
//! ```
//!
//! `xattr` erases differences in those APIs and provides a consistent, rusty
//! interface.
//!
//! ```ignore
//! // A consistent API that would work on every OS
//! pub fn set<N, P>(path: P, name: N, value: &[u8]) -> Result<()>
//! ```
//!
//! `extattr` aims to provide bindings close to the native one.
//!
//! ```ignore
//! // Linux
//! pub fn setxattr<P, S, B>(
//! path: P,
//! name: S,
//! value: B,
//! flags: Flags,
//! ) -> Result<()>
//!
//! // FreeBSD
//! pub fn extattr_set_file<P, S, B>(
//! path: P,
//! attrnamespace: AttrNamespace,
//! attrname: S,
//! data: B
//! ) -> Result<()>
//!
//! // macOS
//! pub fn setxattr<P, S, B>(
//! path: P,
//! name: S,
//! value: B,
//! position: u32,
//! options: Options
//! ) -> Result<()>
//! ```
//!
//! In most cases, you would like to use `xattr` instead of `extattr`. However, if
//! you are on Linux and want to use that extra `flags` argument, or you are on macOS
//! and want to use the arguments `position` and `options`, then `extattr` probably
//! is a good choice:)
use Errno;
/// Customized `Result` type for `extattr`.
pub type Result<T> = Result;
// Platform-dependent re-export
pub use *;
pub use *;
pub use *;
pub use *;