Fri Jul 29 20:48:33 2011 UTC ()
add a function to get the size of the flash device


(ahoka)
diff -r1.8 -r1.9 src/sys/dev/flash/flash.c
diff -r1.6 -r1.7 src/sys/dev/flash/flash.h

cvs diff -r1.8 -r1.9 src/sys/dev/flash/flash.c (expand / switch to context diff)
--- src/sys/dev/flash/flash.c 2011/07/15 19:19:57 1.8
+++ src/sys/dev/flash/flash.c 2011/07/29 20:48:33 1.9
@@ -1,4 +1,4 @@
-/*	$NetBSD: flash.c,v 1.8 2011/07/15 19:19:57 cliff Exp $	*/
+/*	$NetBSD: flash.c,v 1.9 2011/07/29 20:48:33 ahoka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Department of Software Engineering,
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.8 2011/07/15 19:19:57 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.9 2011/07/29 20:48:33 ahoka Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -523,6 +523,16 @@
 	sc = device_lookup_private(&flash_cd, unit);
 
 	return sc->sc_dev;
+}
+
+flash_size_t
+flash_get_size(dev_t dev)
+{
+	const struct flash_softc *sc;
+
+	sc = flash_get_softc(dev);
+
+	return sc->sc_partinfo.part_size;
 }
 
 static inline flash_off_t

cvs diff -r1.6 -r1.7 src/sys/dev/flash/flash.h (expand / switch to context diff)
--- src/sys/dev/flash/flash.h 2011/07/15 19:19:57 1.6
+++ src/sys/dev/flash/flash.h 2011/07/29 20:48:33 1.7
@@ -1,4 +1,4 @@
-/*	$NetBSD: flash.h,v 1.6 2011/07/15 19:19:57 cliff Exp $	*/
+/*	$NetBSD: flash.h,v 1.7 2011/07/29 20:48:33 ahoka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Department of Software Engineering,
@@ -123,6 +123,7 @@
 const struct flash_interface *flash_get_interface(dev_t);
 const struct flash_softc *flash_get_softc(dev_t);
 device_t flash_get_device(dev_t);
+flash_size_t flash_get_size(dev_t);
 
 /* flash operations should be used through these */
 int flash_erase(device_t, struct flash_erase_instruction *);