SayoriOS  0.3.3
tempfs.h
1 #ifndef SAYORIOS_TEMPFS_H
2 #define SAYORIOS_TEMPFS_H
3 
4 #include "../../include/portability.h"
5 #include <stdarg.h>
6 
7 #define tfs_log(M,...); printf(M,##__VA_ARGS__);
8 
9 #define TEMPFS_CHMOD_EXEC 0x01
10 #define TEMPFS_CHMOD_WRITE 0x02
11 #define TEMPFS_CHMOD_READ 0x04
12 #define TEMPFS_CHMOD_SYS 0x08
13 
14 
15 #define TEMPFS_DIR_INFO_ROOT 0x01
16 #define TEMPFS_DIR_INFO_EXITS 0x02
17 
18 #define TEMPFS_ENTITY_STATUS_ERROR 0x00
19 #define TEMPFS_ENTITY_STATUS_READY 0x01
20 #define TEMPFS_ENTITY_STATUS_PKG_READY 0x02
21 
22 #define TEMPFS_ENTITY_TYPE_UNKNOWN 0x00
23 #define TEMPFS_ENTITY_TYPE_FILE 0x01
24 #define TEMPFS_ENTITY_TYPE_FOLDER 0x02
25 
26 
27 typedef struct {
28  uint8_t Status;
29  char Name[64];
30  char Path[412];
31  uint32_t Size;
32  uint32_t Point;
33  uint32_t Date;
34  char Owner[16];
35  uint8_t Type;
36  uint8_t CHMOD;
37 } TEMPFS_ENTITY; // Получится 512 байт
38 
39 typedef struct {
40  uint16_t Sign1;
41  uint16_t Sign2;
42  char Label[32];
43  uint32_t CountFiles;
44  uint32_t EndDisk;
45  uint32_t CountBlocks;
46  char Rev[16];
47 } TEMPFS_BOOT;
48 
49 typedef struct {
50  uint8_t Status;
51  uint16_t Length;
52  uint32_t Next;
53  char Data[500];
54  uint8_t Rev;
55 } TEMPFS_PACKAGE; // Получится 512 байт
56 
57 typedef struct {
58  uint8_t Status;
60  size_t CountFiles;
62  size_t BlocksAll;
63  size_t FreeAll;
64  size_t EndPoint;
65 } TEMPFS_Cache;
66 
67 FSM_FILE fs_tempfs_info(const char Disk, const char* Path);
68 FSM_DIR* fs_tempfs_dir(const char Disk, const char* Path);
69 int fs_tempfs_create(const char Disk,const char* Path,int Mode);
70 int fs_tempfs_delete(const char Disk,const char* Path,int Mode);
71 void fs_tempfs_label(const char Disk, char* Label);
72 int fs_tempfs_detect(const char Disk);
73 void fs_tempfs_format(const char Disk);
74 size_t fs_tempfs_write(const char Disk, const char* Path, size_t Offset, size_t Size, void* Buffer);
75 size_t fs_tempfs_read(const char Disk, const char* Path, size_t Offset, size_t Size, void* Buffer);
76 
77 #define TMF_GETDISKSIZE(Ch) dpm_disk_size(Ch)
78 
79 #endif //SAYORIOS_TEMPFS_H
uint16_t Sign1
Сигнатура 1.
Definition: tempfs.h:40
uint16_t Sign2
Сигнатура 2.
Definition: tempfs.h:41
uint32_t CountFiles
Количество файлов
Definition: tempfs.h:43
uint32_t EndDisk
Точка конца диска
Definition: tempfs.h:44
uint32_t CountBlocks
Количество используемых блоков
Definition: tempfs.h:45
TEMPFS_BOOT * Boot
Ссылка на Boot.
Definition: tempfs.h:59
size_t FreeAll
Свободное количество блоков
Definition: tempfs.h:63
uint8_t Status
Статус
Definition: tempfs.h:58
TEMPFS_ENTITY * Files
Ссылка на Файловые поинты
Definition: tempfs.h:61
size_t BlocksAll
Максимальное количество блоков информации
Definition: tempfs.h:62
size_t CountFiles
Количество файлов
Definition: tempfs.h:60
size_t EndPoint
Точка конца диска
Definition: tempfs.h:64
uint32_t Size
Размер файла в байтах (только для файлов)
Definition: tempfs.h:31
uint8_t CHMOD
Права доступа
Definition: tempfs.h:36
uint32_t Date
Дата изменения
Definition: tempfs.h:33
uint8_t Status
Статус
Definition: tempfs.h:28
uint32_t Point
Точка входа в файл | папки
Definition: tempfs.h:32
uint8_t Type
Тип файл или папки
Definition: tempfs.h:35
uint32_t Next
Следующий пакет данных
Definition: tempfs.h:52
uint8_t Rev
Зарезервировано, всегда ноль
Definition: tempfs.h:54
uint8_t Status
Статус пакета
Definition: tempfs.h:50
uint16_t Length
Длина пакета
Definition: tempfs.h:51