📄 fs.h
字号:
/** * fs.h - A set of APIs that used to handle files and devices. but Bycore has * not supported any file system yet. * * Copyright (C) 2008 ZhangHu * All rights reserved. * E-MAIL: anmnmnly@gmail.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */#ifndef __FS_H__#define __FS_H__#include "include/types.h"#include "include/list.h"#include "drivers/device.h"#define FS_CHDEV 0x00 /* Char device */#define FS_BLKDEV 0x01 /* Block device */#define MODE_MASK 0x0FF#define BLOCK_MASK 0xF00 /* Reserved */typedef struct _node { uword_t fd; /* File descriptor */ device_t *device; /* Pointer to device_t */ slist_t link; /* Joint to a TCB that gain it */}file_node;/* open - Open a device */word_t open(const char *path); /* Pointer to a string that describes the name of a device. *//* write - Write data to a device */uword_t write(word_t fd, /* A file descriptor */ const char_t *buf,/* Pointer to a data buffer */ uword_t nbytes); /* The length of data buffer. *//* read - Read data from a device */uword_t read(word_t fd, /* A file descriptor */ char_t *buf, /* Pointer to a data buffer */ uword_t nbytes); /* The length of data buffer. *//* llseek - Modifies write-read offset of a device */loff_t llseek(word_t fd, /* A file descriptor */ loff_t loff); /* New write-read offset. *//* ioctl - Modifies properties of a device */word_t ioctl(word_t fd, /* A file descriptor */ uword_t cmd, /* Command cord */ void *arg); /* Pointer to parameters of command *//* close - Close a device */word_t close(word_t fd); /* A file descriptor */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -