From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 16 Sep 1998 08:10:50 -0400 From: Russ Cox rsc@plan9.bell-labs.com Subject: [9fans] seek offset Topicbox-Message-UUID: 80406586-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19980916121050.rPX8liSm9nxvEpFBjA6B3DBB7Ui_EMku0glVCE062eM@z> I "fixed" my home Plan 9 installation not by fixing the seek() call (which seemed to me an onerous task), but by tweaking devata slightly. You actually don't need the seek call to take a 64-bit offset in order for Plan9 to accept large disks. devata can keep track of sectors (512 bytes) instead of bytes, so you should be able to handle a disk of 512*2^32 bytes = 2200 GB by making devata's math a little more careful about not overflowing. You make the capacity in the Drive struct count sectors instead of bytes, and then you also have to mess with atapart(), which is the tricky bit. The relevant bits are as follows. I would post a boddle but my copy of the driver is in pretty embarrassing shape... /* * We initialize the partition table to be the last * two sectors and then adjust it once we figure out which * sector it actually is (see note below). * Setting up this partition first lets us * get at the last couple sectors using ataxfer without * worrying about a >32bit offset on dp->p[0] */ strcpy(pp->name, "partition"); pp->start = dp->p[0].end - 2; pp->end = dp->p[0].end; pp++; dp->npart = 2; [...] /* * Read second last sector from disk, null terminate. * The last sector used to hold the partition tables. * However, this sector is special on some PC's so we've * started to use the second last sector as the partition * table instead. To avoid reconfiguring all our old systems * we still check if there is a valid partition table in * the last sector if none is found in the second last. */ skiplast = 1; ataxfer(dp, &dp->p[1], Cread, 0, dp->bytes, buf); buf[dp->bytes-1] = 0; n = getfields((char*)buf, line, Npart+1, "\n"); if(n <= 0 || strncmp(line[0], PARTMAGIC, sizeof(PARTMAGIC)-1) != 0){ ataxfer(dp, &dp->p[1], Cread, dp->bytes, dp->bytes, buf); buf[dp->bytes-1] = 0; n = getfields((char*)buf, line, Npart+1, "\n"); if(n > 0 && strncmp(line[0], PARTMAGIC, sizeof(PARTMAGIC)-1) == 0) skiplast = 0; } /* * Now that we know which sector holds the * partition table, update the metaentry */ if(skiplast){ dp->p[0].end--; dp->p[1].end--; }else{ dp->p[1].start++; } Similar changes apply to b.com (I think they were easier to apply there, if I remember right). Without a 64-bit seek, your maximum partition size is indeed limited to 4GB, but that's less of a problem. Without 64-bit stat responses from devata, disk/prep won't work on large disks, but that's a smaller problem: at least the support is almost all there already. Russ