Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bbn!rochester!udel!mmdf From: mmdf@udel.UUCP Newsgroups: comp.os.minix Subject: Re: DOS[READ\WRITE\DIR] on hard disk (the saga continues) Message-ID: <2854@louie.udel.EDU> Date: 2 Jun 88 21:45:45 GMT Sender: mmdf@udel.EDU Lines: 54 Posted: Thu Jun 2 17:45:45 1988 There is a major bug/design flaw in the Minix winchester driver which is a problem for reading the boot partition. In kernel/wini/copy_prt, disk partitions are rounded up to a block boundary and the size is rounded down to a block boundary. So if the first sector of a dos partition is odd, you can't read the boot record. Strange..... I'm using the following code now: #define PART_TABLE 0x1be /* where partitoin table actually starts */ /* borrowed from block0.h of fdisk */ typedef struct { unsigned char blk0_boot; /* boot partition */ unsigned char blk0_s_h; /* starting head */ unsigned char blk0_s_s; /* starting sector */ unsigned char blk0_s_c; /* starting cylinder */ unsigned char blk0_sys; /* partition type */ unsigned char blk0_e_h; /* ending head */ unsigned char blk0_e_s; /* ending sector */ unsigned char blk0_e_c; /* ending cylinder */ long blk0_start; /* starting sector */ long blk0_size; /* size in sectors */ } PARTITION_INFO; PRIVATE copy_prt(drive) int drive; { PARTITION_INFO *part_info; struct wini *wn; int part_num; for(part_num = 0, wn = &wini[drive + 1], part_info = (PARTITION_INFO *) &buf[PART_TABLE]; part_num < 4; part_num++, wn++, part_info++ ) { wn->wn_low = part_info->blk0_start; wn->wn_size = part_info->blk0_size; if(wn->wn_size % SECTORS_PER_BLOCK) /* round down to even number of blocks */ wn->wn_size = (wn->wn_size/SECTORS_PER_BLOCK - 1)*SECTORS_PER_BLOCK; } } Only problem is if you previously built a Minix partition on an odd sector boundary -- you can't read it anymore. The mega-equation is taken care of in the boot record -- DOS has an elaborate equation to figure out the number of fat sectors when the format is done. marty ARPA: leisner.henr@xerox.com GV: leisner.henr NS: martin leisner:henr801c:xerox UUCP: nsc!nscimg!amps!marty