⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 define.h

📁 对linuix 文件系统的模拟,包含了若干文件命令
💻 H
字号:
#ifndef DEFINE_H_INCLUDED
#define DEFINE_H_INCLUDED


namespace gilyou
{

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned char uchar;
typedef unsigned long disk_t;

////////////////////////
#define DEBUG 0
////////////////////////

/***************** 各种权限类型 *************************/
const static uint SELF_AUTH = 000000000700;
const static uint GROUP_AUTH = 000000000070;
const static uint OTHER_AUTH = 000000000007;

const static int ENTER = 1;

/***************** 各种掩码类型 *************************/
const static uint AUTH_READ = 0000004;
const static uint AUTH_WRITE = 0000002;
const static uint AUTH_EXEC = 0000001;
const static uint AUTH_NEED = 0000000;

const static uint INODE_EMPTY = 0xFFFF;

/**************** 打印模式 *****************/
const static uchar GENERIC = 0x00;
const static uchar INDENT = 0x01;
const static uchar NEW_LINE = 0x02;

/************** 用户是否被删标记 *****************/
const static uint DELETED = 1;
const static uint NOT_DELETED = 0;

/************************ 各种操作返回类型 *************************/
const static uchar OK_EXIT = 0x00;
const static uchar SUCCESS = 0x01;
const static uchar YES = 0x01;
const static uchar OK = 0x01;
const static uchar FAILTURE = 0xFF;
const static uchar READ_FILE_ERROR = 0xFF;
const static uchar WRITE_FILE_ERROR = 0xFE;
const static uchar NO = 0xFF;
const static uchar ALREADY_EXISTS = 0x02;
const static uchar NOT_EXISTS = 0xFE;
const static uchar BAD_CHARACTER = 0xFD;
const static uchar DISK_BROKEN = 0xFD;

/******************* 各种权限所占位数 ************************/
const static uchar MASK_BITS = 0x09;
const static uchar UID_BITS = 0x0A;
const static uchar GID_BITS = 0x0A;
const static uchar MODE_BITS = 0x03;
const static uchar SELF_BITS = 0x03;
const static uchar GROUP_BITS = 0x03;
const static uchar OTHER_BITS = 0x03;

/***************** 各种文件类型 *************************/
const static uchar GENERIC_FILE = 0x01;
const static uchar DIRECT_FILE = 0x02;
const static uchar LINK_FILE = 0x04;
const static uchar PIPE_FILE = 0x08;
const static uchar BLOCK_DEVICE = 0x10;
const static uchar CHARA_DEVICE = 0x20;

const static uint BUFF_SIZE = 20;
const static uint DISK_BLOCK_SIZE = 80;
const static uint I_DIR_SIZE = 40;

const static int LOGOUT = 1;

/****************** 磁盘是否使用标记 ********************/
const static uint ALREADY_USED = 1;
const static uint NOT_USED = 0;

/*
const static int NONEOT_MODE = 0;
const static int BOTTOM_MODE = 1;
const static int RECTAN_MODE = 2;
const static int CENTER_MODE = 3;
const static int OPENSN_MODE = 4;
const static int CLOSES_MODE = 5;
*/

enum COMMANDS{COMMAND_NOT_DEFINED,COMMAND_VERSION,COMMAND_SYNC,COMMAND_FULLSCREEN,COMMAND_CLEAR,COMMAND_EXIT,COMMAND_LOGOUT,COMMAND_CD,COMMAND_CP,COMMAND_LS,COMMAND_MKDIR,COMMAND_RMDIR,COMMAND_CHMOD,COMMAND_DELUSR,COMMAND_ADDUSR,COMMAND_MV,COMMAND_HISTORY};

////////////////////////
const static uint BLOCK_SIZE = 1024;
const static uint COMMAND_SIZE = 100;
const static char SYS_USER[] = "sys\\usr.info";
extern char HOST_NAME[];
extern char hists[][BUFF_SIZE];
extern uint hist_ptr;
////////////////////////

}

#endif // DEFINE_H_INCLUDED

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -