-
Notifications
You must be signed in to change notification settings - Fork 3
/
shell.h
78 lines (63 loc) · 2.36 KB
/
shell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef _SHELL_H_
#define _SHELL_H_
#include "disk.h"
typedef struct
{
unsigned short year;
unsigned char month;
unsigned char day;
unsigned char hour;
unsigned char minute;
unsigned char second;
} SHELL_FILETIME;
typedef struct SHELL_ENTRY
{
struct SHELL_ENTRY* parent;
unsigned char name[256];
unsigned char isDirectory;
unsigned int size;
unsigned short permition;
SHELL_FILETIME createTime;
SHELL_FILETIME modifyTime;
char pdata[1024];
} SHELL_ENTRY;
typedef struct SHELL_ENTRY_LIST_ITEM
{
struct SHELL_ENTRY entry;
struct SHELL_ENTRY_LIST_ITEM* next;
} SHELL_ENTRY_LIST_ITEM;
typedef struct
{
unsigned int count;
SHELL_ENTRY_LIST_ITEM* first;
SHELL_ENTRY_LIST_ITEM* last;
} SHELL_ENTRY_LIST;
struct SHELL_FILE_OPERATIONS;
typedef struct SHELL_FS_OPERATIONS
{
int ( *read_dir )( DISK_OPERATIONS*, struct SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, SHELL_ENTRY_LIST* );
int ( *stat )( DISK_OPERATIONS*, struct SHELL_FS_OPERATIONS*, unsigned int*, unsigned int* );
int ( *mkdir )( DISK_OPERATIONS*, struct SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, const char*, SHELL_ENTRY* );
int ( *rmdir )( DISK_OPERATIONS*, struct SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, const char* );
int ( *lookup )( DISK_OPERATIONS*, struct SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, SHELL_ENTRY*, const char* );
struct SHELL_FILE_OPERATIONS* fileOprs;
void* pdata;
} SHELL_FS_OPERATIONS;
typedef struct SHELL_FILE_OPERATIONS
{
int ( *create )( DISK_OPERATIONS*, SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, const char*, SHELL_ENTRY* );
int ( *remove )( DISK_OPERATIONS*, SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, const char* );
int ( *read )( DISK_OPERATIONS*, SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, SHELL_ENTRY*, unsigned long, unsigned long, char* );
int ( *write )( DISK_OPERATIONS*, SHELL_FS_OPERATIONS*, const SHELL_ENTRY*, SHELL_ENTRY*, unsigned long, unsigned long, const char* );
} SHELL_FILE_OPERATIONS;
typedef struct
{
char* name;
int ( *mount )( DISK_OPERATIONS*, SHELL_FS_OPERATIONS*, SHELL_ENTRY* );
void ( *umount )( DISK_OPERATIONS*, SHELL_FS_OPERATIONS* );
int ( *format )( DISK_OPERATIONS*);
} SHELL_FILESYSTEM;
int init_entry_list( SHELL_ENTRY_LIST* list );
int add_entry_list( SHELL_ENTRY_LIST*, struct SHELL_ENTRY* );
void release_entry_list( SHELL_ENTRY_LIST* );
#endif