let mut reader = std::io::BufReader::new(file);
- let no_xattrs = true;
- let no_fcaps = true;
- let mut decoder = pxar::SequentialDecoder::new(&mut reader, no_xattrs, no_fcaps);
+ let mut feature_flags = pxar::CA_FORMAT_DEFAULT;
+ feature_flags ^= pxar::CA_FORMAT_WITH_XATTRS;
+ feature_flags ^= pxar::CA_FORMAT_WITH_FCAPS;
+ let mut decoder = pxar::SequentialDecoder::new(&mut reader, feature_flags);
let stdout = std::io::stdout();
let mut out = stdout.lock();
let mut reader = std::io::BufReader::new(file);
- let no_xattrs = true;
- let no_fcaps = true;
- let mut decoder = pxar::SequentialDecoder::new(&mut reader, no_xattrs, no_fcaps);
+ let mut feature_flags = pxar::CA_FORMAT_DEFAULT;
+ feature_flags ^= pxar::CA_FORMAT_WITH_XATTRS;
+ feature_flags ^= pxar::CA_FORMAT_WITH_FCAPS;
+ let mut decoder = pxar::SequentialDecoder::new(&mut reader, feature_flags);
let stdout = std::io::stdout();
let mut out = stdout.lock();
let file = std::fs::File::open(archive)?;
let mut reader = std::io::BufReader::new(file);
+ let mut feature_flags = pxar::CA_FORMAT_DEFAULT;
+ if no_xattrs {
+ feature_flags ^= pxar::CA_FORMAT_WITH_XATTRS;
+ }
+ if no_fcaps {
+ feature_flags ^= pxar::CA_FORMAT_WITH_FCAPS;
+ }
- let mut decoder = pxar::SequentialDecoder::new(&mut reader, no_xattrs, no_fcaps);
+ let mut decoder = pxar::SequentialDecoder::new(&mut reader, feature_flags);
decoder.restore(Path::new(target), & |path| {
if verbose {
.open(archive)?;
let mut writer = std::io::BufWriter::with_capacity(1024*1024, file);
-
- pxar::Encoder::encode(source, &mut dir, &mut writer, all_file_systems, verbose, no_xattrs, no_fcaps)?;
+ let mut feature_flags = pxar::CA_FORMAT_DEFAULT;
+ if no_xattrs {
+ feature_flags ^= pxar::CA_FORMAT_WITH_XATTRS;
+ }
+ if no_fcaps {
+ feature_flags ^= pxar::CA_FORMAT_WITH_FCAPS;
+ }
+
+ pxar::Encoder::encode(source, &mut dir, &mut writer, all_file_systems, verbose, feature_flags)?;
writer.flush()?;
let child = thread::spawn(move|| {
let mut writer = unsafe { std::fs::File::from_raw_fd(tx) };
- let no_xattrs = false;
- let no_fcaps = false;
- if let Err(err) = pxar::Encoder::encode(path, &mut dir, &mut writer, all_file_systems, verbose, no_xattrs, no_fcaps) {
+ if let Err(err) = pxar::Encoder::encode(path, &mut dir, &mut writer, all_file_systems, verbose, pxar::CA_FORMAT_DEFAULT) {
eprintln!("pxar encode failed - {}", err);
}
});
let child = thread::spawn(move|| {
let mut reader = unsafe { std::fs::File::from_raw_fd(rx) };
- let no_xattrs = false;
- let no_fcaps = false;
- let mut decoder = pxar::SequentialDecoder::new(&mut reader, no_xattrs, no_fcaps);
+ let mut decoder = pxar::SequentialDecoder::new(&mut reader, pxar::CA_FORMAT_DEFAULT);
if let Err(err) = decoder.restore(&base, & |path| {
if verbose {
pub fn new(reader: &'a mut R) -> Result<Self, Error> {
let root_end = reader.seek(SeekFrom::End(0))?;
- let no_xattrs = false;
- let no_fcaps = false;
Ok(Self {
- inner: SequentialDecoder::new(reader, no_xattrs, no_fcaps),
+ inner: SequentialDecoder::new(reader, CA_FORMAT_DEFAULT),
root_start: 0,
root_end: root_end,
})
writer: &'a mut W,
all_file_systems: bool,
verbose: bool,
- no_xattrs: bool,
- no_fcaps: bool,
+ feature_flags: u64,
) -> Result<(), Error> {
const FILE_COPY_BUFFER_SIZE: usize = 1024*1024;
if is_virtual_file_system(magic) {
bail!("backup virtual file systems is disabled!");
}
- let mut feature_flags = CA_FORMAT_DEFAULT;
- if no_xattrs {
- feature_flags ^= CA_FORMAT_WITH_XATTRS;
- }
- if no_fcaps {
- feature_flags ^= CA_FORMAT_WITH_FCAPS;
- }
let mut me = Self {
base_path: path,
impl <'a, R: Read> SequentialDecoder<'a, R> {
- pub fn new(reader: &'a mut R, no_xattrs: bool, no_fcaps: bool) -> Self {
+ pub fn new(reader: &'a mut R, feature_flags: u64) -> Self {
let skip_buffer = vec::undefined(64*1024);
- let mut feature_flags = CA_FORMAT_DEFAULT;
- if no_xattrs {
- feature_flags ^= CA_FORMAT_WITH_XATTRS;
- }
- if no_fcaps {
- feature_flags ^= CA_FORMAT_WITH_FCAPS;
- }
Self {
reader,
let path = std::path::PathBuf::from(dir_name);
- Encoder::encode(path, &mut dir, &mut writer, false, false, false, false)?;
+ Encoder::encode(path, &mut dir, &mut writer, false, false, CA_FORMAT_DEFAULT)?;
Command::new("cmp")
.arg("--verbose")