bioscd.c (313355) | bioscd.c (328889) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: stable/11/sys/boot/pc98/libpc98/bioscd.c 313355 2017-02-06 22:03:07Z tsoome $"); | 29__FBSDID("$FreeBSD: stable/11/sys/boot/pc98/libpc98/bioscd.c 328889 2018-02-05 17:01:18Z kevans $"); |
30 31/* 32 * BIOS CD device handling for CD's that have been booted off of via no 33 * emulation booting as defined in the El Torito standard. 34 * 35 * Ideas and algorithms from: 36 * 37 * - FreeBSD libi386/biosdisk.c --- 56 unchanged lines hidden (view full) --- 94static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); 95static int bc_init(void); 96static int bc_strategy(void *devdata, int flag, daddr_t dblk, 97 size_t size, char *buf, size_t *rsize); 98static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, 99 size_t size, char *buf, size_t *rsize); 100static int bc_open(struct open_file *f, ...); 101static int bc_close(struct open_file *f); | 30 31/* 32 * BIOS CD device handling for CD's that have been booted off of via no 33 * emulation booting as defined in the El Torito standard. 34 * 35 * Ideas and algorithms from: 36 * 37 * - FreeBSD libi386/biosdisk.c --- 56 unchanged lines hidden (view full) --- 94static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); 95static int bc_init(void); 96static int bc_strategy(void *devdata, int flag, daddr_t dblk, 97 size_t size, char *buf, size_t *rsize); 98static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, 99 size_t size, char *buf, size_t *rsize); 100static int bc_open(struct open_file *f, ...); 101static int bc_close(struct open_file *f); |
102static void bc_print(int verbose); | 102static int bc_print(int verbose); |
103 104struct devsw bioscd = { 105 "cd", 106 DEVT_CD, 107 bc_init, 108 bc_strategy, 109 bc_open, 110 bc_close, --- 57 unchanged lines hidden (view full) --- 168 nbcinfo++; 169 bcache_add_dev(nbcinfo); /* register cd device in bcache */ 170 return(0); 171} 172 173/* 174 * Print information about disks 175 */ | 103 104struct devsw bioscd = { 105 "cd", 106 DEVT_CD, 107 bc_init, 108 bc_strategy, 109 bc_open, 110 bc_close, --- 57 unchanged lines hidden (view full) --- 168 nbcinfo++; 169 bcache_add_dev(nbcinfo); /* register cd device in bcache */ 170 return(0); 171} 172 173/* 174 * Print information about disks 175 */ |
176static void | 176static int |
177bc_print(int verbose) 178{ 179 char line[80]; | 177bc_print(int verbose) 178{ 179 char line[80]; |
180 int i; | 180 int i, ret = 0; |
181 | 181 |
182 pager_open(); | 182 if (nbcinfo == 0) 183 return (0); 184 185 printf("%s devices:", bioscd.dv_name); 186 if ((ret = pager_output("\n")) != 0) 187 return (ret); 188 |
183 for (i = 0; i < nbcinfo; i++) { 184 sprintf(line, " cd%d: Device 0x%x\n", i, 185 bcinfo[i].bc_sp.sp_devicespec); | 189 for (i = 0; i < nbcinfo; i++) { 190 sprintf(line, " cd%d: Device 0x%x\n", i, 191 bcinfo[i].bc_sp.sp_devicespec); |
186 if (pager_output(line)) | 192 if ((ret = pager_output(line)) != 0) |
187 break; 188 } | 193 break; 194 } |
189 pager_close(); | 195 return (ret); |
190} 191 192/* 193 * Attempt to open the disk described by (dev) for use by (f). 194 */ 195static int 196bc_open(struct open_file *f, ...) 197{ --- 217 unchanged lines hidden --- | 196} 197 198/* 199 * Attempt to open the disk described by (dev) for use by (f). 200 */ 201static int 202bc_open(struct open_file *f, ...) 203{ --- 217 unchanged lines hidden --- |