Module Name: src
Committed By: ahoka
Date: Fri Jul 29 20:48:33 UTC 2011
Modified Files:
src/sys/dev/flash: flash.c flash.h
Log Message:
add a function to get the size of the flash device
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/flash/flash.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/flash/flash.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/flash/flash.c
diff -u src/sys/dev/flash/flash.c:1.8 src/sys/dev/flash/flash.c:1.9
--- src/sys/dev/flash/flash.c:1.8 Fri Jul 15 19:19:57 2011
+++ src/sys/dev/flash/flash.c Fri Jul 29 20:48:33 2011
@@ -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>
@@ -525,6 +525,16 @@
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
flash_get_part_offset(struct flash_softc * const sc, size_t poffset)
{
Index: src/sys/dev/flash/flash.h
diff -u src/sys/dev/flash/flash.h:1.6 src/sys/dev/flash/flash.h:1.7
--- src/sys/dev/flash/flash.h:1.6 Fri Jul 15 19:19:57 2011
+++ src/sys/dev/flash/flash.h Fri Jul 29 20:48:33 2011
@@ -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 *);