You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: e2fs_lib.rs
    path of file: ./repos/rustybox/e2fsprogs
    
    the code of the file until where you have to start completion: use crate::libbb::ptr_to_globals::bb_errno;

use libc;
use libc::close;
use libc::closedir;
use libc::ioctl;
use libc::open;
use libc::opendir;
use libc::readdir;
extern "C" {

  #[no_mangle]
  fn putc_unlocked(__c: libc::c_int, __stream: *mut FILE) -> libc::c_int;
  #[no_mangle]
  fn fputs_unlocked(__s: *const libc::c_char, __stream: *mut FILE) -> libc::c_int;

  #[no_mangle]
  fn strlen(__s: *const libc::c_char) -> size_t;

}

use crate::librb::size_t;
use libc::dirent;
use libc::stat;
use libc::DIR;
use libc::FILE;
/*
 * See README for additional information
 *
 * Licensed under GPLv2, see file LICENSE in this source tree.
 */
unsafe fn close_silently(mut fd: libc::c_int) {
  let mut e: libc::c_int = *bb_errno;
  close(fd);
  *bb_errno = e;
}
/* Iterate a function on each entry of a directory */
pub unsafe fn iterate_on_dir(
  mut dir_name: *const libc::c_char,
  mut func: Option<
    unsafe fn(_: *const libc::c_char, _: *mut dirent, _: *mut libc::c_void) -> libc::c_int,
  >,
  mut private: *mut libc::c_void,
) -> libc::c_int {
  let mut dir: *mut DIR = std::ptr::null_mut();
  let mut de: *mut dirent = std::ptr::null_mut();
  dir = opendir(d
    
pub unsafe fn print_e2flags(mut f: *mut FILE, mut flags: libc::c_ulong, mut options: libc::c_uint) {
  let mut fv: *const u32 = std::ptr::null();
  let mut fn_0: *const libc::c_char = std::ptr::null();
  fv = e2attr_flags_value.as_ptr();
  if options & 1i32 as libc::c_uint != 0 {
    let mut first: libc::c_int = 1i32;
    fn_0 = e2attr_flags_lname.as_ptr();
    loop {
      if flags & *fv as libc::c_ulong != 0 {
        if first == 0 {
          fputs_unlocked(b", \x00" as *const u8 as *const libc::c_char, f);
        }
        fputs_unlocked(fn_0, f);
        first = 0
      }
      fv = fv.offset(1);
      fn_0 = fn_0.offset(strlen(fn_0).wrapping_add(1i32 as libc::c_ulong) as isize);
      if !(*fn_0 != 0) {
        break;
      }
    }
    if first != 0 {
      fputs_unlocked(b"---\x00" as *const u8 as *const libc::c_char, f);
    }
  } else {
    fn_0 = e2attr_flags_sname.as_ptr();
    loop {
      let mut c: libc::c_char = '-' as i32 as libc::c_char;
      if flags & *fv as libc::c_ulong != 0 {
        c = *fn_0
      }
      putc_unlocked(c as libc::c_int, f);
      fv = fv.offset(1);
      fn_0 = fn_0.offset(1);
      if !(*fn_0 != 0) {
        break;
      }
    }
  };
}