Add libbtrfsutil
[platform/upstream/btrfs-progs.git] / libbtrfsutil / README.md
1 libbtrfsutil
2 ============
3
4 libbtrfsutil is a library for managing Btrfs filesystems. It is licensed under
5 the LGPL. libbtrfsutil provides interfaces for a subset of the operations
6 offered by the `btrfs` command line utility.
7
8 Development
9 -----------
10
11 The [development process for btrfs-progs](../README.md#development) applies.
12
13 libbtrfsutil only includes operations that are done through the filesystem and
14 ioctl interface, not operations that modify the filesystem directly (e.g., mkfs
15 or fsck). This is by design but also a legal necessity, as the filesystem
16 implementation is GPL but libbtrfsutil is LGPL. That is also why the
17 libbtrfsutil code is a reimplementation of the btrfs-progs code rather than a
18 refactoring. Be wary of this when porting functionality.
19
20 libbtrfsutil is semantically versioned separately from btrfs-progs. It is the
21 maintainers' responsibility to bump the version as needed (at most once per
22 release of btrfs-progs).
23
24 A few guidelines:
25
26 * All interfaces must be documented in `btrfsutil.h` using the kernel-doc style
27 * Error codes should be specific about what _exactly_ failed
28 * Functions should have a path and an fd variant whenever possible
29 * Spell out terms in function names, etc. rather than abbreviating whenever
30   possible
31 * Don't require the Btrfs UAPI headers for any interfaces (e.g., instead of
32   directly exposing a type from `linux/btrfs_tree.h`, abstract it away in a
33   type specific to `libbtrfsutil`)
34 * Preserve API and ABI compatability at all times (i.e., we don't want to bump
35   the library major version if we don't have to)