libbtrfs 0.0.20

Rust library for working with the btrfs filesystem
Documentation
#![allow(missing_docs)]
use crate::bindings;
use bitflags::bitflags;
use std::ops::{BitAnd, Shr};

bitflags! {
    /// Flag options for all funtions in the library
    ///
    /// This struct contains flags that are used by all funtions in the library. If a flag is
    /// provied that is not documented by a particular function then that flag is ignored.
    ///
    pub struct Opt: u64 {

        /*============= Subvolume Iterator Flags [2:0] =============*/

        const ASCENDING = 0;
        const DESCENDING = 1;
        const GET_INFO = 2;
        const GET_PATH = 4;

        /*============= Fs Info Flags [5:3] ========================*/

        const CSUM_INFO = bindings::BTRFS_FS_INFO_FLAG_CSUM_INFO << 3;
        const GENERATION = bindings::BTRFS_FS_INFO_FLAG_GENERATION << 3;
        const METADATA_UUID = bindings::BTRFS_FS_INFO_FLAG_METADATA_UUID << 3;
    }
}

impl Opt {
    pub(crate) fn fs_info_flags(self) -> u64 {
        self.bitand(Opt::CSUM_INFO | Opt::GENERATION | Opt::METADATA_UUID)
            .bits()
            .shr(3)
    }
}