# quentinfringhian/diskedit architecture

> Architecture diagram of the GitHub repository quentinfringhian/diskedit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quentinfringhian/diskedit
- Repository: https://github.com/quentinfringhian/diskedit

## Overview

##### Project Type and Purpose

**Project Type:**
`os_proj3` is a system-level project focused on implementing a simple file system. It likely simulates basic file system operations and provides a text-based user interface (TUI) for interaction.

**Purpose:**
The project aims to demonstrate the fundamental components and operations of a file system, such as directory management, file manipulation, and inode handling, possibly as part of an operating systems course or as a foundational tool for further development.

##### File Structure

**Top-Level Directories and Files:**

- **`src/`**: Contains source code divided into `d_edit` (disk editor) and `tui` (text user interface) modules.
- **`include/`**: Header files corresponding to the `d_edit` and `tui` modules, as well as filesystem (`fs.h`) headers.
- **`lib/list/`**: Implements a linked list library used across the project.
- **`doc/`**: Documentation files, including `proj3.pdf` and `proj3.tex`.
- **Configuration and Build Files**: `.editorconfig`, `.gitignore`, `Makefile`, etc.

**Architectural Patterns and Choices:**

- **Modular Design**: Separation of concerns with distinct modules for disk editing (`d_edit`) and the user interface (`tui`).
- **Reusable Libraries**: Utilization of a linked list library (`lib/list`) to manage dynamic data structures.
- **Layered Architecture**: Likely follows a layered approach where the TUI interacts with the disk editor, which in turn manages filesystem operations.

##### README for Additional Insights

The README is succinct, primarily directing users to `project3.pdf` for detailed information. However, from the available information:

- **Project Focus**: Implementation of a simple file system.
- **Documentation Reference**: Indicates comprehensive design and implementation details are available in the PDF, suggesting a well-documented architecture.

**a. Identify the Main Components:**

##### Text User Interface (TUI)
- Located in `src/tui/`
- Handles user interactions, commands, and displays.

##### Disk Editor (`d_edit`)
- Located in `src/d_edit/`
- Manages low-level disk operations, file manipulations, and inode management.

##### Linked List Library (`lib/list`)
- Provides dynamic data structures for managing lists within the file system.

##### Filesystem Core (`include/fs.h` and related source files)
- Defines filesystem structures, operations, and interfaces.

##### Configuration and Build Systems
- `Makefile`, `.editorconfig`, etc., manage the build process and code consistency.

**b. Determine Relationships and Interactions:**

- **TUI ↔ Disk Editor:** The TUI sends user commands to the disk editor to perform filesystem operations and receives status updates or data to display.
- **Disk Editor ↔ Linked List Library:** The disk editor utilizes the linked list library to manage dynamic data structures like directory listings and inode tables.
- **Filesystem Core ↔ Disk Editor:** The core filesystem functionalities are invoked by the disk editor to execute specific operations (e.g., creating files, changing directories).

**c. Highlight Architectural Patterns or Design Principles:**

- **Separation of Concerns:** Clear division between user interface and backend filesystem operations.
- **Modularity:** Independent modules (`tui`, `d_edit`, `lib/list`) enhance maintainability and scalability.
- **Reusability:** Utilization of the linked list library across different modules promotes code reuse.

**d. Include Relevant Technologies, Frameworks, or Libraries:**

- **Programming Language:** Presumably C, given the file extensions and structure.
- **Libraries:**
- **Linked List Library:** Custom implementation for managing lists.
- **Build System:** Makefile is used for building the project.

##### Importance of Detail and Essential Architectural Elements

- **Core Functionalities:** Represent key modules that drive the filesystem operations.
- **Architectural Integrity:** Maintain clarity in illustrating the modular and layered structure.

Avoid unnecessary details that do not contribute to understanding the overall architecture. Prioritize clarity and comprehensiveness in representing essential elements.

**Final Tips:**

- **Iterate and Refine:** Start with a high-level overview and progressively add details, ensuring each component and connection is accurately represented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global entities
    subgraph Frontend
        TUI["Text User Interface (TUI)"]:::frontend
    end

    subgraph Backend
        DiskEditor["Disk Editor (d_edit)"]:::backend
        FilesystemCore["Filesystem Core"]:::backend
    end

    subgraph Library
        LinkedListLib["Linked List Library"]:::library
        linked_list_h["linked_list.h"]:::config
        lib_list_src["lib/list/src/"]:::config
    end

    subgraph Configuration
        Makefile["Makefile"]:::config
        EditorConfig[".editorconfig"]:::config
        GitIgnore[".gitignore"]:::config
    end

    %% Connections
    TUI -->|"sends commands"| DiskEditor
    DiskEditor -->|"manages filesystem operations"| FilesystemCore
    DiskEditor -->|"uses"| LinkedListLib
    LinkedListLib -->|"includes"| linked_list_h
    LinkedListLib -->|"sources"| lib_list_src

    %% Click Events
    click TUI "https://github.com/quentinfringhian/diskedit/tree/main/src/tui/"
    click DiskEditor "https://github.com/quentinfringhian/diskedit/tree/main/src/d_edit/"
    click LinkedListLib "https://github.com/quentinfringhian/diskedit/tree/main/lib/list/"
    click linked_list_h "https://github.com/quentinfringhian/diskedit/blob/main/lib/list/include/linked_list.h"
    click lib_list_src "https://github.com/quentinfringhian/diskedit/tree/main/lib/list/src/"
    click FilesystemCore "https://github.com/quentinfringhian/diskedit/blob/main/include/fs.h"
    click Makefile "https://github.com/quentinfringhian/diskedit/tree/main/Makefile"
    click EditorConfig "https://github.com/quentinfringhian/diskedit/blob/main/.editorconfig"
    click GitIgnore "https://github.com/quentinfringhian/diskedit/blob/main/.gitignore"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000
    classDef backend fill:#90EE90,stroke:#000
    classDef library fill:#FFA500,stroke:#000
    classDef config fill:#D3D3D3,stroke:#000

    class TUI frontend
    class DiskEditor,FilesystemCore backend
    class LinkedListLib library
    class linked_list_h,lib_list_src,Makefile,EditorConfig,GitIgnore config
```
