/** * Recursive search for node with string */ fs_node_t* evaluatePath(const char* path, fs_node_t* current_node) { if (!path) { return 0; } if (path[0] == '/') { return evaluatePath(path + 1, get_vfs()); } char* buffer = strchr(path, '/'); if (buffer == 0) { if (strcmp(path, "") == 0) { return current_node; } else { return finddir_fs(current_node, path); } } else { char splitLeftBuffer[buffer - path + 1]; memcpy((void*) splitLeftBuffer, (void*) path, buffer - path); splitLeftBuffer[buffer - path] = '\0'; fs_node_t* temp = finddir_fs(current_node, splitLeftBuffer); if (temp != 0) { return evaluatePath(buffer + 1, temp); } return 0; } }
int chmod_cmd(int argc, char **argv) { if (argc == 2) { TTY* tty = tty_getCurrentTTY(); u32int currentiNode = tty->currDirectory; fs_node_t current; fs_getFsNode(¤t, currentiNode); fs_node_t* file = finddir_fs(¤t, argv[1]); if (file == NULL) { printf("chmod: No such file or directory %s.\n", argv[1]); return -1; } if (!permission_file_isOwner(file)) { printf("chmod: You are not the owner of %s.\n", argv[1]); return -2; } errno = OK; fs_setFileMode(file->inode, htoi(argv[0])); if (errno != OK) { printf ("ERROR %d", errno); } kfree(file); } else { printf("Usage: chmod OCTALMODE FILE"); } return 0; }
// FIXME: idk how to keep track of the current path on the tty int cd_cmd(int argc, char **argv) { if (argc == 1) { TTY* tty = tty_getCurrentTTY(); u32int currentiNode = tty->currDirectory; fs_node_t current; fs_getFsNode(¤t, currentiNode); fs_node_t *node = finddir_fs(¤t, argv[0]); if (node != NULL) { if (FILE_TYPE(node->mask) == FS_SYMLINK) { char name[MAX_NAME_LENGTH]; read_fs(node, 0, MAX_NAME_LENGTH, (u8int*) name); char* n = name; return cd_cmd(1, (char**) &n);; } if (!permission_file_hasAccess(node, R_BIT)) { printf("cd: You don't have read access to %s\n", argv[0]); return -1; } if (FILE_TYPE(node->mask) == FS_DIRECTORY) { tty->currDirectory = node->inode; memcpy(tty->currPath, node->name, strlen(node->name) + 1); } else { printf("cd: %s is not a directory\n", argv[0]); } kfree(node); } else { printf("cd: The directory \"%s\" does not exist\n", argv[0]); } } return 0; }
int chgrp_cmd(int argc, char **argv) { if (argc == 2) { TTY* tty = tty_getCurrentTTY(); u32int currentiNode = tty->currDirectory; fs_node_t current; fs_getFsNode(¤t, currentiNode); fs_node_t* file = finddir_fs(¤t, argv[1]); if (file == NULL) { printf("chown: No such file or directory %s.\n", argv[1]); kfree(file); return -1; } if (!permission_file_isOwner(file)) { printf("chown: You are not the owner of %s.\n", argv[1]); kfree(file); return -2; } errno = OK; int gid = group_find(argv[0]); if (gid == NO_GROUP) { printf("chown: Group %s does not exist.\n", argv[0]); kfree(file); return -2; } else { fs_setFileGid(file->inode, gid); if (errno != OK) { printf ("ERROR %d", errno); } } kfree(file); } else { printf("Usage: chmod OCTALMODE FILE"); } return 0; }
void initrd_list() { u32int i, count; u8int buffer[256]; struct fs_node *node, *root; struct dirent *entry; kprintf("Listing Initial Ramdisk:\n"); i = 1; root = &root_nodes[0]; while((entry = readdir_fs(root, i++)) != NULL) { node = finddir_fs(root, entry->name); ASSERT(node != NULL); if(node->flags & FS_DIRECTORY) { kprintf("Found directory %s\n", node->name); } else { kprintf("Found file %s (%d bytes):\n", node->name, node->length); count = read_fs(node, 0, 255, buffer); buffer[count] = '\0'; kprintf("\t%s\n", buffer); } } }
void listDir(struct fs_node* nodeDir,int level){ int i = 0; struct dirent* node = 0; while ((node=readdir_fs(nodeDir,i))!=0){ fs_node* fsnode = finddir_fs(nodeDir,node->name); for(int i = 0;i<level;i++) kprintf(" "); if (fsnode != NULL){ if ((fsnode->flags&0x7)==FS_DIRECTORY){ kprintf("[%s]\n",trim(fsnode->name)); if (fsnode->name[0]!='.') listDir(fsnode,level+1); } else if ((fsnode->flags&0x1)==FS_FILE){ kprintf("%s\n",fsnode->name); char buf[256]; kprintf("----\n"); unsigned x = 0; while(1==1){ unsigned int sz = read_fs(fsnode,0+x,256,buf); x+=256; if (sz != 0){ for(unsigned int i = 0;i<sz;i++) kprint(buf[i]); } else break; } kprintf("\n----\n"); } //kprintf("\n"); } i++; } }
void fs_dump(int show_content) { int i = 0; struct dirent *node = 0; while ( (node = readdir_fs(fs_root, i)) != 0) { monitor_write("[Entity] "); monitor_write(node->name); fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags&0x7) == FS_DIRECTORY) { monitor_write("[Dir]\n"); } else { monitor_write("[File]\n"); if(show_content) { monitor_write("\n\t Contents: \""); char buf[256]; u32int sz = read_fs(fsnode, 0, 256, buf); int j; for (j = 0; j < sz; j++) putch(buf[j]); monitor_write("\n"); } } i++; } monitor_write("\n"); }
int ln_cmd(int argc, char **argv) { if (argc != 2) { printf("ln: missing file operand\n"); return 0; } u32int currentiNode = tty_getCurrentTTY()->currDirectory; fs_node_t currentFsNode; fs_getFsNode(¤tFsNode, currentiNode); fs_node_t *target = finddir_fs(¤tFsNode, argv[0]); if (target == NULL) { printf("ln: accessing \"%s\": No such file or directory\n", argv[0]); return -1; } // create sym link u32int symLinkiNode = createdir_fs(¤tFsNode, argv[1], FS_SYMLINK); if (symLinkiNode == E_FILE_EXISTS) { printf("ln: accessing \"%s\": File exists\n", argv[1]); return -1; } fs_node_t symLink; fs_getFsNode(&symLink, symLinkiNode); // add contents to sym link //write_fs(&symLink, 0, sizeof(u32int), (u8int*) &target->inode); write_fs(&symLink, 0, MAX_NAME_LENGTH, (u8int*) target->name); kfree(target); return 0; }
/* Init Functions */ int kmsg_init(vfs_node_t * node, const char *name) { uint32_t i, j; vfs_node_t* new_node; dir_block_t* blockdir; dirent_t* dirent; block_list_t* blist; if (BUILTIN_EXPECT(!node || !name, 0)) return -EINVAL; if (BUILTIN_EXPECT(node->type != FS_DIRECTORY, 0)) return -EINVAL; if (finddir_fs(node, name)) return -EINVAL; new_node = kmalloc(sizeof(vfs_node_t)); if (BUILTIN_EXPECT(!new_node, 0)) return -ENOMEM; memset(new_node, 0x00, sizeof(vfs_node_t)); new_node->type = FS_CHARDEVICE; new_node->open = &kmsg_open; new_node->close = &kmsg_close; new_node->read = &kmsg_read; new_node->write = NULL; spinlock_init(&new_node->lock); blist = &node->block_list; do { for (i = 0; i < MAX_DATABLOCKS; i++) { if (blist->data[i]) { blockdir = (dir_block_t *) blist->data[i]; for (j = 0; j < MAX_DIRENTRIES; j++) { dirent = &blockdir->entries[j]; if (!dirent->vfs_node) { dirent->vfs_node = new_node; strncpy(dirent->name, name, MAX_FNAME); return 0; } } } } if (!blist->next) { blist->next = (block_list_t *) kmalloc(sizeof(block_list_t)); if (blist->next) memset(blist->next, 0x00, sizeof(block_list_t)); } } while (blist); kfree(new_node); return -ENOMEM; }
int main(struct multiboot *mboot_ptr) { // Initialise all the ISRs and segmentation init_descriptor_tables(); // Initialise the screen (by clearing it) monitor_clear(); // Find the location of our initial ramdisk. ASSERT(mboot_ptr->mods_count > 0); u32int initrd_location = *((u32int*)mboot_ptr->mods_addr); u32int initrd_end = *(u32int*)(mboot_ptr->mods_addr+4); // Don't trample our module with placement accesses, please! placement_address = initrd_end; // Start paging. initialise_paging(); // Initialise the initial ramdisk, and set it as the filesystem root. fs_root = initialise_initrd(initrd_location); // list the contents of / int i = 0; struct dirent *node = 0; while ( (node = readdir_fs(fs_root, i)) != 0) { monitor_write("Found file "); monitor_write(node->name); fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags&0x7) == FS_DIRECTORY) { monitor_write("\n\t(directory)\n"); } else { monitor_write("\n\t contents: \""); char buf[256]; u32int sz = read_fs(fsnode, 0, 256, buf); int j; for (j = 0; j < sz; j++) monitor_put(buf[j]); monitor_write("\"\n"); } i++; } return 0; }
fs_node_t *search_path(fs_node_t *node, char *path) { fs_node_t *fs_node_at = node; unsigned i; lineint_init(path); for (i = 0; i < lineint_count(); i++) { fs_node_at = finddir_fs(fs_node_at, lineint_index(i)); if (fs_node_at == NULL) break; } return fs_node_at; }
void traverse_initrd() { int i = 0; struct dirent* node = 0; while ((node = readdir_fs(fs_root, i)) != 0) { printf("Found file %s ", node->name); fs_node_t* fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags & 0x7) == FS_DIRECTORY) { printf("[directory]\n"); } else { printf("[file of %d bytes]\n", fsnode->length); } i++; } printf("\n"); }
char * load_initrd_app(char *name, char **argv, char **env) { int argc = 0; while (argv[argc]) { ++argc; } struct dirent* node = 0; for (size_t i = 0; (node = readdir_fs(fs_root_initrd, i)) != 0; ++i) { fs_node_t * fsnode = finddir_fs(fs_root_initrd, node->name); if ((fsnode->flags & 0x7) == FS_DIRECTORY) { } else { char * argv_[] = { name, NULL, NULL, NULL }; int argc_ = 0; while (argv_[argc_]) { argc_++; } printk("\nSearching!\n"); char* buf = malloc_( fsnode->length); printk("%d\n",fsnode->length); u32 sz = read_fs(fsnode, 0, fsnode->length, buf); printk("Size: %d bytes\t Name: %s\n", fsnode->length, node->name); if(strcmp(node->name, name) == 0) { return buf; elf_exec__(buf, sz, name,argc,argv); memset(buf,0,400000); } } } return 0; }
// Displays all files in the file system and their contents. void file_disp(fs_node_t *fs_root) { // The next section of code is not reentrant so make sure we aren't interrupted during. //asm volatile("cli"); // list the contents of / int i = 0; struct dirent *node = 0; while ((node = readdir_fs(fs_root, i)) != 0) { printf("Found file "); printf(node->name); fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags&0x7) == FS_DIRECTORY) { printf("\n\t(directory)\n"); } else { printf("\n\t contents: \""); char buf[256]; u32int sz = read_fs(fsnode, 0, 256, buf); int j; for (j = 0; j < sz; j++) monitor_put(buf[j]); printf("\"\n"); } i++; } // Enable interrupts //asm volatile("sti"); printf("\n"); }
int cp_cmd(int argc, char **argv) { if (argc == 2) { char* source = argv[0]; char* dest = argv[1]; fs_node_t current, *sourceNode; fs_getFsNode(¤t, tty_getCurrentTTY()->currDirectory); sourceNode = finddir_fs(¤t, source); if (sourceNode != NULL) { char* err = NULL; errno = 0; fs_clone(¤t, sourceNode, dest); switch(errno) { case 0: // OK break; case E_FILE_EXISTS: err = "file already exists"; break; case E_FILE_IS_DIR: err = "File is a directory! (use -r)"; break; default: err = "no se que paso!"; log(L_ERROR, "no se q paso: %d", errno); } if (err != NULL) { printf("cp: could not copy %s: %s\n", source, err); return -1; } return 0; } else { printf("cp: Source file: %s does not exists\n", source); } } else { tty_setFormatToCurrTTY(video_getFormattedColor(RED, BLACK)); printf("cp: This feature does not come with Gat O.S. free trial edition.\n"); tty_setFormatToCurrTTY(video_getFormattedColor(MAGENTA, BLACK)); printf("\t\t\tConsider Purchasing it - Ask for teacher discounts!!\n"); } return -1; }
int DMTest2(int argc, char **argv) { char* fileName = "test"; // rm_cmd(1, &fileName); fs_node_t root; fs_getRoot(&root); int inodeNumber = createdir_fs(&root, fileName, FS_FILE); if (inodeNumber == -1) { printf("file already exists\n"); } fs_node_t* file = finddir_fs(&root, fileName); u8int* contents = (u8int*) "Hola Manolo!"; u32int len = strlen((char*) contents) + 1; printf("writing contents..."); // write_fs(file, 0, len, contents); int offset = 0; while(offset++ < len) { write_fs(file, offset, 1, contents + offset); } kfree(file); return 0; }
int touch_cmd(int argc, char **argv) { if(argc == 0 ) { printf("touch: missing operand\n"); } else { errno = 0; fs_node_t current; fs_getFsNode(¤t, tty_getCurrentTTY()->currDirectory); createdir_fs(¤t, argv[0], FS_FILE); char* err = NULL; switch(errno) { case OK: break; case E_ACCESS: err = "No write permission"; break; case E_FILE_EXISTS: err = "File exists"; break; default: printf("errno: %d", errno); err = "Unknown error"; break; } if (errno != 0) { printf("touch: cannot create file %s: %s\n", argv[0], err); return -1; } if (argc == 2) { TTY* tty = tty_getCurrentTTY(); u32int currentiNode = tty->currDirectory; fs_node_t current; fs_getFsNode(¤t, currentiNode); fs_node_t* file = finddir_fs(¤t, argv[0]); write_fs(file, 0, strlen(argv[1]) + 1, (u8int*) argv[1]); kfree(file); } } return 0; }
void listTree() { // list the contents of int i = 0; struct dirent *node = 0; while ((node = readdir_fs(fs_root, i)) != 0) { fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags & 0x7) == FS_DIRECTORY) { print("dir \t", 0x0F); print(node->name, 0x0F); printch('/', 0x0F); } else { print("file\t", 0x0F); print(node->name, 0x0F); } newline(); i++; } }
int rm_cmd(int argc, char **argv) { if (argc == 1) { u32int currentiNode = tty_getCurrentTTY()->currDirectory; fs_node_t current; fs_getFsNode(¤t, currentiNode); fs_node_t *node = finddir_fs(¤t, argv[0]); char* err = NULL; if (node == NULL) { err = "No such file or directory"; } else if (!permission_file_hasAccess(node, W_BIT)){ err = "Don't have write access"; } int removed = 0; if (err == NULL) { removed = removedir_fs(¤t, node->inode); } switch(removed) { case 0: // OK break; case E_FILE_NOT_EXISTS: err = "No such file or directory"; break; case E_ACCESS: err = "No such file or directory"; break; } if (err != NULL) { printf("rm: cannot remove \"%s\": %s\n", argv[0], err); return -1; } log(L_DEBUG, "rm: remove file returned: %d", removed); kfree(node); } return 0; }
int cat_cmd(int argc, char **argv) { if (argc == 1) { fs_node_t current; fs_getFsNode(¤t, tty_getCurrentTTY()->currDirectory); fs_node_t* file = finddir_fs(¤t, argv[0]); char* err = NULL; if (file == NULL) { err = "No such file or directory"; } else if (FILE_TYPE(file->mask) == FS_DIRECTORY) { err = "Is a directory"; } if (err != NULL) { printf("cat: %s: %s\n", argv[0], err); return 0; } if (!permission_file_hasAccess(file, R_BIT)) { printf("cat: You don't have read access to %s", argv[0]); return -1; } if (FILE_TYPE(file->mask) == FS_SYMLINK) { char name[MAX_NAME_LENGTH]; read_fs(file, 0, MAX_NAME_LENGTH, (u8int*) name); char* n = name; return cat_cmd(1, &n); } u8int buff[512]; int offset = 0; int read; while((read = read_fs(file, offset, 512, buff)) != 0) { printf("%s\n", buff); offset += read; } kfree(file); } return 0; }
void launchShell() { initialize_calc(); //allocate some memory for command string buffer. 1kB should be enough for now const int bufSize = 128; char bufStr[bufSize];//Store sanitized user command (no arguments) char rawCommand[bufSize];//Gets user raw command from command line char arguments[bufSize/2][bufSize/2];//Store command arguments int fs = 1;//First space (first word means actual command) int ay = -1;//Y location for arguments int ax = 0;//X location for argumetns //prepare variable for(int i = 0; i < bufSize; ++i){ bufStr[i] = 0; } for(int y = 0; y < bufSize; ++y){ for(int x = 0; x < bufSize; ++x){ arguments[y][x] = 0; } } #define TIP print("\nTip: If enter key does not work, it might mean that the input is too long",0x0F); #define HELP print("\nWorking Commands in Q OS: \nwriter\nclear\nexecute\nhi\nskip (the no action)\nfiles\ncat\nreboot\ncalc", 0x0F); #define BIGHELP kbHelp(); TIP; HELP; #define SYSTEMMAN system(arguments); #define SAYHI print("\nHello!", 0x3F); #define CATFILE print("\nFile Name> ", 0x0F); readStr(bufStr, bufSize); ASSERT(strlength(bufStr) < MAX_FNAME_LEN); cat(finddir_fs(fs_root, bufStr)); #define SWITCHDIR print("\nThe specified directory was not found ", 0x0F); #define CALCULATE calc(arguments); #define BIGCLEAR clearScreen(); printIntro(); #define MKDIR print("\nThis Command is Reserved for when we have a FAT32 or better FileSystem...", 0x3F); #define RMFILE print("\nThis Command is Reserved for when we have a FAT32 or better FileSystem...", 0x3F); #define SKIP skip(rawCommand); #define FILEMAN files(arguments); #define WRITE writer(arguments); #define ME me(rawCommand); #define CMDNOTFOUND print("\n", 0x0F); print(bufStr, 0x0F); print(": Command Not Found ", 0x0F); while (true) { print("\nQ-Kernel> ", 0x08); typingCmd = true; newCmd = true; readStr(rawCommand, bufSize); typingCmd = false; for(int i = 0; i < bufSize; ++i){ bufStr[i] = 0; } for(int y = 0; y < bufSize; ++y){ for(int x = 0; x < bufSize; ++x){ arguments[y][x] = 0; } } fs = 1; ay = -1; ax = 0; if(MULTI_ARG_DEBUG == true) { //Sanitize raw input. Move first word to bufStr and move the rest of the word to arguments for(int i = 0; i < bufSize; ++i) { if(rawCommand[i] != 0 || rawCommand[i] != 10) { if(fs == 1) bufStr[i] = rawCommand[i]; else if(fs == 0) arguments[ay][ax] = rawCommand[i]; if(i < bufSize && rawCommand[i+1] == 32) { fs = 0; ay++; } } else break; } } else { //Sanitize raw input. Move first word to bufStr and move the rest of the word to arguments for(int i = 0; i < bufSize; ++i) { if(rawCommand[i] != 0 || rawCommand[i] != 10) { if(fs == 1) bufStr[i] = rawCommand[i]; if(i < bufSize && rawCommand[i+1] == 32) { fs = 0; ay++; ax = 0; } else if(fs == 0) { arguments[ay][ax] = rawCommand[i]; ax++; } } else break; } } if (strEql(strTrim(bufStr), "")) { HELP; } else if(strEql(bufStr, "help")) { BIGHELP; } else if(strEql(bufStr, "system")) { SYSTEMMAN; } else if(strEql(bufStr, "skip")) { SKIP; } else if(strEql(bufStr, "hi")) { SAYHI; } else if(strEql(bufStr, "files")) { FILEMAN; } else if(strEql(bufStr, "cat")) { CATFILE; } else if(strEql(bufStr,"execute")) { execute(); } else if(strEql(bufStr,"switch")) { SWITCHDIR; } else if(strEql(bufStr,"writer")) { WRITE; } else if(strEql(bufStr, "calc")) { CALCULATE; } else if(strEql(bufStr, "clear")) { clearScreen(); } else if(strEql(bufStr, "clear -i")) { BIGCLEAR; } else if(strEql(bufStr, "newdir")) { MKDIR; } else if(strEql(bufStr, "erase")) { RMFILE; } else if(strEql(bufStr, "me")) { ME; } else if(strEql(bufStr, "search")) { print("\nDictionary File Name> ", 0x0F); readStr(bufStr, bufSize); ASSERT(strlength(bufStr) < MAX_FNAME_LEN); findInDictionary(finddir_fs(fs_root, bufStr),1013,"ACCEPT"); } else { CMDNOTFOUND; } newline(); } }
void launchShell() { //allocate some memory for command string buffer. 1kB should be enough for now const int bufSize = 128; char bufStr[bufSize]; while (true) { print("\nQ-Kernel> ", 0x08); typingCmd = true; newCmd = true; readStr(bufStr, bufSize); typingCmd = false; if (strEql(strTrim(bufStr), "")) { print(COMMAND_HELP, 0x0F); } else if(strEql(bufStr, "help")) { kbHelp(); println(PRO_TIP, 0x0F); print(COMMAND_HELP, 0x0F); } else if(strEql(bufStr, "reboot")) { //reboots the computer reboot(); } else if(strEql(bufStr, "skip")) { // It literally does nothing... (Useful at callback) } else if(strEql(bufStr, "hi")) { print("\nHello!", 0x3F); } else if(strEql(bufStr, "files")) { newline(); listTree(); } else if(strEql(bufStr, "cat")) { print("\nFile Name> ", 0x0F); readStr(bufStr, bufSize); ASSERT(strlength(bufStr) < MAX_FNAME_LEN); catFile(finddir_fs(fs_root, bufStr)); } else if(strEql(bufStr,"execute")) { execute(); } else if(strEql(bufStr,"switch")) { print("\nThe specified directory was not found ", 0x0F); } else if(strEql(bufStr,"writer")) { writer(); } else if(strEql(bufStr, "writer -h")) { writerHelp(); } else if(strEql(bufStr, "calc")){ calc(); } else if(strEql(bufStr, "calc -h")){ calcHelp(); } else if(strEql(bufStr, "clear")) { clearScreen(); cursorX = 0; cursorY = 0; updateCursor(); } else if(strEql(bufStr, "clear -i")) { clearScreen(); printIntro(); } else if(strEql(bufStr, "newdir")) { print("\nReserved", 0x0F); } else if(strEql(bufStr, "erase")) { print("\nReserved", 0x0F); } else { print("\nCommand Not Found ", 0x0F); } newline(); } }
int main(struct multiboot *mboot_ptr, u32int initial_stack) { initial_esp = initial_stack; // Initialise all the ISRs and segmentation init_descriptor_tables(); // Initialise the screen (by clearing it) monitor_clear(); // Initialise the PIT to 100Hz asm volatile("sti"); init_timer(50); // Find the location of our initial ramdisk. ASSERT(mboot_ptr->mods_count > 0); u32int initrd_location = *((u32int*)mboot_ptr->mods_addr); u32int initrd_end = *(u32int*)(mboot_ptr->mods_addr+4); // Don't trample our module with placement accesses, please! placement_address = initrd_end; // Start paging. initialise_paging(); // Start multitasking. initialise_tasking(); // Initialise the initial ramdisk, and set it as the filesystem root. fs_root = initialise_initrd(initrd_location); // Create a new process in a new address space which is a clone of this. int ret = fork(); monitor_write("fork() returned "); monitor_write_hex(ret); monitor_write(", and getpid() returned "); monitor_write_hex(getpid()); monitor_write("\n============================================================================\n"); // The next section of code is not reentrant so make sure we aren't interrupted during. asm volatile("cli"); // list the contents of / int i = 0; struct dirent *node = 0; while ( (node = readdir_fs(fs_root, i)) != 0) { monitor_write("Found file "); monitor_write(node->name); fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags&0x7) == FS_DIRECTORY) { monitor_write("\n\t(directory)\n"); } else { monitor_write("\n\t contents: \""); char buf[256]; u32int sz = read_fs(fsnode, 0, 256, buf); int j; for (j = 0; j < sz; j++) monitor_put(buf[j]); monitor_write("\"\n"); } i++; } monitor_write("\n"); asm volatile("sti"); return 0; }