#[cfg(test)]
use std::cmp::Ordering;
#[cfg(test)]
use std::ptr;
#[cfg(test)]
use libc::strlen;
use reverie::syscalls::Errno;
use serde::Deserialize;
use serde::Serialize;
use crate::procfs_inode::DirectoryInodes;
use crate::tool_global::SnapshotMark;
#[cfg(test)]
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct Dirent64<'a> {
pub(crate) ino: u64,
pub(crate) off: i64,
pub(crate) ty: u8,
pub(crate) reclen: u16,
pub(crate) name: &'a [u8],
}
#[cfg(test)]
#[allow(clippy::non_canonical_partial_ord_impl)]
impl<'a> PartialOrd for Dirent64<'a> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
if self.name == b".\0" {
Some(Ordering::Less)
} else if other.name == b".\0" {
Some(Ordering::Greater)
} else if self.name == b"..\0" {
Some(Ordering::Less)
} else if other.name == b"..\0" {
Some(Ordering::Greater)
} else {
self.name.partial_cmp(other.name)
}
}
}
#[cfg(test)]
impl<'a> Ord for Dirent64<'a> {
fn cmp(&self, other: &Self) -> Ordering {
self.partial_cmp(other).unwrap()
}
}
#[cfg(test)]
pub unsafe fn deserialize_dirents64(bytes: &[u8]) -> Vec<Dirent64<'_>> {
unsafe {
let mut res = Vec::new();
let dirp: *const u8 = bytes.as_ptr();
let nb = bytes.len();
let mut k = 0;
while k < nb as isize {
let dirp = dirp.offset(k);
let mut j: isize = 0;
let ino = ptr::read(dirp.offset(j).cast::<u64>());
j += std::mem::size_of::<u64>() as isize;
let off = ptr::read(dirp.offset(j).cast::<i64>());
j += std::mem::size_of::<i64>() as isize;
let reclen = ptr::read(dirp.offset(j).cast::<u16>());
j += std::mem::size_of::<u16>() as isize;
let ty = ptr::read(dirp.offset(j).cast::<u8>());
j += std::mem::size_of::<u8>() as isize;
let name = std::slice::from_raw_parts(dirp.offset(j), 1 + reclen as usize - j as usize);
let ent = Dirent64 {
ino,
off,
reclen,
ty,
name,
};
res.push(ent);
k += reclen as isize;
}
res
}
}
#[cfg(test)]
pub unsafe fn serialize_dirents64(dents: &[Dirent64], bytes: &mut [u8]) -> usize {
unsafe {
let nb = bytes.len();
let mut k = 0;
let mut i = 0;
while k < nb as isize && i < dents.len() {
let ent = &dents[i];
let dirp = bytes.as_mut_ptr().offset(k);
let mut j: isize = 0;
ptr::write(dirp.offset(j).cast::<u64>(), ent.ino);
j += std::mem::size_of::<u64>() as isize;
ptr::write(dirp.offset(j).cast::<i64>(), ent.off);
j += std::mem::size_of::<i64>() as isize;
ptr::write(dirp.offset(j).cast::<u16>(), ent.reclen);
j += std::mem::size_of::<u16>() as isize;
ptr::write(dirp.offset(j).cast::<u8>(), ent.ty);
j += std::mem::size_of::<u8>() as isize;
let reclen = ent.reclen;
ptr::copy_nonoverlapping(
ent.name.as_ptr(),
dirp.offset(j),
strlen(ent.name.as_ptr() as *const i8),
);
k += reclen as isize;
i += 1;
}
dents.len()
}
}
#[cfg(test)]
pub unsafe fn deserialize_dirents(bytes: &[u8]) -> Vec<Dirent64<'_>> {
unsafe {
let mut res = Vec::new();
let dirp: *const u8 = bytes.as_ptr();
let nb = bytes.len();
let mut k = 0;
while k < nb as isize {
let dirp = dirp.offset(k);
let mut j: isize = 0;
let ino = ptr::read(dirp.offset(j).cast::<u64>());
j += std::mem::size_of::<u64>() as isize;
let off = ptr::read(dirp.offset(j).cast::<i64>());
j += std::mem::size_of::<i64>() as isize;
let reclen = ptr::read(dirp.offset(j).cast::<u16>());
j += std::mem::size_of::<u16>() as isize;
let name = std::slice::from_raw_parts(dirp.offset(j), reclen as usize - j as usize);
j = reclen as isize - 1;
let ty = ptr::read(dirp.offset(j).cast::<u8>());
let ent = Dirent64 {
ino,
off,
reclen,
ty,
name,
};
res.push(ent);
k += reclen as isize;
}
res
}
}
#[cfg(test)]
pub unsafe fn serialize_dirents(dents: &[Dirent64], bytes: &mut [u8]) -> usize {
unsafe {
let nb = bytes.len();
let mut k = 0;
let mut i = 0;
while k < nb as isize && i < dents.len() {
let ent = &dents[i];
let dirp = bytes.as_mut_ptr().offset(k);
let mut j: isize = 0;
ptr::write(dirp.offset(j).cast::<u64>(), ent.ino);
j += std::mem::size_of::<u64>() as isize;
ptr::write(dirp.offset(j).cast::<i64>(), ent.off);
j += std::mem::size_of::<i64>() as isize;
ptr::write(dirp.offset(j).cast::<u16>(), ent.reclen);
j += std::mem::size_of::<u16>() as isize;
let reclen = ent.reclen;
ptr::copy_nonoverlapping(
ent.name.as_ptr(),
dirp.offset(j),
strlen(ent.name.as_ptr() as *const i8),
);
j = reclen as isize - 1;
ptr::write(dirp.offset(j).cast::<u8>(), ent.ty);
k += reclen as isize;
i += 1;
}
dents.len()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum DirentFormat {
Dirent64,
Legacy,
}
impl DirentFormat {
pub(crate) fn name_offset(self) -> usize {
match self {
Self::Dirent64 => 19,
Self::Legacy => 18,
}
}
pub(crate) fn record_len(self, name_len: usize) -> usize {
let trailer = match self {
Self::Dirent64 => 1,
Self::Legacy => 2,
};
(self.name_offset() + name_len + trailer + 7) & !7
}
pub(crate) fn type_offset(self, reclen: usize) -> usize {
match self {
Self::Dirent64 => 18,
Self::Legacy => reclen - 1,
}
}
pub(crate) fn written_len(self, name_len: usize) -> usize {
match self {
Self::Dirent64 => self.name_offset() + name_len + 1,
Self::Legacy => self.record_len(name_len),
}
}
pub(crate) fn parse(self, bytes: &[u8]) -> Result<Vec<DirEntry>, Errno> {
let mut entries = Vec::new();
let mut at = 0;
while at < bytes.len() {
let record = &bytes[at..];
if record.len() < self.name_offset() {
return Err(Errno::EIO);
}
let ino = u64::from_ne_bytes(record[0..8].try_into().unwrap());
let off = i64::from_ne_bytes(record[8..16].try_into().unwrap());
let reclen = usize::from(u16::from_ne_bytes(record[16..18].try_into().unwrap()));
if reclen <= self.name_offset() || reclen > record.len() {
return Err(Errno::EIO);
}
let (name_field, ty) = match self {
Self::Dirent64 => (&record[self.name_offset()..reclen], record[18]),
Self::Legacy => (&record[self.name_offset()..reclen - 1], record[reclen - 1]),
};
let name_len = name_field
.iter()
.position(|&byte| byte == 0)
.ok_or(Errno::EIO)?;
entries.push(DirEntry {
name: name_field[..name_len].to_vec(),
ino,
off,
ty,
});
at += reclen;
}
Ok(entries)
}
pub(crate) fn parse_written(
self,
bytes: &mut [u8],
readable: usize,
) -> Result<Vec<DirEntry>, Errno> {
let len = bytes.len();
if readable >= len {
return self.parse(bytes);
}
bytes[readable..].fill(0);
let entries = self.parse(bytes).map_err(|_| Errno::EFAULT)?;
let mut last = 0;
for _ in 1..entries.len() {
last += usize::from(u16::from_ne_bytes([bytes[last + 16], bytes[last + 17]]));
}
let reclen = len - last;
match entries.last() {
Some(entry)
if reclen == self.record_len(entry.name.len())
&& last + self.written_len(entry.name.len()) <= readable =>
{
Ok(entries)
}
_ => Err(Errno::EFAULT),
}
}
pub(crate) fn encode(self, entry: &DirEntry, ino: u64, off: i64, out: &mut Vec<u8>) {
let reclen = self.record_len(entry.name.len());
let start = out.len();
out.resize(start + reclen, 0);
let record = &mut out[start..];
record[0..8].copy_from_slice(&ino.to_ne_bytes());
record[8..16].copy_from_slice(&off.to_ne_bytes());
record[16..18].copy_from_slice(&(reclen as u16).to_ne_bytes());
let name_offset = self.name_offset();
record[name_offset..name_offset + entry.name.len()].copy_from_slice(&entry.name);
record[self.type_offset(reclen)] = entry.ty;
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub(crate) struct DirEntry {
pub(crate) name: Vec<u8>,
pub(crate) ino: u64,
pub(crate) off: i64,
pub(crate) ty: u8,
}
pub(crate) fn sort_dir_entries(entries: &mut [DirEntry]) {
entries.sort_by(compare_dir_entries);
}
fn compare_dir_entries(a: &DirEntry, b: &DirEntry) -> std::cmp::Ordering {
fn rank(name: &[u8]) -> u8 {
match name {
b"." => 0,
b".." => 1,
_ => 2,
}
}
rank(&a.name)
.cmp(&rank(&b.name))
.then_with(|| a.name.cmp(&b.name))
}
#[derive(Debug, Clone, Copy)]
pub(crate) enum DirectoryOrder {
NameBytes,
ProcfsIds,
}
impl DirectoryOrder {
fn compare(self, a: &DirEntry, b: &DirEntry) -> std::cmp::Ordering {
match self {
Self::NameBytes => compare_dir_entries(a, b),
Self::ProcfsIds => {
fn key(name: &[u8]) -> (u8, i32, &[u8]) {
match name {
b"." => (0, 0, name),
b".." => (1, 0, name),
_ => {
let id = (name.first().is_some_and(|byte| *byte != b'0')
&& name.iter().all(u8::is_ascii_digit))
.then(|| std::str::from_utf8(name).ok()?.parse::<i32>().ok())
.flatten()
.filter(|id| *id > 0);
match id {
Some(id) => (2, id, name),
None => (3, 0, name),
}
}
}
}
key(&a.name).cmp(&key(&b.name))
}
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub(crate) struct DirectoryStream {
entries: Option<Vec<DirEntry>>,
resume: Vec<i64>,
position: u64,
snapshot: SnapshotMark,
inodes: Option<DirectoryInodes>,
}
impl DirectoryStream {
pub(crate) fn note_snapshot_mark(&mut self, mark: SnapshotMark) {
self.snapshot = mark;
}
pub(crate) fn snapshot_mark(&self) -> SnapshotMark {
self.snapshot
}
pub(crate) fn note_snapshot_inodes(&mut self, inodes: DirectoryInodes) {
self.inodes = Some(inodes);
}
pub(crate) fn snapshot_inodes(&self) -> Option<DirectoryInodes> {
self.inodes.clone()
}
pub(crate) fn needs_snapshot(&self) -> bool {
self.entries.is_none()
}
pub(crate) fn install(&mut self, entries: Vec<DirEntry>, order: DirectoryOrder) {
let host_offsets: Vec<i64> = entries.iter().map(|entry| entry.off).collect();
let mut indexed: Vec<(usize, DirEntry)> = entries.into_iter().enumerate().collect();
indexed.sort_by(|(_, a), (_, b)| order.compare(a, b));
let end = host_offsets.last().copied().unwrap_or(0);
let mut resume = vec![end; indexed.len() + 1];
let mut earliest = usize::MAX;
for (position, (host_index, _)) in indexed.iter().enumerate().rev() {
earliest = earliest.min(*host_index);
resume[position] = match earliest {
0 => 0,
index => host_offsets[index - 1],
};
}
self.entries = Some(indexed.into_iter().map(|(_, entry)| entry).collect());
self.resume = resume;
}
pub(crate) fn position(&self) -> u64 {
self.position
}
pub(crate) fn seek(&mut self, position: u64) {
if position == 0 {
self.entries = None;
self.resume = Vec::new();
}
self.position = position;
}
pub(crate) fn advance(&mut self, count: usize) {
self.position = self.position.saturating_add(count as u64);
}
pub(crate) fn kernel_target(&self) -> i64 {
match &self.entries {
None => 0,
Some(entries) => {
let position = usize::try_from(self.position)
.unwrap_or(usize::MAX)
.min(entries.len());
self.resume.get(position).copied().unwrap_or(0)
}
}
}
pub(crate) fn next_batch(
&self,
format: DirentFormat,
capacity: usize,
) -> Result<Vec<DirEntry>, Errno> {
let entries = self
.entries
.as_deref()
.expect("directory stream served before its snapshot was taken");
let start = usize::try_from(self.position).unwrap_or(usize::MAX);
let mut used = 0;
let mut batch = Vec::new();
for entry in entries.iter().skip(start) {
let reclen = format.record_len(entry.name.len());
if used + reclen > capacity {
break;
}
used += reclen;
batch.push(entry.clone());
}
if batch.is_empty() && start < entries.len() {
return Err(Errno::EINVAL);
}
Ok(batch)
}
}
#[cfg(test)]
mod test {
use super::*;
#[repr(align(8))]
struct Aligned<T>(T);
const HOME_DIRENTS: &[u8] = &Aligned([
0xf2, 0x5b, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1f, 0x11, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x2e, 0x2e, 0x00,
0x00, 0x00, 0x04, 0x54, 0x5c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x55, 0x5c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6c, 0x6f, 0x67, 0x73, 0x00, 0x0a, 0x58,
0x5c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x28, 0x00, 0x52, 0x45, 0x41, 0x44, 0x4d, 0x45, 0x2d, 0x64, 0x6f, 0x74, 0x73, 0x79, 0x6e,
0x63, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x0a, 0x62, 0x5c, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2e, 0x6c, 0x6f,
0x67, 0x69, 0x6e, 0x6f, 0x75, 0x74, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x37, 0x5d, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x2e, 0x73, 0x73, 0x68, 0x00, 0x04, 0x38, 0x5d,
0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x2e, 0x73, 0x63, 0x6d, 0x2e, 0x73, 0x71, 0x6c, 0x69, 0x74, 0x65, 0x00, 0x00, 0x08,
0x13, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x28, 0x00, 0x2e, 0x64, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2d, 0x6d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x08, 0xab, 0x5e, 0x79, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x62,
0x61, 0x73, 0x68, 0x5f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x00, 0x08, 0xad, 0x5e, 0x79,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00,
0x2e, 0x62, 0x61, 0x73, 0x68, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xb1, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xb8, 0x5e, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x65, 0x6d,
0x61, 0x63, 0x73, 0x2e, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xba, 0x5e, 0x79, 0x00,
0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e,
0x68, 0x67, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xbc, 0x5e,
0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x2e, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0xbe, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0xc0, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x73, 0x75, 0x62, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x00, 0x00, 0x04, 0xca, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x74, 0x6d, 0x75, 0x78, 0x2e, 0x63, 0x6f,
0x6e, 0x66, 0x00, 0x00, 0x00, 0x08, 0xcc, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x2e, 0x76, 0x69, 0x6d, 0x00, 0x04,
0xcf, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x2e, 0x76, 0x69, 0x6d, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0xd1, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x7a, 0x73, 0x68, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0xd3, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x61, 0x72, 0x63, 0x72, 0x63, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xd7, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x67, 0x6e, 0x75, 0x70, 0x67,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1a, 0x62, 0x79, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x69, 0x74, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x00, 0x04, 0x79, 0x65, 0x79, 0x00, 0x00,
0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x66, 0x62,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x21, 0x6e, 0x79,
0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x75,
0xc0, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x2e, 0x62, 0x75, 0x63, 0x6b, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x00, 0x00, 0x00,
0x04, 0xc8, 0xc2, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x28, 0x00, 0x2e, 0x62, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x69, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3b, 0xc3, 0x79, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2e,
0x64, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2d, 0x67, 0x65, 0x74, 0x2d, 0x73, 0x75, 0x63,
0x63, 0x65, 0x73, 0x73, 0x00, 0x08, 0xa9, 0xc4, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2e, 0x76, 0x73, 0x63, 0x6f, 0x64,
0x65, 0x2d, 0x66, 0x62, 0x2d, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00,
0x04, 0xb9, 0xc4, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x28, 0x00, 0x2e, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x72, 0x65, 0x6d,
0x6f, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xdc, 0x82, 0x7d, 0x00,
0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2e,
0x76, 0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x66, 0x62, 0x2d, 0x69, 0x6e, 0x73, 0x69, 0x64,
0x65, 0x72, 0x73, 0x00, 0x00, 0x04, 0xdd, 0xb7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x67, 0x69, 0x74, 0x00, 0x00, 0x04,
0x5b, 0xd9, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x6e, 0x66, 0x73, 0x00, 0x00, 0x0a, 0x5c, 0xd9, 0x82, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x70, 0x75, 0x62,
0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x6d, 0xd9, 0x82, 0x00,
0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x74,
0x65, 0x73, 0x74, 0x00, 0x04, 0x4d, 0xe2, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x31, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa0, 0xbc, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x6c, 0x6f, 0x63, 0x61,
0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x16, 0xbe, 0x9c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x2e, 0x6c, 0x6f, 0x67, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x50, 0x14, 0x01,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x65,
0x78, 0x74, 0x34, 0x2e, 0x69, 0x6d, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x38, 0x50,
0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x31, 0x33, 0x00, 0x00, 0x00, 0x04, 0x3f, 0xc1, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x00,
0xb9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x74, 0x65, 0x73, 0x74, 0x2d,
0x31, 0x37, 0x33, 0x36, 0x35, 0x38, 0x32, 0x00, 0x08, 0x36, 0x3b, 0x2b, 0x01, 0x00, 0x00,
0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x74, 0x65, 0x73,
0x74, 0x2d, 0x31, 0x37, 0x34, 0x36, 0x37, 0x31, 0x33, 0x00, 0x08, 0x84, 0xd4, 0x2b, 0x01,
0x00, 0x00, 0x00, 0x00, 0xc9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e,
0x63, 0x61, 0x72, 0x67, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x88, 0xd4,
0x2b, 0x01, 0x00, 0x00, 0x00, 0x00, 0xca, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x2e, 0x7a, 0x73, 0x68, 0x65, 0x6e, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x89, 0xd4, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x2e, 0x72, 0x75, 0x73, 0x74, 0x75, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0xb6, 0x8e, 0x53, 0x01, 0x00, 0x00, 0x00, 0x00, 0x26, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x33, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x86, 0xbf, 0x53, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x61, 0x2e, 0x6f, 0x00, 0x00, 0x08, 0x20, 0xc5,
0x6a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x08,
0x34, 0xc5, 0x6a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x32, 0x32, 0x00, 0x00, 0x00, 0x04, 0xd1, 0x4b, 0x7d, 0x01, 0x00, 0x00,
0x00, 0x00, 0x7b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x66, 0x61, 0x6b,
0x65, 0x72, 0x6f, 0x6f, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x76, 0xb2, 0x9f, 0x01,
0x00, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x72,
0x70, 0x6d, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x4d, 0xb5,
0xa7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x00, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x31, 0x2e, 0x72, 0x70, 0x6d, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x78, 0xfe, 0xa7, 0x01, 0x00, 0x00, 0x00,
0x00, 0x96, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x73, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x64, 0x2e, 0x32, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x1b, 0x49, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x97, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x33,
0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x67, 0x8e,
0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x98, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x00, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x34, 0x2e, 0x72, 0x70, 0x6d, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0xdb, 0xa8, 0x01, 0x00, 0x00, 0x00,
0x00, 0x99, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x73, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x64, 0x2e, 0x35, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x38, 0x20, 0xa9, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x36,
0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc2, 0x82,
0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa7, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x00, 0x7a, 0x6c, 0x69, 0x62, 0x2d, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x2d, 0x31, 0x2e, 0x32,
0x2e, 0x31, 0x31, 0x2d, 0x31, 0x36, 0x2e, 0x65, 0x6c, 0x38, 0x5f, 0x32, 0x2e, 0x78, 0x38,
0x36, 0x5f, 0x36, 0x34, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0xe3, 0x82, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x00, 0x7a, 0x6c, 0x00, 0x00, 0x00, 0x04, 0xe5, 0xa3, 0xb0, 0x01,
0x00, 0x00, 0x00, 0x00, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e,
0x77, 0x67, 0x65, 0x74, 0x2d, 0x68, 0x73, 0x74, 0x73, 0x00, 0x00, 0x00, 0x08, 0xf2, 0xa4,
0xe2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x7a, 0x7a, 0x7a, 0x00, 0x00, 0x04, 0x27, 0x78, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00,
0x63, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6d, 0x31, 0x00, 0x00, 0x00,
0x04, 0x5b, 0x4b, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x64, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x00, 0x31, 0x32, 0x33, 0x00, 0x00, 0x04, 0xa9, 0x53, 0xe8, 0x01, 0x00,
0x00, 0x00, 0x00, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x73, 0x31,
0x32, 0x00, 0x00, 0x04, 0x22, 0xf8, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x22, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x68, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x55, 0x91, 0x69, 0x02, 0x00, 0x00, 0x00, 0x00, 0x0d,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x62, 0x61, 0x73, 0x68, 0x72,
0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xeb, 0x2d, 0xdf, 0x02, 0x00, 0x00, 0x00,
0x00, 0x7c, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x32, 0x2e, 0x74, 0x78,
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x64, 0x51, 0xfb, 0x02, 0x00,
0x00, 0x00, 0x00, 0xef, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x6e, 0x6f,
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x68, 0x00, 0x00, 0x00, 0x08, 0x08, 0x66, 0x19,
0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00,
0x2e, 0x62, 0x75, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x62,
0x61, 0x34, 0x64, 0x38, 0x63, 0x63, 0x31, 0x37, 0x35, 0x64, 0x39, 0x66, 0x37, 0x38, 0x38,
0x31, 0x35, 0x61, 0x31, 0x65, 0x39, 0x65, 0x33, 0x35, 0x66, 0x65, 0x64, 0x39, 0x65, 0x61,
0x63, 0x39, 0x37, 0x61, 0x63, 0x36, 0x35, 0x30, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0xf2, 0xca, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x25, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x00, 0x2e, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6d, 0x61, 0x6e, 0x61,
0x67, 0x65, 0x5f, 0x6d, 0x79, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x63, 0x61, 0x6e, 0x61, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x08, 0x43, 0x36, 0x3b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x77, 0x61, 0x69, 0x74, 0x34, 0x2d, 0x77,
0x61, 0x69, 0x74, 0x69, 0x64, 0x2d, 0x64, 0x65, 0x62, 0x75, 0x67, 0x00, 0x00, 0x00, 0x04,
0xe4, 0x61, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x31, 0x33, 0x31, 0x00, 0x00, 0x04, 0xc4, 0x01, 0x52, 0x03, 0x00, 0x00,
0x00, 0x00, 0xd1, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x2e, 0x62, 0x75,
0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x32, 0x39, 0x31, 0x33,
0x62, 0x37, 0x65, 0x36, 0x32, 0x65, 0x30, 0x65, 0x39, 0x30, 0x35, 0x65, 0x32, 0x34, 0x64,
0x66, 0x62, 0x33, 0x64, 0x33, 0x30, 0x35, 0x62, 0x31, 0x30, 0x35, 0x39, 0x65, 0x36, 0x35,
0x32, 0x66, 0x31, 0x62, 0x38, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x98,
0xc6, 0x63, 0x03, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x66, 0x75, 0x74, 0x65, 0x78, 0x31, 0x2e, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x39, 0x56, 0x7b, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x68, 0x31, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x2b, 0xd6, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6a, 0x73, 0x6f, 0x6e,
0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xb4, 0xed,
0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x00, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x73,
0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x8b, 0xf4, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x62, 0x31, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x63, 0x30, 0xce, 0x03, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x07, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x32, 0x32, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0xc2, 0x49, 0xd9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2e, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65,
0x2d, 0x73, 0x61, 0x6e, 0x64, 0x62, 0x6f, 0x78, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x00, 0x04,
0xc2, 0xc0, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x31, 0x33, 0x33, 0x00, 0x00, 0x04, 0xdc, 0xc5, 0x38, 0x04, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x31, 0x33, 0x34,
0x00, 0x00, 0x04, 0xf1, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x00, 0x00, 0x29, 0x09, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2e, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x5f, 0x68,
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x25, 0x3c,
0x8e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x52, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x31, 0x32, 0x34, 0x00, 0x00, 0x04, 0x38, 0x96, 0x95, 0x04, 0x00, 0x00, 0x00, 0x00,
0x6e, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x63, 0x31, 0x2e, 0x70, 0x79,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x71, 0xc0, 0x95, 0x04, 0x00, 0x00,
0x00, 0x00, 0x89, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x74, 0x31, 0x2e,
0x73, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xbe, 0xd1, 0x96, 0x04,
0x00, 0x00, 0x00, 0x00, 0xd7, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x30,
0x31, 0x2d, 0x74, 0x6f, 0x6b, 0x69, 0x6f, 0x2d, 0x6d, 0x75, 0x74, 0x65, 0x78, 0x2e, 0x64,
0x69, 0x66, 0x66, 0x00, 0x00, 0x08, 0xfa, 0xbc, 0xa1, 0x04, 0x00, 0x00, 0x00, 0x00, 0xf4,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x64, 0x62, 0x67, 0x2d, 0x69, 0x6e,
0x66, 0x6f, 0x2d, 0x33, 0x31, 0x39, 0x00, 0x04, 0x6a, 0x2c, 0xb8, 0x04, 0x00, 0x00, 0x00,
0x00, 0x63, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x2e, 0x63, 0x6c, 0x61,
0x6e, 0x67, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x9f, 0x73, 0xd5, 0x04, 0x00,
0x00, 0x00, 0x00, 0x87, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x73, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x64, 0x2d, 0x64, 0x65, 0x62, 0x75, 0x67, 0x69, 0x6e, 0x66, 0x6f,
0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x57, 0xc8,
0xdb, 0x04, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x2e, 0x6c, 0x65, 0x73, 0x73, 0x68, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x36, 0xf2, 0xde, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x2e, 0x76, 0x69, 0x6d, 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08,
])
.0;
const HOME_DIRENTS64: &[u8] = &Aligned([
0xf2, 0x5b, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x04, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x11, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x2e, 0x2e,
0x00, 0x00, 0x00, 0x54, 0x5c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x5c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x00, 0x58,
0x5c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x28, 0x00, 0x0a, 0x52, 0x45, 0x41, 0x44, 0x4d, 0x45, 0x2d, 0x64, 0x6f, 0x74, 0x73, 0x79,
0x6e, 0x63, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x62, 0x5c, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x2e, 0x6c,
0x6f, 0x67, 0x69, 0x6e, 0x6f, 0x75, 0x74, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x00,
0x00, 0x00, 0x00, 0x00, 0x37, 0x5d, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x2e, 0x73, 0x73, 0x68, 0x00, 0x38, 0x5d,
0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x08, 0x2e, 0x73, 0x63, 0x6d, 0x2e, 0x73, 0x71, 0x6c, 0x69, 0x74, 0x65, 0x00, 0x00,
0x13, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x28, 0x00, 0x08, 0x2e, 0x64, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2d, 0x6d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0xab, 0x5e, 0x79, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x2e,
0x62, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x00, 0xad, 0x5e, 0x79,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00,
0x08, 0x2e, 0x62, 0x61, 0x73, 0x68, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb1, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x63, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x5e, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x0a, 0x2e, 0x65,
0x6d, 0x61, 0x63, 0x73, 0x2e, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0x5e, 0x79, 0x00,
0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
0x2e, 0x68, 0x67, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x5e,
0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x08, 0x2e, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
0xbe, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x08, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc0, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x73, 0x75, 0x62, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x00, 0x00, 0xca, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x2e, 0x74, 0x6d, 0x75, 0x78, 0x2e, 0x63,
0x6f, 0x6e, 0x66, 0x00, 0x00, 0x00, 0xcc, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x2e, 0x76, 0x69, 0x6d, 0x00,
0xcf, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x08, 0x2e, 0x76, 0x69, 0x6d, 0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xd1, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x2e, 0x7a, 0x73, 0x68, 0x72, 0x63, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd3, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x2e, 0x61, 0x72, 0x63, 0x72, 0x63, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, 0x5e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x67, 0x6e, 0x75, 0x70,
0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x62, 0x79, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x00, 0x79, 0x65, 0x79, 0x00, 0x00,
0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x0a, 0x66,
0x62, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x6e, 0x79,
0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x04, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75,
0xc0, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x04, 0x2e, 0x62, 0x75, 0x63, 0x6b, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x00, 0x00,
0x00, 0xc8, 0xc2, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x28, 0x00, 0x08, 0x2e, 0x62, 0x61, 0x73, 0x68, 0x5f, 0x68, 0x69, 0x73, 0x74,
0x6f, 0x72, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0xc3, 0x79, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08,
0x2e, 0x64, 0x6f, 0x74, 0x73, 0x79, 0x6e, 0x63, 0x2d, 0x67, 0x65, 0x74, 0x2d, 0x73, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x00, 0xa9, 0xc4, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x04, 0x2e, 0x76, 0x73, 0x63, 0x6f,
0x64, 0x65, 0x2d, 0x66, 0x62, 0x2d, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x00, 0x00, 0x00,
0x00, 0xb9, 0xc4, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x28, 0x00, 0x04, 0x2e, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x72, 0x65,
0x6d, 0x6f, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x82, 0x7d, 0x00,
0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x04,
0x2e, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x66, 0x62, 0x2d, 0x69, 0x6e, 0x73, 0x69,
0x64, 0x65, 0x72, 0x73, 0x00, 0x00, 0xdd, 0xb7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x67, 0x69, 0x74, 0x00, 0x00,
0x5b, 0xd9, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x0a, 0x6e, 0x66, 0x73, 0x00, 0x00, 0x5c, 0xd9, 0x82, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x0a, 0x70, 0x75,
0x62, 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0xd9, 0x82, 0x00,
0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04,
0x74, 0x65, 0x73, 0x74, 0x00, 0x4d, 0xe2, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x31, 0x2e, 0x64, 0x69, 0x66, 0x66,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xbc, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x6c, 0x6f, 0x63,
0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xbe, 0x9c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x62, 0x75,
0x69, 0x6c, 0x64, 0x2e, 0x6c, 0x6f, 0x67, 0x00, 0x00, 0x00, 0x00, 0x07, 0x50, 0x14, 0x01,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
0x65, 0x78, 0x74, 0x34, 0x2e, 0x69, 0x6d, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x50,
0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x04, 0x31, 0x33, 0x00, 0x00, 0x00, 0x3f, 0xc1, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x00,
0xb9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x74, 0x65, 0x73, 0x74,
0x2d, 0x31, 0x37, 0x33, 0x36, 0x35, 0x38, 0x32, 0x00, 0x36, 0x3b, 0x2b, 0x01, 0x00, 0x00,
0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x74, 0x65,
0x73, 0x74, 0x2d, 0x31, 0x37, 0x34, 0x36, 0x37, 0x31, 0x33, 0x00, 0x84, 0xd4, 0x2b, 0x01,
0x00, 0x00, 0x00, 0x00, 0xc9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04,
0x2e, 0x63, 0x61, 0x72, 0x67, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xd4,
0x2b, 0x01, 0x00, 0x00, 0x00, 0x00, 0xca, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x08, 0x2e, 0x7a, 0x73, 0x68, 0x65, 0x6e, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x89, 0xd4, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x04, 0x2e, 0x72, 0x75, 0x73, 0x74, 0x75, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xb6, 0x8e, 0x53, 0x01, 0x00, 0x00, 0x00, 0x00, 0x26, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x33, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x86, 0xbf, 0x53, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x61, 0x2e, 0x6f, 0x00, 0x00, 0x20, 0xc5,
0x6a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00,
0x34, 0xc5, 0x6a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x04, 0x32, 0x32, 0x00, 0x00, 0x00, 0xd1, 0x4b, 0x7d, 0x01, 0x00, 0x00,
0x00, 0x00, 0x7b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x66, 0x61,
0x6b, 0x65, 0x72, 0x6f, 0x6f, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xb2, 0x9f, 0x01,
0x00, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
0x72, 0x70, 0x6d, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0xb5,
0xa7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x00, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x31, 0x2e, 0x72, 0x70, 0x6d,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xfe, 0xa7, 0x01, 0x00, 0x00, 0x00,
0x00, 0x96, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x73, 0x79, 0x73,
0x74, 0x65, 0x6d, 0x64, 0x2e, 0x32, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1b, 0x49, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x97, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e,
0x33, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x8e,
0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x98, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x00, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x34, 0x2e, 0x72, 0x70, 0x6d,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0xa8, 0x01, 0x00, 0x00, 0x00,
0x00, 0x99, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x73, 0x79, 0x73,
0x74, 0x65, 0x6d, 0x64, 0x2e, 0x35, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x20, 0xa9, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e,
0x36, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x82,
0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa7, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x00, 0x08, 0x7a, 0x6c, 0x69, 0x62, 0x2d, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x2d, 0x31, 0x2e,
0x32, 0x2e, 0x31, 0x31, 0x2d, 0x31, 0x36, 0x2e, 0x65, 0x6c, 0x38, 0x5f, 0x32, 0x2e, 0x78,
0x38, 0x36, 0x5f, 0x36, 0x34, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe3, 0x82, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x7a, 0x6c, 0x00, 0x00, 0x00, 0xe5, 0xa3, 0xb0, 0x01,
0x00, 0x00, 0x00, 0x00, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
0x2e, 0x77, 0x67, 0x65, 0x74, 0x2d, 0x68, 0x73, 0x74, 0x73, 0x00, 0x00, 0x00, 0xf2, 0xa4,
0xe2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x04, 0x7a, 0x7a, 0x7a, 0x00, 0x00, 0x27, 0x78, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00,
0x63, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x6d, 0x31, 0x00, 0x00,
0x00, 0x5b, 0x4b, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x64, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x00, 0x04, 0x31, 0x32, 0x33, 0x00, 0x00, 0xa9, 0x53, 0xe8, 0x01, 0x00,
0x00, 0x00, 0x00, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x73,
0x31, 0x32, 0x00, 0x00, 0x22, 0xf8, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x22, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x68, 0x65, 0x72, 0x6d, 0x69, 0x74,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x91, 0x69, 0x02, 0x00, 0x00, 0x00, 0x00, 0x0d,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x2e, 0x62, 0x61, 0x73, 0x68,
0x72, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x2d, 0xdf, 0x02, 0x00, 0x00, 0x00,
0x00, 0x7c, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x32, 0x2e, 0x74,
0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x51, 0xfb, 0x02, 0x00,
0x00, 0x00, 0x00, 0xef, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x6e,
0x6f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x68, 0x00, 0x00, 0x00, 0x08, 0x66, 0x19,
0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00,
0x08, 0x2e, 0x62, 0x75, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x6f, 0x6b, 0x5f,
0x62, 0x61, 0x34, 0x64, 0x38, 0x63, 0x63, 0x31, 0x37, 0x35, 0x64, 0x39, 0x66, 0x37, 0x38,
0x38, 0x31, 0x35, 0x61, 0x31, 0x65, 0x39, 0x65, 0x33, 0x35, 0x66, 0x65, 0x64, 0x39, 0x65,
0x61, 0x63, 0x39, 0x37, 0x61, 0x63, 0x36, 0x35, 0x30, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf2, 0xca, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x25, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x2e, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6d, 0x61, 0x6e,
0x61, 0x67, 0x65, 0x5f, 0x6d, 0x79, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x63, 0x61, 0x6e, 0x61,
0x6c, 0x00, 0x00, 0x00, 0x00, 0x43, 0x36, 0x3b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x04, 0x77, 0x61, 0x69, 0x74, 0x34, 0x2d,
0x77, 0x61, 0x69, 0x74, 0x69, 0x64, 0x2d, 0x64, 0x65, 0x62, 0x75, 0x67, 0x00, 0x00, 0x00,
0xe4, 0x61, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x04, 0x31, 0x33, 0x31, 0x00, 0x00, 0xc4, 0x01, 0x52, 0x03, 0x00, 0x00,
0x00, 0x00, 0xd1, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x08, 0x2e, 0x62,
0x75, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x32, 0x39, 0x31,
0x33, 0x62, 0x37, 0x65, 0x36, 0x32, 0x65, 0x30, 0x65, 0x39, 0x30, 0x35, 0x65, 0x32, 0x34,
0x64, 0x66, 0x62, 0x33, 0x64, 0x33, 0x30, 0x35, 0x62, 0x31, 0x30, 0x35, 0x39, 0x65, 0x36,
0x35, 0x32, 0x66, 0x31, 0x62, 0x38, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98,
0xc6, 0x63, 0x03, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x08, 0x66, 0x75, 0x74, 0x65, 0x78, 0x31, 0x2e, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x39, 0x56, 0x7b, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x08, 0x68, 0x31, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x2b, 0xd6, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6a, 0x73, 0x6f,
0x6e, 0x2e, 0x6a, 0x73, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xed,
0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x00, 0x08, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f,
0x73, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x8b, 0xf4, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x08, 0x62, 0x31, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x63, 0x30, 0xce, 0x03, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x07, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x32, 0x32, 0x2e, 0x64, 0x69, 0x66, 0x66, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x49, 0xd9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x04, 0x2e, 0x76, 0x73, 0x63, 0x6f, 0x64,
0x65, 0x2d, 0x73, 0x61, 0x6e, 0x64, 0x62, 0x6f, 0x78, 0x2d, 0x64, 0x61, 0x74, 0x61, 0x00,
0xc2, 0xc0, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x00, 0x04, 0x31, 0x33, 0x33, 0x00, 0x00, 0xdc, 0xc5, 0x38, 0x04, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x31, 0x33,
0x34, 0x00, 0x00, 0xf1, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x00, 0x00, 0x29, 0x09, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08, 0x2e, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x5f,
0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x3c,
0x8e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x52, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x00, 0x04, 0x31, 0x32, 0x34, 0x00, 0x00, 0x38, 0x96, 0x95, 0x04, 0x00, 0x00, 0x00, 0x00,
0x6e, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x63, 0x31, 0x2e, 0x70,
0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0xc0, 0x95, 0x04, 0x00, 0x00,
0x00, 0x00, 0x89, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x74, 0x31,
0x2e, 0x73, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0xd1, 0x96, 0x04,
0x00, 0x00, 0x00, 0x00, 0xd7, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x08,
0x30, 0x31, 0x2d, 0x74, 0x6f, 0x6b, 0x69, 0x6f, 0x2d, 0x6d, 0x75, 0x74, 0x65, 0x78, 0x2e,
0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0xfa, 0xbc, 0xa1, 0x04, 0x00, 0x00, 0x00, 0x00, 0xf4,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x64, 0x62, 0x67, 0x2d, 0x69,
0x6e, 0x66, 0x6f, 0x2d, 0x33, 0x31, 0x39, 0x00, 0x6a, 0x2c, 0xb8, 0x04, 0x00, 0x00, 0x00,
0x00, 0x63, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x2e, 0x63, 0x6c,
0x61, 0x6e, 0x67, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x73, 0xd5, 0x04, 0x00,
0x00, 0x00, 0x00, 0x85, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x73,
0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2d, 0x64, 0x65, 0x62, 0x75, 0x67, 0x69, 0x6e, 0x66,
0x6f, 0x2e, 0x72, 0x70, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0xc5,
0xdb, 0x04, 0x00, 0x00, 0x00, 0x00, 0x87, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x08, 0x2e, 0x76, 0x69, 0x6d, 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x57, 0xc8, 0xdb, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x08, 0x2e, 0x6c, 0x65, 0x73, 0x73, 0x68, 0x73, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00,
])
.0;
#[test]
fn dents_can_deserialize_serialize() {
let res = unsafe { deserialize_dirents(HOME_DIRENTS) };
let mut vv = vec![0; HOME_DIRENTS.len()];
vv.reserve_exact(128);
assert_eq!(
unsafe { serialize_dirents(&res, vv.as_mut_slice()) },
res.len()
);
assert_eq!(vv.as_slice(), HOME_DIRENTS);
}
#[test]
fn dents64_can_deserialize_serialize() {
let res = unsafe { deserialize_dirents64(HOME_DIRENTS64) };
let mut vv = vec![0; HOME_DIRENTS64.len()];
vv.reserve_exact(128);
assert_eq!(
unsafe { serialize_dirents64(&res, vv.as_mut_slice()) },
res.len()
);
assert_eq!(vv.as_slice(), HOME_DIRENTS64);
}
#[test]
fn dents_can_serialize_sort_deserialize() {
let mut res = unsafe { deserialize_dirents(HOME_DIRENTS) };
res.sort();
let mut vv = vec![0; HOME_DIRENTS.len()];
vv.reserve_exact(128);
assert_eq!(
unsafe { serialize_dirents(&res, vv.as_mut_slice()) },
res.len()
);
let res2 = unsafe { deserialize_dirents(vv.as_slice()) };
assert_eq!(res.len(), res2.len());
}
#[test]
fn dents64_can_serialize_sort_deserialize() {
let mut res = unsafe { deserialize_dirents64(HOME_DIRENTS64) };
res.sort();
let mut vv = vec![0; HOME_DIRENTS64.len()];
vv.reserve_exact(128);
assert_eq!(
unsafe { serialize_dirents64(&res, vv.as_mut_slice()) },
res.len()
);
let res2 = unsafe { deserialize_dirents64(vv.as_slice()) };
assert_eq!(res.len(), res2.len());
}
fn host_offsets(bytes: &[u8]) -> Vec<i64> {
let mut offsets = Vec::new();
let mut at = 0;
while at < bytes.len() {
offsets.push(i64::from_ne_bytes(
bytes[at + 8..at + 16].try_into().unwrap(),
));
at += usize::from(u16::from_ne_bytes(
bytes[at + 16..at + 18].try_into().unwrap(),
));
}
offsets
}
fn assert_parse_encode_reproduces_kernel_bytes(format: DirentFormat, bytes: &[u8]) {
let entries = format.parse(bytes).unwrap();
let legacy = match format {
DirentFormat::Dirent64 => unsafe { deserialize_dirents64(bytes) },
DirentFormat::Legacy => unsafe { deserialize_dirents(bytes) },
};
assert_eq!(entries.len(), legacy.len());
for (entry, old) in entries.iter().zip(&legacy) {
let name_len = old.name.iter().position(|&byte| byte == 0).unwrap();
assert_eq!(entry.name, &old.name[..name_len]);
assert_eq!(entry.ino, old.ino);
assert_eq!(entry.ty, old.ty);
assert_eq!(format.record_len(entry.name.len()), usize::from(old.reclen));
}
assert_eq!(
entries.iter().map(|entry| entry.off).collect::<Vec<_>>(),
host_offsets(bytes)
);
let mut encoded = Vec::new();
for entry in &entries {
format.encode(entry, entry.ino, entry.off, &mut encoded);
}
assert_eq!(encoded.as_slice(), bytes);
}
#[test]
fn dirent64_parse_and_encode_reproduce_kernel_records() {
assert_parse_encode_reproduces_kernel_bytes(DirentFormat::Dirent64, HOME_DIRENTS64);
}
#[test]
fn legacy_dirent_parse_and_encode_reproduce_kernel_records() {
assert_parse_encode_reproduces_kernel_bytes(DirentFormat::Legacy, HOME_DIRENTS);
}
#[test]
fn record_len_matches_linux_rounding() {
assert_eq!(DirentFormat::Dirent64.record_len(1), 24);
assert_eq!(DirentFormat::Dirent64.record_len(4), 24);
assert_eq!(DirentFormat::Dirent64.record_len(5), 32);
assert_eq!(DirentFormat::Dirent64.record_len(255), 280);
assert_eq!(DirentFormat::Legacy.record_len(3), 24);
assert_eq!(DirentFormat::Legacy.record_len(4), 24);
assert_eq!(DirentFormat::Legacy.record_len(5), 32);
assert_eq!(DirentFormat::Legacy.record_len(255), 280);
}
#[test]
fn malformed_records_are_rejected_not_looped_on() {
let mut good = Vec::new();
let entry = DirEntry {
name: b"a".to_vec(),
ino: 7,
off: 1,
ty: 8,
};
DirentFormat::Dirent64.encode(&entry, 7, 1, &mut good);
for reclen in [0u16, 19, 32] {
let mut bad = good.clone();
bad[16..18].copy_from_slice(&reclen.to_ne_bytes());
assert_eq!(
DirentFormat::Dirent64.parse(&bad),
Err(Errno::EIO),
"reclen {reclen}"
);
}
assert_eq!(DirentFormat::Dirent64.parse(&good[..18]), Err(Errno::EIO));
let mut unterminated = good.clone();
unterminated[19..24].fill(b'x');
assert_eq!(DirentFormat::Dirent64.parse(&unterminated), Err(Errno::EIO));
}
#[test]
fn only_the_last_records_padding_may_be_unread() {
let mut bytes = Vec::new();
for (format, names) in [
(DirentFormat::Dirent64, ["00", "01"]),
(DirentFormat::Legacy, ["00", "01"]),
] {
bytes.clear();
for name in names {
format.encode(&entry(name), 5, 1, &mut bytes);
}
let whole = format.parse(&bytes).unwrap();
let written = 24 + format.written_len(2);
for readable in 0..=bytes.len() {
let mut read = bytes.clone();
read[readable..].fill(0xaa);
let parsed = format.parse_written(&mut read, readable);
if readable >= written {
assert_eq!(parsed, Ok(whole.clone()), "{format:?}, {readable} readable");
} else {
assert_eq!(
parsed,
Err(Errno::EFAULT),
"{format:?}, {readable} readable"
);
}
}
}
}
#[test]
fn a_record_longer_than_its_name_needs_is_not_padding() {
let mut bytes = Vec::new();
DirentFormat::Dirent64.encode(&entry("a"), 5, 1, &mut bytes);
bytes.resize(64, 0x5a);
bytes[16..18].copy_from_slice(&64u16.to_ne_bytes());
let whole = DirentFormat::Dirent64.parse(&bytes).unwrap();
assert_eq!(whole.len(), 1);
for readable in 0..=bytes.len() {
let mut read = bytes.clone();
let parsed = DirentFormat::Dirent64.parse_written(&mut read, readable);
if readable == bytes.len() {
assert_eq!(parsed, Ok(whole.clone()), "{readable} readable");
} else {
assert_eq!(parsed, Err(Errno::EFAULT), "{readable} readable");
}
}
}
fn entry(name: &str) -> DirEntry {
DirEntry {
name: name.as_bytes().to_vec(),
ino: name.len() as u64,
off: 0,
ty: libc::DT_REG,
}
}
fn names(entries: &[DirEntry]) -> Vec<&str> {
entries
.iter()
.map(|entry| std::str::from_utf8(&entry.name).unwrap())
.collect()
}
#[test]
fn dot_entries_sort_first_then_bytewise() {
let mut entries: Vec<_> = ["b", "..", "B", "a", ".", ".a", "-"]
.into_iter()
.map(entry)
.collect();
sort_dir_entries(&mut entries);
assert_eq!(names(&entries), [".", "..", "-", ".a", "B", "a", "b"]);
}
#[test]
fn stream_serves_whole_directory_in_order_across_small_buffers() {
let mut stream = DirectoryStream::default();
assert!(stream.needs_snapshot());
stream.install(
["c", "a", "b"].into_iter().map(entry).collect(),
DirectoryOrder::NameBytes,
);
assert!(!stream.needs_snapshot());
let first = stream.next_batch(DirentFormat::Dirent64, 48).unwrap();
assert_eq!(names(&first), ["a", "b"]);
stream.advance(first.len());
assert_eq!(stream.position(), 2);
let second = stream.next_batch(DirentFormat::Dirent64, 48).unwrap();
assert_eq!(names(&second), ["c"]);
stream.advance(second.len());
assert!(
stream
.next_batch(DirentFormat::Dirent64, 48)
.unwrap()
.is_empty()
);
}
#[test]
fn modeled_procfs_ids_keep_numeric_order_and_host_resume_positions() {
let host = [
("10", 11),
("cmdline", 23),
("..", 37),
("3", 41),
("self", 59),
("1", 61),
(".", 73),
("11", 89),
];
let entries = || {
host.iter()
.map(|&(name, off)| DirEntry { off, ..entry(name) })
.collect()
};
let expected = [".", "..", "1", "3", "10", "11", "cmdline", "self"];
let resume = [0, 0, 0, 0, 0, 11, 11, 41, 89];
for format in [DirentFormat::Legacy, DirentFormat::Dirent64] {
let mut stream = DirectoryStream::default();
stream.install(entries(), DirectoryOrder::ProcfsIds);
for (position, name) in expected.iter().enumerate() {
assert_eq!(stream.position(), position as u64);
assert_eq!(stream.kernel_target(), resume[position]);
let batch = stream
.next_batch(format, format.record_len(name.len()))
.unwrap();
assert_eq!(names(&batch), [*name]);
stream.advance(batch.len());
}
assert_eq!(stream.kernel_target(), resume[expected.len()]);
assert!(stream.next_batch(format, 1024).unwrap().is_empty());
stream.seek(3);
assert_eq!(names(&stream.next_batch(format, 24).unwrap()), ["3"]);
assert_eq!(stream.kernel_target(), 0);
stream.seek(0);
assert!(stream.needs_snapshot());
stream.seek(4);
stream.install(entries(), DirectoryOrder::ProcfsIds);
assert_eq!(stream.position(), 4);
assert_eq!(names(&stream.next_batch(format, 48).unwrap()), ["10", "11"]);
assert_eq!(stream.kernel_target(), 0);
}
}
#[test]
fn ordinary_directory_numeric_names_keep_byte_order() {
let mut stream = DirectoryStream::default();
stream.install(
["10", "cmdline", "..", "3", "self", "1", ".", "11"]
.into_iter()
.map(entry)
.collect(),
DirectoryOrder::NameBytes,
);
assert_eq!(
names(&stream.next_batch(DirentFormat::Dirent64, 1024).unwrap()),
[".", "..", "1", "10", "11", "3", "cmdline", "self"]
);
stream.install(
["2", "10", "15x", "03", "0", "2147483648"]
.into_iter()
.map(entry)
.collect(),
DirectoryOrder::ProcfsIds,
);
assert_eq!(
names(&stream.next_batch(DirentFormat::Dirent64, 1024).unwrap()),
["2", "10", "0", "03", "15x", "2147483648"]
);
}
#[test]
fn stream_rejects_a_buffer_too_small_for_the_next_entry() {
let mut stream = DirectoryStream::default();
stream.install(vec![entry("a")], DirectoryOrder::NameBytes);
assert_eq!(
stream.next_batch(DirentFormat::Dirent64, 23),
Err(Errno::EINVAL)
);
assert_eq!(
names(&stream.next_batch(DirentFormat::Dirent64, 24).unwrap()),
["a"]
);
}
#[test]
fn stream_seek_positions_by_index_and_rewind_refreshes() {
let mut stream = DirectoryStream::default();
stream.install(
["a", "b", "c"].into_iter().map(entry).collect(),
DirectoryOrder::NameBytes,
);
stream.seek(2);
assert!(!stream.needs_snapshot());
assert_eq!(
names(&stream.next_batch(DirentFormat::Legacy, 1024).unwrap()),
["c"]
);
stream.seek(99);
assert!(
stream
.next_batch(DirentFormat::Legacy, 1024)
.unwrap()
.is_empty()
);
stream.seek(0);
assert!(stream.needs_snapshot());
assert_eq!(stream.position(), 0);
}
#[test]
fn stream_keeps_the_kernel_where_every_unreturned_entry_follows() {
let host = [("c", 10), ("a", 20), ("d", 30), ("b", 40)];
let mut stream = DirectoryStream::default();
stream.install(
host.iter()
.map(|&(name, off)| DirEntry { off, ..entry(name) })
.collect(),
DirectoryOrder::NameBytes,
);
let expected = [
(0, 0),
(1, 0),
(2, 0),
(3, 20),
(4, 40),
(99, 40),
];
for (position, target) in expected {
stream.position = position;
assert_eq!(stream.kernel_target(), target, "position {position}");
}
stream.seek(0);
assert_eq!(stream.kernel_target(), 0);
}
}