summaryrefslogtreecommitdiff
path: root/sys/arch/pc532/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-12 20:21:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-12 20:21:37 +0000
commit6c3c7152302dce08b17b6fac14272fc435778145 (patch)
treecee094e02a544a7c9210d26eeda5c006c750989b /sys/arch/pc532/dev
parent484706ec2d7791c35fcf9aea53e46db186855c74 (diff)
from netbsd;
New generic disk framework. Highlights: New metrics handling. Metrics are now kept in the new `struct disk'. Busy time is now stored as a timeval, and transfer count in bytes. Storage for disklabels is now dynamically allocated, so that the size of the disk structure is not machine-dependent. Several new functions for attaching and detaching disks, and handling metrics calculation. Old-style instrumentation is still supported in drivers that did it before. However, old-style instrumentation is being deprecated, and will go away once the userland utilities are updated for the new framework. For usage and architectural details, see the forthcoming disk(9) manual page.
Diffstat (limited to 'sys/arch/pc532/dev')
-rw-r--r--sys/arch/pc532/dev/rd.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/arch/pc532/dev/rd.c b/sys/arch/pc532/dev/rd.c
index 1b54557f7d9..e32ea8ec8a5 100644
--- a/sys/arch/pc532/dev/rd.c
+++ b/sys/arch/pc532/dev/rd.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rd.c,v 1.1 1995/10/18 08:51:18 deraadt Exp $
+ * $Id: rd.c,v 1.2 1996/01/12 20:20:38 deraadt Exp $
*/
#include <sys/param.h>
@@ -36,21 +36,31 @@
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/conf.h>
+#include <sys/disk.h>
static int rdmatch(struct device *parent, void *cf, void *aux);
static void rdattach(struct device *parent, struct device *self, void *aux);
+struct rdsoftc {
+ struct device sc_dev; /* generic device glue */
+ struct disk sc_dkdev; /* generic disk glue */
+};
+
struct cfdriver rdcd = {
NULL,
"rd",
rdmatch,
rdattach,
DV_DISK,
- sizeof(struct device),
+ sizeof(struct rdsoftc),
NULL,
0
};
+void rdstrategy __P((struct buf *));
+
+struct dkdriver rddkdriver = { rdstrategy };
+
#if !defined(RD_SIZE)
# define RD_SIZE 0x200000
#endif
@@ -70,7 +80,17 @@ rdattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
+ struct rdsoftc *sc = (struct rdsoftc *)self;
+
printf(" addr 0x%x, size 0x%x\n", ram_disk, RD_SIZE);
+
+ /*
+ * Initialize and attach the disk structure.
+ */
+ bzero(&sc->sc_dkdev, sizeof(sc->sc_dkdev));
+ sc->sc_dkdev.dk_driver = &rddkdriver;
+ sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
+ disk_attach(&sc->sc_dkdev);
}