diff options
| author | Doug Rabson <dfr@FreeBSD.org> | 1999-05-08 19:10:14 +0000 |
|---|---|---|
| committer | Doug Rabson <dfr@FreeBSD.org> | 1999-05-08 19:10:14 +0000 |
| commit | baab252f4282dca2fa76835dfcd98675c4807397 (patch) | |
| tree | 9804c355e7043735f5ed480527ae0e4fa97da400 /lib/libdisk | |
| parent | c946a7dcf11d29878da9d94199d4e0f17d54e204 (diff) | |
Notes
Diffstat (limited to 'lib/libdisk')
| -rw-r--r-- | lib/libdisk/disk.c | 76 |
1 files changed, 64 insertions, 12 deletions
diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c index 4d6deafc65fd..42cebbe58a84 100644 --- a/lib/libdisk/disk.c +++ b/lib/libdisk/disk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: disk.c,v 1.38 1998/10/06 11:57:08 dfr Exp $ + * $Id: disk.c,v 1.39 1998/12/19 18:48:33 phk Exp $ * */ @@ -50,16 +50,6 @@ Read_Int32(u_int32_t *p) return bp[0] | (bp[1] << 8) | (bp[2] << 16) | (bp[3] << 24); } -static void -Write_Int32(u_int32_t *p, u_int32_t v) -{ - u_int8_t *bp = (u_int8_t *)p; - bp[0] = (v >> 0) & 0xff; - bp[1] = (v >> 8) & 0xff; - bp[2] = (v >> 16) & 0xff; - bp[3] = (v >> 24) & 0xff; -} - struct disk * Int_Open_Disk(const char *name, u_long size) { @@ -143,6 +133,7 @@ Int_Open_Disk(const char *name, u_long size) {} #endif +#ifdef __i386__ for(i=BASE_SLICE;i<ds.dss_nslices;i++) { char sname[20]; chunk_e ce; @@ -241,6 +232,67 @@ Int_Open_Disk(const char *name, u_long size) } } } +#endif /* __i386__ */ +#ifdef __alpha__ + { + struct disklabel dl; + char pname[20]; + int j,k; + + strcpy(pname,"/dev/r"); + strcat(pname,name); + j = open(pname,O_RDONLY); + if (j < 0) { +#ifdef DEBUG + warn("open(%s)",pname); +#endif + goto nolabel; + } + k = ioctl(j,DIOCGDINFO,&dl); + if (k < 0) { +#ifdef DEBUG + warn("ioctl(%s,DIOCGDINFO)",pname); +#endif + close(j); + goto nolabel; + } + close(j); + All_FreeBSD(d, 1); + + for(j=0; j <= dl.d_npartitions; j++) { + if (j == RAW_PART) + continue; + if (j == 3) + continue; + if (j == dl.d_npartitions) { + j = 3; + dl.d_npartitions=0; + } + if (!dl.d_partitions[j].p_size) + continue; + if (dl.d_partitions[j].p_size + + dl.d_partitions[j].p_offset > + ds.dss_slices[WHOLE_DISK_SLICE].ds_size) + continue; + sprintf(pname,"%s%c",name,j+'a'); + if (Add_Chunk(d, + dl.d_partitions[j].p_offset, + dl.d_partitions[j].p_size, + pname,part, + dl.d_partitions[j].p_fstype, + 0) && j != 3) +#ifdef DEBUG + warn( + "Failed to add chunk for partition %c [%lu,%lu]", + j + 'a',dl.d_partitions[j].p_offset, + dl.d_partitions[j].p_size); +#else + {} +#endif + } + nolabel:; + } +#endif /* __alpha__ */ close(fd); Fixup_Names(d); Bios_Limit_Chunk(d->chunks,1024*d->bios_hd*d->bios_sect); @@ -323,7 +375,7 @@ Collapse_Disk(struct disk *d) } #endif -static char * device_list[] = {"wd", "sd", "da", "wfd", "fla", 0}; +static char * device_list[] = {"wd", "ad", "sd", "da", "wfd", "fla", 0}; char ** Disk_Names() |
