From e90b72ec3082588b296956730bd2930cf8d5d671 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Fri, 10 Jul 2026 11:31:46 +0800 Subject: 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. --- include/fs/file.h | 78 ------------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 include/fs/file.h (limited to 'include/fs/file.h') diff --git a/include/fs/file.h b/include/fs/file.h deleted file mode 100644 index 9aff1af..0000000 --- a/include/fs/file.h +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (C) 2026 Richard QIn - */ - -#pragma once -#include "common/types.h" -#include "fs/fs.h" - -enum FileType -{ - FD_NONE, - FD_INODE, - FD_DEVICE, - FD_PIPE -}; - -class Pipe; - -struct file -{ - enum FileType type; - int ref; - char readable; - char writable; - - Pipe *pipe; // pipeline pointer - Inode *ip; // VFS Inode - uint32 off; // Current Offset -}; - -class Pipe -{ -public: - static constexpr uint32_t SIZE = 512; - - Pipe() : nread(0), nwrite(0), read_open(true), write_open(true) - { - lock.init("pipe"); - } - - // forbid copy - Pipe(const Pipe &) = delete; - Pipe &operator=(const Pipe &) = delete; - - ~Pipe() - { - // - } - - // creates a pair of connected file objects - static int create_pair(struct file **f0, struct file **f1); - - int read(uint64_t addr, int n); - int write(uint64_t addr, int n); - void close(bool is_writer); - -private: - Spinlock lock; - char data[SIZE]; - uint32_t nread; // read - uint32_t nwrite; // write - bool read_open; - bool write_open; -}; - -namespace FileTable -{ - void init(); - struct file *alloc(); // Allocate a free file handle - struct file *dup(struct file *f); // Duplicate handle (sys_dup) - void close(struct file *f); // Close handle - - int stat(struct file *f, uint64 addr); - int read(struct file *f, uint64 addr, int n); - int write(struct file *f, uint64 addr, int n); - int lseek(struct file *f, int offset, int whence); -} // namespace FileTable -- cgit v1.2.3