/*! Formats the file system. */ static void do_format(void) { printf("Formatting file system..."); free_map_create(); if (!dir_create(ROOT_DIR_SECTOR, 16)) PANIC("root directory creation failed"); free_map_close(); printf("done.\n"); }
/* Formats the file system. */ static void do_format (void) { printf ("Formatting file system..."); free_map_create (); if (!dir_create (ROOT_DIR_SECTOR, 2)) PANIC ("root directory creation failed"); if (dir_add(dir_open_root (), ".", ROOT_DIR_SECTOR, true) == NULL || dir_add(dir_open_root (), "..", ROOT_DIR_SECTOR, true) == NULL ){ PANIC ("root directory added . or .. failed"); } free_map_close (); printf ("done.\n"); }
/* Formats the file system. */ static void do_format (void) { struct dir *root_dir = dir_open_root(); struct inode *root_inode = dir_get_inode(root_dir); printf ("Formatting file system..."); free_map_create (); if (!dir_create (ROOT_DIR_SECTOR, 16)) PANIC ("root directory creation failed"); /* add . and .. entry to root directory */ dir_add(root_dir, ".", inode_get_inumber(root_inode)); dir_add(root_dir,"..", inode_get_inumber(root_inode)); free_map_close (); printf ("done.\n"); }
/* Formats the file system. */ static void do_format (void) { printf ("Formatting file system..."); free_map_create (); if (!dir_create (ROOT_DIR_SECTOR, 16)) PANIC ("root directory creation failed"); free_map_close (); struct dir *root = dir_open_root (); dir_add (root, ".", ROOT_DIR_SECTOR); dir_add (root, "..", ROOT_DIR_SECTOR); dir_close (root); printf ("done.\n"); }
/* Formats the file system. */ static void do_format (void) { struct dir *current_dir; printf ("Formatting file system..."); free_map_create (); /*Create directory with 2 entries - for . and .. */ if (!dir_create (ROOT_DIR_SECTOR, 2)) PANIC ("root directory creation failed"); free_map_close (); /* Create . and .. entries. */ current_dir = dir_open_root (); dir_add (current_dir, ".", ROOT_DIR_SECTOR, false); dir_add (current_dir, "..", ROOT_DIR_SECTOR, false); dir_close (current_dir); printf ("done.\n"); }