PERFORCE change 159987 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sun Mar 29 21:18:24 PDT 2009
http://perforce.freebsd.org/chv.cgi?CH=159987
Change 159987 by marcel at marcel_fbsdvm on 2009/03/30 04:17:29
WIP flush.
Affected files ...
.. //depot/projects/nand/sys/geom/geom_nandsim.c#2 edit
.. //depot/projects/nand/sys/geom/geom_nandsim.h#1 add
.. //depot/projects/nand/usr.bin/nandsim/Makefile#1 add
.. //depot/projects/nand/usr.bin/nandsim/nandsim.c#1 add
Differences ...
==== //depot/projects/nand/sys/geom/geom_nandsim.c#2 (text+ko) ====
@@ -44,21 +44,25 @@
#include <geom/geom.h>
#include <geom/geom_int.h>
+#include "geom_nandsim.h"
+
+static d_close_t g_nandsim_close;
+static d_ioctl_t g_nandsim_ioctl;
static d_open_t g_nandsim_open;
-static d_close_t g_nandsim_close;
+static d_read_t g_nandsim_read;
static d_strategy_t g_nandsim_strategy;
-static d_ioctl_t g_nandsim_ioctl;
+static d_write_t g_nandsim_write;
static struct cdevsw g_nandsim_cdevsw = {
.d_version = D_VERSION,
- .d_open = g_nandsim_open,
.d_close = g_nandsim_close,
- .d_read = physread,
- .d_write = physwrite,
.d_ioctl = g_nandsim_ioctl,
+ .d_open = g_nandsim_open,
+ .d_read = g_nandsim_read,
.d_strategy = g_nandsim_strategy,
+ .d_write = g_nandsim_write,
.d_name = "g_nandsim",
- .d_flags = D_DISK | D_TRACKCLOSE,
+ .d_flags = D_TRACKCLOSE,
};
static g_access_t g_nandsim_access;
@@ -112,7 +116,7 @@
g_nandsim_access(struct g_provider *pp, int r, int w, int e)
{
- return (ENOSYS);
+ return (0);
}
static void
@@ -158,22 +162,37 @@
}
static int
+g_nandsim_read(struct cdev *dev, struct uio *uio, int ioflag)
+{
+
+ if (dev->si_drv1 == NANDSIMCTL)
+ return (ENODEV);
+
+ return (EDOOFUS);
+}
+
+static int
+g_nandsim_write(struct cdev *dev, struct uio *uio, int ioflag)
+{
+
+ if (dev->si_drv1 == NANDSIMCTL)
+ return (ENODEV);
+
+ return (EDOOFUS);
+}
+
+static int
g_nandsim_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
struct thread *td)
{
- int i, error;
if (dev->si_drv1 != NANDSIMCTL)
return (ENOIOCTL);
- i = IOCPARM_LEN(cmd);
- switch (cmd) {
- default:
- error = ENOIOCTL;
- break;
- }
+ if (cmd != NANDSIM_CREATE)
+ return (ENOIOCTL);
- return (error);
+ return (EDOOFUS);
}
static void
@@ -209,6 +228,13 @@
bp->bio_cmd == BIO_DELETE,
("Wrong bio_cmd bio=%p cmd=%d", bp, bp->bio_cmd));
dev = bp->bio_dev;
+
+ if (dev->si_drv1 == NANDSIMCTL) {
+ bp->bio_resid = bp->bio_bcount;
+ biofinish(bp, NULL, ENODEV);
+ return;
+ }
+
cp = dev->si_drv2;
if ((bp->bio_offset % cp->provider->sectorsize) != 0 ||
More information about the p4-projects
mailing list