diff --git a/fdisk/Makefile b/fdisk/Makefile index 4ac7a92..a5cff74 100644 --- a/fdisk/Makefile +++ b/fdisk/Makefile @@ -47,4 +47,4 @@ # Clean Up The junk clean: - $(REMOVE) $(OBJS) $(BINARY) + $(REMOVE) $(OBJS) $(BINARY) *.core diff --git a/format/main.c b/format/main.c index 5eb408e..6c8722c 100644 --- a/format/main.c +++ b/format/main.c @@ -42,12 +42,12 @@ int main(int argc,char **argv) { FILE *fd; - struct ubixDiskLabel *d = (struct ubixDiskLabel *)malloc(512); + struct ubixDiskLabel *d = (struct ubixDiskLabel *)malloc(512); ubixfs_superBlock *sb = (ubixfs_superBlock *)malloc(sizeof(ubixfs_superBlock)); - int ch = 0x0; - int i = 0x0; - int x = 0x0; - short bat = 0x0; + int ch = 0x0; + int i = 0x0; + int x = 0x0; + short batSize = 0x0; u_int32_t blocks = 0x0; u_int32_t batSect = 0x0; char sector[512]; @@ -113,22 +113,24 @@ } } - blocks = (d->partitions[i].p_size - 1) / 8; - bat = (d->partitions[i].p_size - 1) % 8; + blocks = (d->partitions[i].p_size - 1) / 8; + batSize = (d->partitions[i].p_size - 1) % 8; - while ((bat * 4096) < blocks) { - bat += 0x4; + while ((batSize * 4096) < blocks) { + batSize += 0x4; blocks--; } batSect = (d->partitions[i].p_offset + 1) + (blocks * 8); + + /* write super block here */ if (fseek(fd,d->partitions[i].p_offset * 512,0x0) != 0x0) { fprintf(stderr, "Error: fseek failed\n"); exit(0x1); } + fwrite(sb,512,1,fd); - /* write super block here */ /* Write BAT */ if (fseek(fd,batSect * 512,0x0) != 0x0) { @@ -136,11 +138,12 @@ exit(0x1); } memset(sector,0x69,512); - fwrite(sector,512,1,fd); + fwrite(sector,512,batSize,fd); /* Print debug info */ + printf("blocks: [%i]\n",blocks); printf("batSect: [%i]\n",batSect); - printf("bat: [%i]\n",bat); + printf("batSize: [%i]\n",batSize); printf("d->partitions[%i].p_offset = %i\n",i,d->partitions[i].p_offset); printf("d->partitions[%i].p_size = %i\n",i,d->partitions[i].p_size); printf("d->partitions[%i].p_bsize = 0x%X\n",i,d->partitions[i].p_bsize); @@ -156,6 +159,9 @@ /*** $Log$ + Revision 1.2 2004/09/03 08:15:09 reddawg + ok + Revision 1.1 2004/09/01 09:26:13 reddawg frame works are laid out