summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-10-24 04:13:35 +0000
committerjhb <jhb@FreeBSD.org>2007-10-24 04:13:35 +0000
commite64b2194638eabcc812d11973098029df5dafb4f (patch)
tree5729f433860efb795ce052bd4b13fab290625dd6 /sys/boot
parent67997e41d53c8ad1c2b5042fbb90c1324c017ac4 (diff)
downloadFreeBSD-src-e64b2194638eabcc812d11973098029df5dafb4f.zip
FreeBSD-src-e64b2194638eabcc812d11973098029df5dafb4f.tar.gz
Reindent the read/write code of bd_realstrategy() so it is more readable.
MFC after: 1 week
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/libi386/biosdisk.c69
1 files changed, 30 insertions, 39 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 18453e2..2efab4c 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -788,59 +788,50 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, siz
#endif
DEBUG("open_disk %p", od);
-
-
- switch(rw){
- case F_READ:
blks = size / BIOSDISK_SECSIZE;
- DEBUG("read %d from %d to %p", blks, dblk, buf);
-
if (rsize)
*rsize = 0;
- if (blks && bd_read(od, dblk, blks, buf)) {
- DEBUG("read error");
- return (EIO);
- }
+
+ switch(rw){
+ case F_READ:
+ DEBUG("read %d from %d to %p", blks, dblk, buf);
+
+ if (blks && bd_read(od, dblk, blks, buf)) {
+ DEBUG("read error");
+ return (EIO);
+ }
#ifdef BD_SUPPORT_FRAGS
- DEBUG("bd_strategy: frag read %d from %d+%d to %p",
- fragsize, dblk, blks, buf + (blks * BIOSDISK_SECSIZE));
- if (fragsize && bd_read(od, dblk + blks, 1, fragsize)) {
- DEBUG("frag read error");
- return(EIO);
- }
- bcopy(fragbuf, buf + (blks * BIOSDISK_SECSIZE), fragsize);
+ DEBUG("bd_strategy: frag read %d from %d+%d to %p",
+ fragsize, dblk, blks, buf + (blks * BIOSDISK_SECSIZE));
+ if (fragsize && bd_read(od, dblk + blks, 1, fragsize)) {
+ DEBUG("frag read error");
+ return(EIO);
+ }
+ bcopy(fragbuf, buf + (blks * BIOSDISK_SECSIZE), fragsize);
#endif
- if (rsize)
- *rsize = size;
- return (0);
- break;
-
- case F_WRITE :
- blks = size / BIOSDISK_SECSIZE;
- DEBUG("write %d from %d to %p", blks, dblk, buf);
+ break;
+ case F_WRITE :
+ DEBUG("write %d from %d to %p", blks, dblk, buf);
- if (rsize)
- *rsize = 0;
- if (blks && bd_write(od, dblk, blks, buf)) {
- DEBUG("write error");
- return (EIO);
- }
+ if (blks && bd_write(od, dblk, blks, buf)) {
+ DEBUG("write error");
+ return (EIO);
+ }
#ifdef BD_SUPPORT_FRAGS
if(fragsize) {
- DEBUG("Attempted to write a frag");
- return (EIO);
+ DEBUG("Attempted to write a frag");
+ return (EIO);
}
#endif
+ break;
+ default:
+ /* DO NOTHING */
+ return (EROFS);
+ }
if (rsize)
*rsize = size;
return (0);
- default:
- /* DO NOTHING */
- break;
- }
-
- return EROFS;
}
/* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */
OpenPOWER on IntegriCloud