Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Aug 2018 16:28:54 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Toomas Soome <tsoome@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r337878 - head/stand/i386/libi386
Message-ID:  <1534372134.1466.21.camel@freebsd.org>
In-Reply-To: <201808152225.w7FMP5J2018006@repo.freebsd.org>
References:  <201808152225.w7FMP5J2018006@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2018-08-15 at 22:25 +0000, Toomas Soome wrote:
> Author: tsoome
> Date: Wed Aug 15 22:25:05 2018
> New Revision: 337878
> URL: https://svnweb.freebsd.org/changeset/base/337878
> 
> Log:
>   libi386: remove bd_read() and bd_write() wrappers
>   
>   Those wroappers are nice, but do not really add much value.
> 
> Modified:
>   head/stand/i386/libi386/biosdisk.c
> 
> Modified: head/stand/i386/libi386/biosdisk.c
> =====================================================================
> =========
> --- head/stand/i386/libi386/biosdisk.c	Wed Aug 15 21:47:03
> 2018	(r337877)
> +++ head/stand/i386/libi386/biosdisk.c	Wed Aug 15 22:25:05
> 2018	(r337878)
> @@ -94,10 +94,7 @@ static int nbdinfo = 0;
>  
>  static void bd_io_workaround(struct disk_devdesc *dev);
>  
> -static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks,
> -    caddr_t dest);
> -static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int
> blks,
> -    caddr_t dest);
> +static int bd_io(struct disk_devdesc *, daddr_t, int, caddr_t, int);
>  static int bd_int13probe(struct bdinfo *bd);
>  
>  static int bd_init(void);
> @@ -506,7 +503,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t
> dblk, s
>  	case F_READ:
>  		DEBUG("read %d from %lld to %p", blks, dblk, buf);
>  
> -		if (blks && (rc = bd_read(dev, dblk, blks, buf))) {
> +		if (blks && (rc = bd_io(dev, dblk, blks, buf, 0))) {
>  			/* Filter out floppy controller errors */
>  			if (BD(dev).bd_flags != BD_FLOPPY || rc !=
> 0x20) {
>  				printf("read %d from %lld to %p,
> error: 0x%x\n",
> @@ -518,7 +515,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t
> dblk, s
>  	case F_WRITE :
>  		DEBUG("write %d from %lld to %p", blks, dblk, buf);
>  
> -		if (blks && bd_write(dev, dblk, blks, buf)) {
> +		if (blks && bd_io(dev, dblk, blks, buf, 1)) {
>  			DEBUG("write error");
>  			return (EIO);
>  		}
> @@ -713,20 +710,6 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk,
> int blks
>  	}
>  
>  	return (0);
> -}
> -
> -static int
> -bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t
> dest)
> -{
> -
> -	return (bd_io(dev, dblk, blks, dest, 0));
> -}
> -
> -static int
> -bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t
> dest)
> -{
> -
> -	return (bd_io(dev, dblk, blks, dest, 1));
>  }
>  
>  /*
> 

This would be a more satisfying change if there were something like

 #define BD_RD 0
 #define BD_WR 1

so that it was clear at a glance what a bd_io() call is doing.

-- Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1534372134.1466.21.camel>