summaryrefslogtreecommitdiff
path: root/na/fs/fs_struct.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-07-10 11:31:46 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-07-10 11:31:46 +0800
commite90b72ec3082588b296956730bd2930cf8d5d671 (patch)
tree36ff6916af9b4176ea5a9662219d11e721f0b691 /na/fs/fs_struct.cc
parent1767d390fbf3d0c65389de46caf0b6d43ef3b6ad (diff)
downloadlume-e90b72ec3082588b296956730bd2930cf8d5d671.tar.gz
lume-e90b72ec3082588b296956730bd2930cf8d5d671.tar.xz
refactor: promote new architecture to repository root
Archive the deprecated implementation under lume-legacy, make the new kernel the default root-level build, and update repository entry points without changing kernel behavior.
Diffstat (limited to 'na/fs/fs_struct.cc')
-rw-r--r--na/fs/fs_struct.cc90
1 files changed, 0 insertions, 90 deletions
diff --git a/na/fs/fs_struct.cc b/na/fs/fs_struct.cc
deleted file mode 100644
index 090819f..0000000
--- a/na/fs/fs_struct.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Copyright (C) 2026 Richard Qin */
-
-/*
- * fs_struct.cc — Per-task filesystem context (cwd, root)
- */
-
-#include <lume/fs_struct.h>
-#include <lume/slab.h>
-
-/* ================================================================== */
-/* alloc_fs_struct */
-/* ================================================================== */
-
-fs_struct* alloc_fs_struct()
-{
- auto* fs = new fs_struct{};
- if (!fs) return nullptr;
-
- fs->count.store(1);
- fs->umask = 022;
- fs->root = {nullptr, nullptr};
- fs->pwd = {nullptr, nullptr};
-
- return fs;
-}
-
-/* ================================================================== */
-/* put_fs_struct */
-/* ================================================================== */
-
-void put_fs_struct(fs_struct* fs)
-{
- if (!fs) return;
-
- int old = fs->count.fetch_sub(1);
- if (old > 1) return;
-
- path_put(&fs->root);
- path_put(&fs->pwd);
- delete fs;
-}
-
-/* ================================================================== */
-/* copy_fs_struct — for fork without CLONE_FS */
-/* ================================================================== */
-
-fs_struct* copy_fs_struct(const fs_struct* old_fs)
-{
- auto* fs = alloc_fs_struct();
- if (!fs) return nullptr;
-
- fs->umask = old_fs->umask;
-
- fs->root = old_fs->root;
- path_get(&fs->root);
-
- fs->pwd = old_fs->pwd;
- path_get(&fs->pwd);
-
- return fs;
-}
-
-/* ================================================================== */
-/* set_fs_root / set_fs_pwd */
-/* ================================================================== */
-
-void set_fs_root(fs_struct* fs, const path* p)
-{
- path old_root;
- {
- LockGuard guard(fs->lock);
- old_root = fs->root;
- fs->root = *p;
- path_get(p);
- }
- path_put(&old_root);
-}
-
-void set_fs_pwd(fs_struct* fs, const path* p)
-{
- path old_pwd;
- {
- LockGuard guard(fs->lock);
- old_pwd = fs->pwd;
- fs->pwd = *p;
- path_get(p);
- }
- path_put(&old_pwd);
-}