|
|
1.1 ! root 1: /* ! 2: * ! 3: * fdisk( fp ) -- Fixed Disk Configuration ! 4: * dev_t dev; ! 5: * struct fdisk_s *fp; ! 6: * ! 7: * Input: fp = pointer to memory-resident partition info (to update) ! 8: * ! 9: * Action: Read first block from the device. ! 10: * If valid signature present on block, ! 11: * copy partition information to memory ! 12: * ! 13: * Return: 1 = partition information successfully updated ! 14: * 0 = failure (could not read block, or bad signature) ! 15: */ ! 16: ! 17: #include <sys/coherent.h> ! 18: #include <sys/uproc.h> ! 19: #include <errno.h> ! 20: #include <sys/inode.h> ! 21: #include <sys/fdisk.h> ! 22: #include <sys/buf.h> ! 23: #include <sys/con.h> ! 24: ! 25: int ! 26: fdisk( fp ) ! 27: register FDISK_S *fp; ! 28: { ! 29: register HDISK_S *hp; ! 30: BUF *bp, *xbread(); ! 31: int i; ! 32: int ret = 0; ! 33: ! 34: /* xbread() reads relative to the start of the whole disk, rather ! 35: * than the start of the boot partition. It also does not ! 36: * impliment sparse blocks. ! 37: */ ! 38: if ((BUF *) NULL != (bp = xbread((daddr_t) 0))) { /* data read */ ! 39: hp = (HDISK_S *) bp->b_paddr; ! 40: if ( hp->hd_sig == HDSIG ) { /* valid data */ ! 41: for (i=0; i < NPARTN; ++i) ! 42: *fp++ = hp->hd_partn[i]; ! 43: ret = 1; ! 44: } ! 45: brelease( bp ); ! 46: } ! 47: ! 48: return ret; ! 49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.