apps,nanos-lite,fs: better initialization code

This commit is contained in:
Zihao Yu 2017-08-11 23:12:29 +08:00
parent da3d482dae
commit caae4767a5
1 changed files with 5 additions and 4 deletions

View File

@ -7,19 +7,20 @@ typedef struct {
off_t open_offset;
} Finfo;
enum {FD_STDIN, FD_STDOUT, FD_STDERR, FD_FB, FD_EVENTS, FD_DISPINFO, FD_NORMAL};
/* This is the information about all files in disk. */
static Finfo file_table[] __attribute__((used)) = {
{"stdin (note that this is not the actual stdin)", 0, 0},
{"stdout (note that this is not the actual stdout)", 0, 0},
{"stderr (note that this is not the actual stderr)", 0, 0},
{"/dev/fb", 0, 0},
{"/dev/events", 0, 0},
{"/proc/dispinfo", 128, 0},
[FD_FB] = {"/dev/fb", 0, 0},
[FD_EVENTS] = {"/dev/events", 0, 0},
[FD_DISPINFO] = {"/proc/dispinfo", 128, 0},
#include "files.h"
};
#define NR_FILES (sizeof(file_table) / sizeof(file_table[0]))
enum {FD_STDIN, FD_STDOUT, FD_STDERR, FD_FB, FD_EVENTS, FD_DISPINFO, FD_NORMAL};
void init_fs() {
file_table[FD_FB].size = _screen.width * _screen.height * sizeof(uint32_t);