diff options
-rw-r--r-- | mkfs.md/mkfs.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/mkfs.md/mkfs.c b/mkfs.md/mkfs.c index 37c6e6e..68ddc3f 100644 --- a/mkfs.md/mkfs.c +++ b/mkfs.md/mkfs.c @@ -29,8 +29,8 @@ int main(int argc, char *argv[]) #endif if (argc != 2){ - printf("Uso: %s [file]\n" - "Necesita proveer un nombre para el filesystem", + printf("Usage: %s [file]\n" + "The filesystem needs a name", argv[0]); return -2; } @@ -39,26 +39,27 @@ int main(int argc, char *argv[]) fs = calloc (BLOCKS*BLOCK_SIZE, sizeof(char)); if (!fs){ - fprintf(stderr, "No hay suficiente memoria para alocar el filesystem\n"); + fprintf(stderr, "Cannot alloc %d bytes\n", (int) BLOCKS*BLOCK_SIZE); return (1); } sb = (struct superblock *) fs; - sb->magic = 0xF514; /* No hay ganas de hacer aritmetica con lo que esta en el defs.h */ + sb->magic = 0xF514; sb->max_size = BLOCK_SIZE * BLOCKPOOL_BLOCKS; sb->free_size = BLOCK_SIZE * BLOCKPOOL_BLOCKS; - SET_BIT_1((char *)sb + FBB_OFFSET, 0); - /* El primer elemento del inodepool es el rootdir */ + SET_BIT_1((char *)sb + FBB_OFFSET, 0); + /* the first inode is the rootdir */ SET_BIT_1((char*) sb + FIB_OFFSET, 1); - - + + rootdir = (inode *) sb + INODEPOOL_OFFSET + sizeof(inode); - + rootdir->type = I_DIR; - rootdir->mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP | S_IROTH | S_IXOTH | S_IFDIR; + rootdir->mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP | + S_IROTH | S_IXOTH | S_IFDIR; rootdir->uid = getuid(); rootdir->gid = getgid(); - rootdir->indirect=2; + rootdir->indirect=2; rootdir->atime = (uint32_t) time(NULL); rootdir->ctime = (uint32_t) time(NULL); rootdir->mtime = (uint32_t) time(NULL); @@ -69,7 +70,7 @@ int main(int argc, char *argv[]) rootdir->size = 0; #else rootdir->size = sizeof(direntry); - /* Primer bloque */ + /* First block */ /*SET_BIT_1((char *)sb + FBB_OFFSET, 0); */ dentry = (direntry *) sb + BLOCKPOOL_OFFSET; dentry->inode = 0; |