summaryrefslogtreecommitdiffstats
path: root/tools/regression/geom/geom_simdisk.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-04-04 16:40:11 +0000
committerphk <phk@FreeBSD.org>2002-04-04 16:40:11 +0000
commit2a571683e0a57e785364a0bccbf360ed24409bd1 (patch)
tree0c42f5ebb506901171cb484f5657e10bbadda266 /tools/regression/geom/geom_simdisk.c
parent4189a2f933a2f13043ab60a6b76bd575fa0eb870 (diff)
downloadFreeBSD-src-2a571683e0a57e785364a0bccbf360ed24409bd1.zip
FreeBSD-src-2a571683e0a57e785364a0bccbf360ed24409bd1.tar.gz
Play catch up with the kernel.
Sponsored by: DARPA & NAI Labs
Diffstat (limited to 'tools/regression/geom/geom_simdisk.c')
-rw-r--r--tools/regression/geom/geom_simdisk.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/regression/geom/geom_simdisk.c b/tools/regression/geom/geom_simdisk.c
index de5d1f9..ddc51fd 100644
--- a/tools/regression/geom/geom_simdisk.c
+++ b/tools/regression/geom/geom_simdisk.c
@@ -43,6 +43,7 @@
#include <strings.h>
#include <err.h>
#include <sys/errno.h>
+#include <sys/stat.h>
#include <geom/geom.h>
#include "geom_simdisk.h"
@@ -50,8 +51,6 @@
struct g_class g_simdisk_class = {
"SIMDISK-class",
NULL,
- g_std_access,
- NULL,
NULL,
G_CLASS_INITSTUFF
};
@@ -140,8 +139,10 @@ g_simdisk_create(char *name, struct simdisk_softc *sc)
gp = g_new_geomf(&g_simdisk_class, "%s", name);
gp->start = g_simdisk_start;
gp->softc = sc;
+ gp->access = g_std_access;
pp = g_new_providerf(gp, "%s", name);
+ pp->mediasize=sc->mediasize;
g_error_provider(pp, 0);
unit++;
g_topology_unlock();
@@ -152,12 +153,15 @@ struct g_geom *
g_simdisk_new(char *name, char *path)
{
struct simdisk_softc *sc;
+ struct stat st;
sc = calloc(1, sizeof *sc);
sc->fd = open(path, O_RDONLY);
if (sc->fd < 0)
err(1, path);
+ fstat(sc->fd, &st);
+ sc->mediasize = st.st_size;
sc->sectorsize = 512;
LIST_INIT(&sc->sectors);
TAILQ_INIT(&sc->sort);
OpenPOWER on IntegriCloud