|
|
1.1 root 1: /**
2: *
3: * fdisk(dev, fp) -- Fixed Disk Configuration
4: * dev_t dev;
5: * struct fdisk_s *fp;
6: *
7: * Input: dev = special device to read partition information from
8: * fp = pointer to memory-resident partition info (to update)
9: *
10: * Action: Open special device for reading.
11: * Read first block from the device.
12: * If valid signature present on block,
13: * copy partition information to memory
14: *
15: * Return: 1 = partition information successfully updated
16: * 0 = failure (could not read block, or bad signature)
17: */
18:
19: #include <sys/coherent.h>
20: #include <errno.h>
21: #include <sys/inode.h>
22: #include <sys/fdisk.h>
23: #include <sys/buf.h>
24: #include <sys/con.h>
25:
26: fdisk(dev, fp)
27: dev_t dev;
28: register struct fdisk_s *fp;
29: {
30: register struct hdisk_s *hp;
31: BUF *bp;
32: int s, i;
33: int ret = 0;
34:
35: s = sphi();
36: dopen(dev, IPR, DFBLK);
37:
38: if (u.u_error == 0) { /* special device now open */
39:
40: if (bp = bread(dev, (daddr_t) 0, 1)) { /* data read */
41:
42: /* buffer cache is in kernel data space */
43: #ifdef _I386
44: hp = bp->b_vaddr;
45: #else
46: hp = FP_OFF(bp->b_faddr);
47: #endif
48:
49: if(hp->hd_sig==HDSIG) {
50: for (i=0; i < NPARTN; ++i)
51: *fp++ = hp->hd_partn[i];
52: ret = 1;
53: }
54: brelease(bp);
55: }
56: dclose(dev);
57: }
58: spl(s);
59: return ret;
60: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.