Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
doriancodes committed Dec 16, 2024
1 parent 6bfc841 commit 76c7238
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use anyhow::Result;
use clap::{Parser, Subcommand};
use froggr::modules::namespace::BindMode;
use froggr::modules::session::SessionManager;
use froggr::FilesystemManager;
use log::{error, info};
use std::path::PathBuf;
use std::str::FromStr;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
Expand Down
2 changes: 2 additions & 0 deletions src/modules/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(warnings)]

//! Constant values used throughout the filesystem implementation.
//!
//! This module defines various constants used for filesystem operations,
Expand Down
16 changes: 4 additions & 12 deletions src/modules/mount.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_variables)]

//! Filesystem mounting and management functionality.
//!
//! This module provides the core functionality for mounting and managing
Expand All @@ -8,15 +10,12 @@ use super::namespace::{BindMode, NamespaceEntry};
use super::proto::{BoundEntry, NineP};
use anyhow::{anyhow, Result};
use fuser::{FileAttr, FileType};
use libc::{SIGINT, SIGTERM};
use signal_hook::iterator::Signals;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::ffi::CString;
use std::ffi::OsString;
use std::fs;
use std::path::{Path, PathBuf};
use std::thread;
use std::path::Path;
use std::time::UNIX_EPOCH;
use log::{info, debug, warn};
use std::cell::RefCell;
Expand All @@ -38,13 +37,6 @@ extern "C" {
pub fn umount(path: *const i8) -> i32;
}

#[derive(Clone)]
struct DirectoryEntry {
name: String,
path: PathBuf,
metadata: fs::Metadata,
}

/// Manages filesystem mounting and binding operations.
#[derive(Clone)]
pub struct FilesystemManager {
Expand Down Expand Up @@ -103,7 +95,7 @@ impl FilesystemManager {
let mut queue = VecDeque::new();
queue.push_back((current_path.to_path_buf(), parent_inode));

while let Some((path, parent)) = queue.pop_front() {
while let Some((path, _)) = queue.pop_front() {
for entry in fs::read_dir(&path)? {
let entry = entry?;
let metadata = entry.metadata()?;
Expand Down
2 changes: 2 additions & 0 deletions src/modules/namespace.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_variables)]

use anyhow::Result;
use fuser::{FileAttr, FileType};
use std::collections::HashMap;
Expand Down
2 changes: 2 additions & 0 deletions src/modules/proto.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_variables,dead_code)]

//! 9P protocol implementation and filesystem operations.
//!
//! This module provides the core 9P protocol implementation through the `NineP` type,
Expand Down
3 changes: 2 additions & 1 deletion src/modules/session.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_variables)]

//! Session management for filesystem operations.
//!
//! This module provides the `Session` type which manages filesystem sessions
Expand All @@ -12,7 +14,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::Arc;
use std::thread::{self, JoinHandle};
use std::collections::HashMap;
use std::fs;
use serde::{Serialize, Deserialize};
use uuid::Uuid;
Expand Down

0 comments on commit 76c7238

Please sign in to comment.