# systemforge279/persistent-virtual-file-system-c architecture

> Architecture diagram of the GitHub repository systemforge279/persistent-virtual-file-system-c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/systemforge279/persistent-virtual-file-system-c
- Repository: https://github.com/systemforge279/persistent-virtual-file-system-c

## Overview

This repository contains two versions of a command-line virtual filesystem: V1 keeps file data in memory, while V2 persists filesystem state in a virtual disk. The user workflow is to issue shell-like commands to create, open, read, write, and inspect files. V2 adds mounting/formatting, inode metadata, block-level I/O, and synchronization. The source is monolithic, so the component split reflects distinct responsibilities visible in the excerpts; unsampled call relationships are omitted.

Main entry points: [`V2-Persistent-CVFS/CVFS_V2.c`](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c) (Disk Block I/O), [`V1-InMemory-CVFS/cvfs_v1.c`](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V1-InMemory-CVFS/cvfs_v1.c) (V1 Command Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_v1["In-memory CVFS"]
  node_v1shell["V1 Command Shell<br/>[cvfs_v1.c]"]
end

subgraph group_v2cli["Persistent CVFS Interface"]
  node_v2shell["V2 Command Shell<br/>[CVFS_V2.c]"]
end

subgraph group_v2fs["Persistent Filesystem"]
  node_namespace["Inode Namespace<br/>[CVFS_V2.c]"]
  node_fileops["File Operations<br/>[CVFS_V2.c]"]
  node_openstate["Open File State<br/>[CVFS_V2.c]"]
  node_blockops["Block Data Operations<br/>[CVFS_V2.c]"]
  node_diskio["Disk Block I/O<br/>[CVFS_V2.c]"]
  node_diskimage[("Virtual Disk")]
  node_disklifecycle["Disk Lifecycle<br/>[CVFS_V2.c]"]
end

node_user(("User"))

node_user -->|"enters commands"| node_v1shell
node_user -->|"enters commands"| node_v2shell
node_v2shell -->|"mounts filesystem"| node_disklifecycle
node_disklifecycle -->|"formats disk"| node_diskio
node_blockops -->|"reads and writes"| node_diskio
node_diskio -->|"accesses blocks"| node_diskimage

click node_v1shell "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V1-InMemory-CVFS/cvfs_v1.c"
click node_v2shell "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"
click node_namespace "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"
click node_fileops "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"
click node_openstate "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"
click node_blockops "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"
click node_diskio "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"
click node_disklifecycle "https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_v1shell,node_user toneBlue
class node_v2shell toneAmber
class node_namespace,node_fileops,node_openstate,node_blockops,node_diskio,node_diskimage,node_disklifecycle toneMint
```

## Components

### In-memory CVFS

- [V1 Command Shell](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V1-InMemory-CVFS/cvfs_v1.c): `V1-InMemory-CVFS/cvfs_v1.c`

### Persistent CVFS Interface

- [V2 Command Shell](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`

### Persistent Filesystem

- [Inode Namespace](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`
- [File Operations](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`
- [Open File State](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`
- [Block Data Operations](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`
- [Disk Block I/O](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`
- **Virtual Disk**
- [Disk Lifecycle](https://github.com/systemforge279/persistent-virtual-file-system-c/blob/main/V2-Persistent-CVFS/CVFS_V2.c): `V2-Persistent-CVFS/CVFS_V2.c`

### Other components

- **User**

## Connections

- User → V1 Command Shell: enters commands (evidence: `V1-InMemory-CVFS/cvfs_v1.c`)
- User → V2 Command Shell: enters commands (evidence: `V2-Persistent-CVFS/CVFS_V2.c`)
- V2 Command Shell → Disk Lifecycle: mounts filesystem (evidence: `V2-Persistent-CVFS/CVFS_V2.c`)
- Disk Lifecycle → Disk Block I/O: formats disk (evidence: `V2-Persistent-CVFS/CVFS_V2.c`)
- Block Data Operations → Disk Block I/O: reads and writes (evidence: `V2-Persistent-CVFS/CVFS_V2.c`)
- Disk Block I/O → Virtual Disk: accesses blocks (evidence: `V2-Persistent-CVFS/CVFS_V2.c`)
