On 10/15/2016 04:31 PM, James Pharaoh wrote: > > I have created a BTRFS library for Rust - very incomplete so far, but > possibly of interest to someone. Nice work, I'm doing the same for python. Just picked up working on it again, after summer: https://github.com/knorrie/python-btrfs > https://gitlab.wellbehavedsoftware.com/well-behaved-software/rust-btrfs > > I've basically reimplemented what I find in other tools because, as far > as I can tell, there is no C library for BTRFS at this point. For code operating on an online filesystem, using the IOCTLs, you don't really need a lot from btrfs-progs. You need to known about some structs and throw them back and forth to the kernel. And not being afraid of doing some reverse engineering helps. :o) The btrfs-progs programs operate in two ways: 1. Using the IOCTLs, implementing a command/args input model and converting the output back to text on the console. 2. Also directly doing low-level plumbing, reading and writing inside unmounted btrfs filesystems. For this, there's a copy of a bunch of code from the kernel, to be able to read/write a filesystem that is not mounted from the running program, in a similar way that kernel does when it's live. If you don't plan to write your own btrfs check --repair, this is also not what you need to import as a library. This might be interesting: https://patchwork.kernel.org/patch/9356749/ But, I'm not the C expert here, this is what I know. > The currently supported functions are: > > - Deduplication > - File system info > - Space info Is there a specific use case you're building this for? My primary trigger to start on it is best described as: "Tired of parsing the output of btrfs <foo> <bar>? Try this!" Also, if you're using IRC, #btrfs on freenode is a good place to hang out. Have fun, -- Hans van Kranenburg -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
