文件系统的设计与实现(操作系统课程设计)

您所在的位置:网站首页 文件系统设计程序 文件系统的设计与实现(操作系统课程设计)

文件系统的设计与实现(操作系统课程设计)

2024-07-09 20:03| 来源: 网络整理| 查看: 265

 #include

#include

#include

#include

#include

#include

#include

#include

#define getb(type) (type*)malloc(sizeof(type))

using namespace std;

int usernowpride;//全局变量,当前用户类型

char usernowname[10];//全局变量,当前用户名

int nowlevel; //全局变量,当前目录层次

char usernowpath[200] = "\\\0"

//用户类型定义

struct user

{

char name[10];//用户名

int pride;//用户权限,1为管理员,0为普通用户

char pass[10];//用户密码

};

 

//定义空白区项

struct freeb

{

int number;

struct freeb * next;

};

struct freeb *fblk=NULL;//全局变量,系统空闲区链

 

//定义文件打开项

struct fileb

{

int parent;//所在父节点

char name[15];//文件名

int pride;//读写权限,0只读,1读写

int  rex;//读写状态,0为没有,1读2写

struct fileb * next;

};

struct fileb *flink=NULL;//全局变量,系统打开文件链

 

//定义文件索引项

struct findex

{

char name[15];

int number;

int parent;

char kind;

struct findex * next;

};

struct findex *fidx=NULL;//全局变量,文件索引链

 

//定义目录表项

struct dreitem

{

char name[25];//目录或者文件名称

int share; //共享数

int parent;//上层目录

int pride;//文件操作权限,0只读,1读写

int empty;//是否是空闲块,0为空闲块,1为非空

char kind;//类型,文件为f,目录为d

};

 

#include"FSMain.h"

//新建用户

bool createuser()

{

struct user newuser;

char name[10];

char pass[10];

int pride;

if(usernowpride!=1)

{

cout



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3