diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2016-02-29 05:42:25 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2016-02-29 05:42:25 -0300 |
commit | 5a118d913127f6c39e94c26c0aabe26209832340 (patch) | |
tree | 6dd0a5bc0e481ddd3fdf53e74fabdb1291b5c413 /mkfs.md | |
parent | 91d18b3e570bb867e15879459653c927ecacd044 (diff) | |
download | medianinfs-5a118d913127f6c39e94c26c0aabe26209832340.tar.gz |
Fix indentation and translate mkfs
Diffstat (limited to 'mkfs.md')
-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; |