biosdisk.c (40753) | biosdisk.c (40775) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: biosdisk.c,v 1.14 1998/10/11 10:29:49 peter Exp $ | 26 * $Id: biosdisk.c,v 1.15 1998/10/30 07:15:52 luoqi Exp $ |
27 */ 28 29/* 30 * BIOS disk device handling. 31 * 32 * Ideas and algorithms from: 33 * 34 * - NetBSD libi386/biosdisk.c --- 65 unchanged lines hidden (view full) --- 100static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest); 101 102static int bd_int13probe(struct bdinfo *bd); 103 104static int bd_init(void); 105static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize); 106static int bd_open(struct open_file *f, ...); 107static int bd_close(struct open_file *f); | 27 */ 28 29/* 30 * BIOS disk device handling. 31 * 32 * Ideas and algorithms from: 33 * 34 * - NetBSD libi386/biosdisk.c --- 65 unchanged lines hidden (view full) --- 100static int bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest); 101 102static int bd_int13probe(struct bdinfo *bd); 103 104static int bd_init(void); 105static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize); 106static int bd_open(struct open_file *f, ...); 107static int bd_close(struct open_file *f); |
108static void bd_print(int verbose); |
|
108 109struct devsw biosdisk = { 110 "disk", 111 DEVT_DISK, 112 bd_init, 113 bd_strategy, 114 bd_open, 115 bd_close, | 109 110struct devsw biosdisk = { 111 "disk", 112 DEVT_DISK, 113 bd_init, 114 bd_strategy, 115 bd_open, 116 bd_close, |
116 noioctl | 117 noioctl, 118 bd_print |
117}; 118 119static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); 120static void bd_closedisk(struct open_disk *od); 121static int bd_bestslice(struct dos_partition *dptr); 122 123/* 124 * Translate between BIOS device numbers and our private unit numbers. --- 70 unchanged lines hidden (view full) --- 195 bd->bd_flags |= BD_MODEINT13; 196 bd->bd_type = v86.ebx & 0xff; 197 return(1); 198 } 199 return(0); 200} 201 202/* | 119}; 120 121static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); 122static void bd_closedisk(struct open_disk *od); 123static int bd_bestslice(struct dos_partition *dptr); 124 125/* 126 * Translate between BIOS device numbers and our private unit numbers. --- 70 unchanged lines hidden (view full) --- 197 bd->bd_flags |= BD_MODEINT13; 198 bd->bd_type = v86.ebx & 0xff; 199 return(1); 200 } 201 return(0); 202} 203 204/* |
205 * Print information about disks 206 */ 207static void 208bd_print(int verbose) 209{ 210 int i; 211 char line[80]; 212 213 for (i = 0; i < nbdinfo; i++) { 214 sprintf(line, " disk%d: BIOS drive %c:", i, 215 (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit) : ('C' + bdinfo[i].bd_unit - 0x80)); 216 pager_output(line); 217 /* XXX more detail? */ 218 pager_output("\n"); 219 } 220} 221 222/* |
|
203 * Attempt to open the disk described by (dev) for use by (f). 204 * 205 * Note that the philosophy here is "give them exactly what 206 * they ask for". This is necessary because being too "smart" 207 * about what the user might want leads to complications. 208 * (eg. given no slice or partition value, with a disk that is 209 * sliced - are they after the first BSD slice, or the DOS 210 * slice before it?) --- 495 unchanged lines hidden --- | 223 * Attempt to open the disk described by (dev) for use by (f). 224 * 225 * Note that the philosophy here is "give them exactly what 226 * they ask for". This is necessary because being too "smart" 227 * about what the user might want leads to complications. 228 * (eg. given no slice or partition value, with a disk that is 229 * sliced - are they after the first BSD slice, or the DOS 230 * slice before it?) --- 495 unchanged lines hidden --- |