diff --git a/tpfs/Makefile b/tpfs/Makefile index 37ec93b46bcdd0a8eb653faf081d63ee40dda83c..59448648016ddde4ca30200810e0953ab78a2e63 100644 --- a/tpfs/Makefile +++ b/tpfs/Makefile @@ -13,7 +13,7 @@ LIBS = -L$(LIBDIR) -lhardware ###------------------------------ ### Main targets ###------------------------------------------------------------ -BINARIES= mkhd display_sector format_sector write_sector mkvol dvol rmvol +BINARIES= mkhd display_sector format_sector write_sector mkvol dvol rmvol mknfs all: $(BINARIES) $(OBJECTS) @@ -34,6 +34,7 @@ write_sector: write_sector.o drive.o mkvol: mkvol.o vol.o drive.o dvol: dvol.o vol.o drive.o rmvol: rmvol.o vol.o drive.o +mknfs: mknfs.o vol.o drive.o ###------------------------------ ### Misc. diff --git a/tpfs/mknfs.c b/tpfs/mknfs.c new file mode 100644 index 0000000000000000000000000000000000000000..96ea5f327b6e6757108aef6ac14defa939a86c51 --- /dev/null +++ b/tpfs/mknfs.c @@ -0,0 +1,45 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "hardware.h" +#include "vol.h" + +static void +empty_it() +{ + return; +} + +int main(int argc, char const *argv[]) +{ + unsigned int i; + + /* init hardware */ + if (init_hardware("hwconfig.ini") == 0) + { + fprintf(stderr, "Error in hardware initialization\n"); + exit(EXIT_FAILURE); + } + + /* Interreupt handlers */ + for (i = 0; i < 16; i++) + IRQVECTOR[i] = empty_it; + + /* Allows all IT */ + _mask(1); + + if (argc != 3) + { + fprintf(stderr, "Usage: %s <volume> <volume name>\n", argv[0]); + exit(EXIT_FAILURE); + } + + load_mbr(); + init_volume(atoi(argv[1]), (char *)argv[2]); + save_super(); + load_super(atoi(argv[1])); + printf("cool\n"); + + /* and exit! */ + exit(EXIT_SUCCESS); +}