people/sha0/winvblock.git
9 years ago[disk] Introduce I/O function prototype without...
Shao Miller [Sun, 9 Jan 2011 12:27:04 +0000 (07:27 -0500)]
[disk] Introduce I/O function prototype without...

use of WV_S_DEV_T.

9 years ago[aoe] Wrap an I/O routine taking a disk instead of dev
Shao Miller [Sun, 9 Jan 2011 12:16:08 +0000 (07:16 -0500)]
[aoe] Wrap an I/O routine taking a disk instead of dev

9 years ago[aoe] Use AOE_SP_DISK_ instead of WV_SP_DEV_T for...
Shao Miller [Sun, 9 Jan 2011 12:02:20 +0000 (07:02 -0500)]
[aoe] Use AOE_SP_DISK_ instead of WV_SP_DEV_T for...

work tags and disk searches.

9 years ago[disk] Remove unused disk__create()
Shao Miller [Sun, 9 Jan 2011 11:29:47 +0000 (06:29 -0500)]
[disk] Remove unused disk__create()

9 years ago[disk/dev_ctl,driver] Rename disk_dev_ctl__dispatch()
Shao Miller [Sun, 9 Jan 2011 11:21:51 +0000 (06:21 -0500)]
[disk/dev_ctl,driver] Rename disk_dev_ctl__dispatch()

To WvlDiskDevCtl().  It was also made independent of
WV_S_DEV_T, so that meant adding a WvDiskDevCtl()
function to the WinVBlock driver, in order for its
IRP major function handler tables to have something to
work with.

9 years ago[disk/dev_ctl] Change disk_dev_ctl__scsi_get_address_
Shao Miller [Sun, 9 Jan 2011 10:41:33 +0000 (05:41 -0500)]
[disk/dev_ctl] Change disk_dev_ctl__scsi_get_address_

To WvlDiskDevCtlScsiGetAddr().
Now independent from WV_S_DEV_T.

9 years ago[device] Remove DevNum member
Shao Miller [Sun, 9 Jan 2011 10:38:27 +0000 (05:38 -0500)]
[device] Remove DevNum member

Disks can use WvlDiskUnitNum(), instead.  For other
devices, use WvlBusGetNodeNum().

9 years ago[disk] Introduce UnitNum operation
Shao Miller [Sun, 9 Jan 2011 10:23:27 +0000 (05:23 -0500)]
[disk] Introduce UnitNum operation

To fetch the unit number.  A disk driver should implement it.

9 years ago[disk/dev_ctl] Change disk_dev_ctl__get_geom_()
Shao Miller [Sun, 9 Jan 2011 09:37:42 +0000 (04:37 -0500)]
[disk/dev_ctl] Change disk_dev_ctl__get_geom_()

To WvlDiskDevCtlGetGeom_().
Now independent from WV_S_DEV_T.

9 years ago[disk/dev_ctl] Change disk_dev_ctl__storage_query_prop_()
Shao Miller [Sun, 9 Jan 2011 09:33:16 +0000 (04:33 -0500)]
[disk/dev_ctl] Change disk_dev_ctl__storage_query_prop_()

To WvlDiskDevCtlStorageQueryProp_().
Now independent from WV_S_DEV_T.

9 years ago[disk/dev_ctl] Get the disk pointer in the dispatcher
Shao Miller [Sun, 9 Jan 2011 09:24:57 +0000 (04:24 -0500)]
[disk/dev_ctl] Get the disk pointer in the dispatcher

9 years ago[disk/pnp] Don't call IoDeleteDevice()
Shao Miller [Sun, 9 Jan 2011 08:55:16 +0000 (03:55 -0500)]
[disk/pnp] Don't call IoDeleteDevice()

Now that RAM, file-backed, and AoE disks all store their
data in the device object's extension, we only need to
free that data from one place: The particular disk's
WV_S_DEV_T::Ops.Free() implementation.

9 years ago[aoe] Change AoeDiskCreate_ to AoeDiskCreatePdo_()
Shao Miller [Sun, 9 Jan 2011 08:50:29 +0000 (03:50 -0500)]
[aoe] Change AoeDiskCreate_ to AoeDiskCreatePdo_()

And create the PDO.  The aBFT scanner and the AoE "mount"
IRP handler are responsible for calling it, initializing
the AoE disk, then adding it to the AoE bus.

9 years ago[aoe] Use disk IRP handlers
Shao Miller [Sun, 9 Jan 2011 08:03:06 +0000 (03:03 -0500)]
[aoe] Use disk IRP handlers

9 years ago[disk] Export disk IRP handlers as library functions
Shao Miller [Sun, 9 Jan 2011 07:50:47 +0000 (02:50 -0500)]
[disk] Export disk IRP handlers as library functions

9 years ago[aoe] Don't track AoE disks globally
Shao Miller [Sun, 9 Jan 2011 07:40:37 +0000 (02:40 -0500)]
[aoe] Don't track AoE disks globally

9 years ago[aoe] Put the WV_S_DISK_T inside AOE_S_DISK_
Shao Miller [Sun, 9 Jan 2011 07:38:53 +0000 (02:38 -0500)]
[aoe] Put the WV_S_DISK_T inside AOE_S_DISK_

9 years ago[aoe/bus] Allow the caller to create the PDO
Shao Miller [Sun, 9 Jan 2011 07:30:36 +0000 (02:30 -0500)]
[aoe/bus] Allow the caller to create the PDO

9 years ago[ramdisk] Use RAM disk PDO creation function
Shao Miller [Sun, 9 Jan 2011 03:07:02 +0000 (22:07 -0500)]
[ramdisk] Use RAM disk PDO creation function

ramdisk__create() replaced by WvRamdiskCreatePdo().

9 years ago[ramdisk/memdisk] Note the media type before creation
Shao Miller [Sun, 9 Jan 2011 02:51:25 +0000 (21:51 -0500)]
[ramdisk/memdisk] Note the media type before creation

9 years ago[ramdisk/grub4dos] Note the media type before creation
Shao Miller [Sun, 9 Jan 2011 02:46:40 +0000 (21:46 -0500)]
[ramdisk/grub4dos] Note the media type before creation

9 years ago[ramdisk/grub4dos] Minor, cosmetic changes
Shao Miller [Sun, 9 Jan 2011 00:43:45 +0000 (19:43 -0500)]
[ramdisk/grub4dos] Minor, cosmetic changes

9 years ago[ramdisk] Minor, cosmetic changes
Shao Miller [Sun, 9 Jan 2011 00:25:22 +0000 (19:25 -0500)]
[ramdisk] Minor, cosmetic changes

9 years ago[ramdisk] Don't track RAM disks globally
Shao Miller [Sat, 8 Jan 2011 23:50:57 +0000 (18:50 -0500)]
[ramdisk] Don't track RAM disks globally

9 years ago[bus] Add null operation check for WV_S_DEV_T::Ops.Init()
Shao Miller [Sat, 8 Jan 2011 23:46:14 +0000 (18:46 -0500)]
[bus] Add null operation check for WV_S_DEV_T::Ops.Init()

9 years ago[disk,filedisk] Export IRP handlers, create filedisk PDO
Shao Miller [Sat, 8 Jan 2011 23:44:51 +0000 (18:44 -0500)]
[disk,filedisk] Export IRP handlers, create filedisk PDO

Shuffled things around so that a new filedisk actually is
the device extension of a newly-created PDO.  The same is
intended for RAM disks, soon.

9 years ago[filedisk] Shuffle code around in WvFilediskAttach()
Shao Miller [Sat, 8 Jan 2011 21:34:28 +0000 (16:34 -0500)]
[filedisk] Shuffle code around in WvFilediskAttach()

Moving towards allocating the filedisk with the device
extension when the PDO is created.

9 years ago[bus] Allow a WvBusAddDev() caller to create PDO
Shao Miller [Sat, 8 Jan 2011 20:36:15 +0000 (15:36 -0500)]
[bus] Allow a WvBusAddDev() caller to create PDO

They must set the 'Self' member to notify of this.

9 years ago[disk] Zero out a disk during initialization
Shao Miller [Sat, 8 Jan 2011 20:31:25 +0000 (15:31 -0500)]
[disk] Zero out a disk during initialization

9 years ago[disk] Split WvDiskCreatePdo_() for WV_S_DEV_T independence
Shao Miller [Sat, 8 Jan 2011 20:27:08 +0000 (15:27 -0500)]
[disk] Split WvDiskCreatePdo_() for WV_S_DEV_T independence

The independent portion is now in WvlDiskCreatePdo().

9 years ago[disk] Don't track disks globally
Shao Miller [Sat, 8 Jan 2011 18:44:59 +0000 (13:44 -0500)]
[disk] Don't track disks globally

9 years ago[disk] Split disk initialization out of disk__create()
Shao Miller [Sat, 8 Jan 2011 18:38:33 +0000 (13:38 -0500)]
[disk] Split disk initialization out of disk__create()

And into WvDiskInit(), instead.  Leave device initialization
in disk__create(), since it is specific to WinVBlock devices.

9 years ago[disk] Cosmetic changes and NULL disk operation checks
Shao Miller [Sat, 8 Jan 2011 18:24:20 +0000 (13:24 -0500)]
[disk] Cosmetic changes and NULL disk operation checks

9 years ago[disk] Rename WV_E_DISK_IO_MODE to WVL_E_DISK_IO_MODE
Shao Miller [Sat, 8 Jan 2011 17:49:27 +0000 (12:49 -0500)]
[disk] Rename WV_E_DISK_IO_MODE to WVL_E_DISK_IO_MODE

Along with its enumeration values from WvDiskIoMode* to
WvlDiskIoMode*

9 years ago[disk] Rename WV_A_DISK_BOOT_SECT to WVL_A_DISK_BOOT_SECT
Shao Miller [Sat, 8 Jan 2011 17:41:39 +0000 (12:41 -0500)]
[disk] Rename WV_A_DISK_BOOT_SECT to WVL_A_DISK_BOOT_SECT

9 years ago[httpdisk] Handle IRP_MJ_PNP:IRP_MN_START_DEVICE
Shao Miller [Sat, 8 Jan 2011 17:38:03 +0000 (12:38 -0500)]
[httpdisk] Handle IRP_MJ_PNP:IRP_MN_START_DEVICE

9 years ago[disk] Rename WV_E_DISK_MEDIA_TYPE to WVL_E_DISK_MEDIA_TYPE
Shao Miller [Sat, 8 Jan 2011 17:37:30 +0000 (12:37 -0500)]
[disk] Rename WV_E_DISK_MEDIA_TYPE to WVL_E_DISK_MEDIA_TYPE

Along with its enumeration values from WvDiskMediaType* to
WvlDiskMediaType*

9 years ago[httpdisk] Debug-messages for unsupported IRP major codes
Shao Miller [Sat, 8 Jan 2011 10:00:34 +0000 (05:00 -0500)]
[httpdisk] Debug-messages for unsupported IRP major codes

9 years ago[httpdisk] IRP_MJ_SCSI handling skeleton
Shao Miller [Sat, 8 Jan 2011 09:48:03 +0000 (04:48 -0500)]
[httpdisk] IRP_MJ_SCSI handling skeleton

Just debugging messages, for now.

9 years ago[httpdisk] Debug-messages for a few more PnP IRP types
Shao Miller [Sat, 8 Jan 2011 09:43:59 +0000 (04:43 -0500)]
[httpdisk] Debug-messages for a few more PnP IRP types

9 years ago[httpdisk] Support disk PnP ID queries
Shao Miller [Sat, 8 Jan 2011 09:24:22 +0000 (04:24 -0500)]
[httpdisk] Support disk PnP ID queries

This allows for the disks to be enumerated and
installed in Device Manager.  They won't function, yet.

9 years ago[httpdisk] Add IRP_MJ_PNP handler
Shao Miller [Sat, 8 Jan 2011 07:57:16 +0000 (02:57 -0500)]
[httpdisk] Add IRP_MJ_PNP handler

Though it doesn't exactly handle anything, yet.

9 years ago[libbus/pnp] Add check for NULL QueryDevText member
Shao Miller [Sat, 8 Jan 2011 07:44:01 +0000 (02:44 -0500)]
[libbus/pnp] Add check for NULL QueryDevText member

9 years ago[libbus] Add check for NULL bus FDO
Shao Miller [Sat, 8 Jan 2011 07:35:50 +0000 (02:35 -0500)]
[libbus] Add check for NULL bus FDO

9 years ago[httpdisk/bus] Add pre-made devices to the bus
Shao Miller [Sat, 8 Jan 2011 07:34:33 +0000 (02:34 -0500)]
[httpdisk/bus] Add pre-made devices to the bus

9 years ago[httpdisk/bus] Delete bus FDO on PnP removal
Shao Miller [Sat, 8 Jan 2011 07:12:41 +0000 (02:12 -0500)]
[httpdisk/bus] Delete bus FDO on PnP removal

If we delete the FDO before returning from handling an
IRP_MJ_PNP:IRP_MN_REMOVE_DEVICE IRP, then the driver's
unload routine will be called if there aren't any more
devices.  That is, we should be able to be unloaded from
Device Manager.

9 years ago[httpdisk/bus] Actually handle the IRPs in commit 6081ace4
Shao Miller [Sat, 8 Jan 2011 03:02:32 +0000 (22:02 -0500)]
[httpdisk/bus] Actually handle the IRPs in commit 6081ace4

And now the bus device installs in Device Manager.

9 years ago[httpdisk/bus] Establish the bus state as started
Shao Miller [Sat, 8 Jan 2011 02:54:19 +0000 (21:54 -0500)]
[httpdisk/bus] Establish the bus state as started

9 years ago[httpdisk] Revert portion of commit 0d63d646
Shao Miller [Sat, 8 Jan 2011 02:49:18 +0000 (21:49 -0500)]
[httpdisk] Revert portion of commit 0d63d646

Not sure why I was trying to handle IRP_MJ_[CREATE|CLOSE]
for the bus.  The WinVBlock driver is almost as simple as
Bo's handler in his driver.

9 years ago[httpdisk] Send a few IRP majors to the bus
Shao Miller [Sat, 8 Jan 2011 02:43:52 +0000 (21:43 -0500)]
[httpdisk] Send a few IRP majors to the bus

IRP_MJ_PNP
IRP_MJ_POWER
IRP_MJ_SYSTEM_CONTROL

9 years ago[httpdisk] Add success debug message to DriverEntry()
Shao Miller [Sat, 8 Jan 2011 02:32:31 +0000 (21:32 -0500)]
[httpdisk] Add success debug message to DriverEntry()

9 years ago[httpdisk] Change DEVICE_BASE_NAME to \HttpDisks
Shao Miller [Sat, 8 Jan 2011 02:28:03 +0000 (21:28 -0500)]
[httpdisk] Change DEVICE_BASE_NAME to \HttpDisks

To avoid an object namespace conflict with the bus. :)

9 years ago[httpdisk/bus] Report bus IRPs
Shao Miller [Sat, 8 Jan 2011 02:24:46 +0000 (21:24 -0500)]
[httpdisk/bus] Report bus IRPs

Though don't exactly handle any, yet.

9 years ago[httpdisk/bus] Implement HttpdiskBusAttach()
Shao Miller [Sat, 8 Jan 2011 01:52:04 +0000 (20:52 -0500)]
[httpdisk/bus] Implement HttpdiskBusAttach()

9 years ago[aoe/bus] Remove unused declarations
Shao Miller [Sat, 8 Jan 2011 01:45:28 +0000 (20:45 -0500)]
[aoe/bus] Remove unused declarations

9 years ago[httpdisk/bus] Initialize the bus FDO device extension
Shao Miller [Sat, 8 Jan 2011 01:42:04 +0000 (20:42 -0500)]
[httpdisk/bus] Initialize the bus FDO device extension

9 years ago[httpdisk] Send bus IRPs to the bus IRP dispatcher
Shao Miller [Sat, 8 Jan 2011 01:37:07 +0000 (20:37 -0500)]
[httpdisk] Send bus IRPs to the bus IRP dispatcher

9 years ago[httpdisk] Use DRIVER_DISPATCH declarations
Shao Miller [Sat, 8 Jan 2011 01:28:39 +0000 (20:28 -0500)]
[httpdisk] Use DRIVER_DISPATCH declarations

For the IRP handlers.  Also rename them and declare
their internal linkage.

9 years ago[httpdisk] Rename DEVICE_EXTENSION to HTTPDISK_S_DEV
Shao Miller [Sat, 8 Jan 2011 00:59:35 +0000 (19:59 -0500)]
[httpdisk] Rename DEVICE_EXTENSION to HTTPDISK_S_DEV

And move it into the header source file.

9 years ago[httpdisk/bus] Use a WVL_S_BUS_T bus
Shao Miller [Sat, 8 Jan 2011 00:47:31 +0000 (19:47 -0500)]
[httpdisk/bus] Use a WVL_S_BUS_T bus

And use its 'Fdo' member for the bus FDO.

9 years ago[httpdisk/bus] Create and delete the bus FDO
Shao Miller [Sat, 8 Jan 2011 00:33:09 +0000 (19:33 -0500)]
[httpdisk/bus] Create and delete the bus FDO

9 years ago[httpdisk] Store the driver object as HttpdiskDriverObj
Shao Miller [Sat, 8 Jan 2011 00:22:57 +0000 (19:22 -0500)]
[httpdisk] Store the driver object as HttpdiskDriverObj

9 years ago[build] Build HTTPDisk.INF file for HTTPDisk driver
Shao Miller [Sat, 8 Jan 2011 00:10:47 +0000 (19:10 -0500)]
[build] Build HTTPDisk.INF file for HTTPDisk driver

9 years ago[httpdisk] Create PDO on WinVBlock bus
Shao Miller [Sat, 8 Jan 2011 00:00:46 +0000 (19:00 -0500)]
[httpdisk] Create PDO on WinVBlock bus

9 years ago[dummy,aoe] Move dummy creation IOCTL setup from AoE
Shao Miller [Sat, 8 Jan 2011 00:00:25 +0000 (19:00 -0500)]
[dummy,aoe] Move dummy creation IOCTL setup from AoE

It's just fine as a library function in dummy.c.

9 years ago[httpdisk/bus] Add debug messages
Shao Miller [Fri, 7 Jan 2011 22:31:24 +0000 (17:31 -0500)]
[httpdisk/bus] Add debug messages

9 years ago[httpdisk] Link with WinVBlock
Shao Miller [Fri, 7 Jan 2011 22:29:57 +0000 (17:29 -0500)]
[httpdisk] Link with WinVBlock

9 years ago[httpdisk] Add bus.c skeleton
Shao Miller [Fri, 7 Jan 2011 21:35:48 +0000 (16:35 -0500)]
[httpdisk] Add bus.c skeleton

Really "bare bones" at this time.

9 years ago[project,httpdisk] Include in project build
Shao Miller [Fri, 7 Jan 2011 20:48:17 +0000 (15:48 -0500)]
[project,httpdisk] Include in project build

9 years ago[httpdisk] Fix deprecation warnings
Shao Miller [Fri, 7 Jan 2011 20:46:09 +0000 (15:46 -0500)]
[httpdisk] Fix deprecation warnings

Use HttpDisk[M|P]alloc() instead of ExAllocatePool().

If Bo's ksocket and/or ktdi ever come out of HTTPDisk,
their references to allocation functions will have to
be changed.

9 years ago[aoe/bus] Use unit detach logic similar to WvBusDevCtlDetach
Shao Miller [Fri, 7 Jan 2011 18:33:38 +0000 (13:33 -0500)]
[aoe/bus] Use unit detach logic similar to WvBusDevCtlDetach

They were originally the same, anyway.

9 years ago[disk/pnp] Use similar removal logic to the dummy device
Shao Miller [Fri, 7 Jan 2011 18:02:30 +0000 (13:02 -0500)]
[disk/pnp] Use similar removal logic to the dummy device

We remove the node on the first IRP_MN_REMOVE_DEVICE and
invalidate the bus relations.  The PnP manager will see
our missing PDO on the re-enumeration, then will send a
second IRP_MN_REMOVE_DEVICE.  Then we free the disk.

9 years ago[dummy] Return back upper drivers' IRP_MJ_PNP
Shao Miller [Fri, 7 Jan 2011 17:21:22 +0000 (12:21 -0500)]
[dummy] Return back upper drivers' IRP_MJ_PNP

STATUS_NOT_SUPPORTED meant that a device relations query
for a bus FDO attached to us (AoE) was not being returned.

9 years ago[disk] Include driver reference in WV_S_DISK_T
Shao Miller [Fri, 7 Jan 2011 17:07:44 +0000 (12:07 -0500)]
[disk] Include driver reference in WV_S_DISK_T

The PDO creation routine needs to pass the correct driver
to IoCreateDevice().

9 years ago[aoe] Bus detach causes thread stop
Shao Miller [Fri, 7 Jan 2011 16:23:43 +0000 (11:23 -0500)]
[aoe] Bus detach causes thread stop

We must stop the thread before returning from
IRP_MJ_PNP:IRP_MN_REMOVE_DEVICE or the PnP manager will
not initite a driver unload.

At last, we unload properly!

9 years ago[aoe/bus] Set the bus state to started
Shao Miller [Fri, 7 Jan 2011 16:01:40 +0000 (11:01 -0500)]
[aoe/bus] Set the bus state to started

9 years ago[dummy] Sanity-check a PDO in WvDummyRemove()
Shao Miller [Fri, 7 Jan 2011 15:01:47 +0000 (10:01 -0500)]
[dummy] Sanity-check a PDO in WvDummyRemove()

This function should be avoided anyway, if possible.

9 years ago[aoe/bus] Don't use AoeBusPdo global
Shao Miller [Fri, 7 Jan 2011 14:56:51 +0000 (09:56 -0500)]
[aoe/bus] Don't use AoeBusPdo global

Use the WVL_S_BUS_T::Pdo, instead.

We don't demand that we are associated with a PDO on the
WinVBlock bus any more.

9 years ago[libbus,driver,dummy] Don't thread the main bus
Shao Miller [Fri, 7 Jan 2011 06:50:16 +0000 (01:50 -0500)]
[libbus,driver,dummy] Don't thread the main bus

*sigh* There was a major problem with the strategy of
enqueueing all IRPs bound for the bus; one cannot return
STATUS_PENDING for just any IRP.

The symptom that led to this realization was: while
performing a driver update for the WinVBlock bus in
Device Manager, an IRP_MN_QUERY_ID was being sent
immediately after an IRP_MN_REMOVE_DEVICE.  This doesn't
appear to make sense until realizing that the PnP
manager most likely took the STATUS_PENDING for the
removal the wrong way; it assumed that the bus FDO would
still be attached for its next IRP, which was actually
intended to be bound for the PDO.

So we don't enqueue any IRPs for the bus any more.  One
of the original reasons for doing so was so that dummy
PDO child devices could be created by the thread.  So
this commit allows for an IOCTL to produce a dummy PDO,
which was on the to-do list, anyway.  The fun of that
is the potential to add arbitrary PDOs from user-land;
arbitrary in the sense of their reported IDs.  It will
be interesting to test the installation of non-existent
hardware and find out what IRPs their function drivers
send down.

The dummy ID generation macro(s) have been changed for
greater automation and aesthetic.  It creates an object
large enough to hold the dummy ID "header" as well as
the WCHAR string data, and initializes the object.  One
can qualify the object as 'const', even.  Quite nice.

Threading was decoupled from the bus library entirely.
One of the other reasons for their association was in
order to keep the list of children race-free.  So now
we have WvlBusLock() and WvlBusUnlock() functions to
assist with race-free iteration.

9 years ago[debug] Change macros and message layout
Shao Miller [Thu, 6 Jan 2011 13:56:51 +0000 (08:56 -0500)]
[debug] Change macros and message layout

This seems simpler.  We used to have #ifs for verbose IRP
debugging.  That' no longer needed.

DBG() could get pretty messy, so now we can choose to
exclude the file, line number, or thread.  Including the
line number depends on including the file.

Also, we exclude the bulk of debug.c from being compiled
if debugging is disabled.

9 years ago[bus] WvBusDevCtlDetach() using WvBusRemoveDev_()
Shao Miller [Thu, 6 Jan 2011 13:13:27 +0000 (08:13 -0500)]
[bus] WvBusDevCtlDetach() using WvBusRemoveDev_()

Since bus IRPs execute in the bus thread's context, we
should use the internal function for a device detach req.

9 years ago[bus,probe] Change when boot disks are probed
Shao Miller [Thu, 6 Jan 2011 04:43:46 +0000 (23:43 -0500)]
[bus,probe] Change when boot disks are probed

Now they will be probed for at every bus FDO->PDO
attach operation; could be multiple times in one
session.

9 years ago[libbus] Fix uninitilized nodes_changed use
Shao Miller [Thu, 6 Jan 2011 04:42:15 +0000 (23:42 -0500)]
[libbus] Fix uninitilized nodes_changed use

9 years ago[driver,bus] Enqueue all bus IRPs, FDO attach reqs.
Shao Miller [Thu, 6 Jan 2011 00:36:01 +0000 (19:36 -0500)]
[driver,bus] Enqueue all bus IRPs, FDO attach reqs.

To [try] to simplify things a bit, we now enqueue all IRPs
bound for the WinVBlock bus on the bus thread.  Once in
there, we needn't worry about about race conditions over
bus nodes or bus state.  Bus IRPs are not that frequent,
so I don't think that we'll suffer from a major bottle-neck.

Some code has been shuffled around, too.  WvBusEstablish()
and WvBusCleanup() are responsible for the FDO creation
and destruction, respectively.

The bus thread is responsible for attaching/detaching the
FDO to a PDO.  You can disable the bus in Device Manager,
then add a new bus, and it will become the only bus.  The
FDO can "hop," so to speak.

This commit even survived a little stress-testing!

9 years ago[bus,aoe] Make threads responsible for bus FDO removal
Shao Miller [Wed, 5 Jan 2011 21:59:14 +0000 (16:59 -0500)]
[bus,aoe] Make threads responsible for bus FDO removal

The bus library probably shouldn't assume control of FDO
association and destruction at removal-time.

9 years ago[libbus/pnp] Set Linked member for each node on bus removal
Shao Miller [Wed, 5 Jan 2011 21:30:24 +0000 (16:30 -0500)]
[libbus/pnp] Set Linked member for each node on bus removal

9 years ago[util] Add an icon
Shao Miller [Wed, 5 Jan 2011 20:50:42 +0000 (15:50 -0500)]
[util] Add an icon

It'd also be nice to give .SYS files icons.

9 years ago[bus,dummy,libbus] Handle dummy PDO removal
Shao Miller [Wed, 5 Jan 2011 19:51:07 +0000 (14:51 -0500)]
[bus,dummy,libbus] Handle dummy PDO removal

The bus library can unlink a node, but should not be
responsible for deleting the corresponding PDO nor
for freeing associated resources.  A driver can test
for removal by checking the Linked member of the
WVL_S_BUS_NODE that is associated with the device.

This allows for the AoE bus to be uninstalled from
Device Manager without crashing!  What was happening
was that:
- The AoE bus got IRP_MN_REMOVE_DEVICE
  - It passed it on to the PDO
    - The dummy PDO handler unlinked the node and
      deleted the device.
    - It also triggered a re-enumeration of the
      WinVBlock bus.
- AoE shutdown
- The re-enumeration of the WinVBlock bus would find
  the PDO missing and send IRP_MN_REMOVE_DEVICE.
- The device was already deleted!

So now we merely unlink on the first removal IRP,
then delete the PDO on the second IRP, which will be
triggered by bus re-enumeration.

9 years ago[aoe] Shuffle code around in DriverEntry() and AoeUnload()
Shao Miller [Wed, 5 Jan 2011 13:25:35 +0000 (08:25 -0500)]
[aoe] Shuffle code around in DriverEntry() and AoeUnload()

Now we use the new AoeCleanup_() for cleaning up items common
to DriverEntry() and AoeUnload().

Establish the bus before the thread that handles it.  Heh.
Fixed a duplicate AoeBusFree() call.

Changed the thread-stop'n'wait logic to resemble libthread's.

Renamed AoeUnload() to AoeUnload_().

9 years ago[aoe] More cosmetic changes
Shao Miller [Wed, 5 Jan 2011 13:09:05 +0000 (08:09 -0500)]
[aoe] More cosmetic changes

9 years ago[driver] Miscellaneous grouped memory allocation functions
Shao Miller [Wed, 5 Jan 2011 04:47:00 +0000 (23:47 -0500)]
[driver] Miscellaneous grouped memory allocation functions

See their comments for details.  Inspired by the grouped work
item tag allocations and grouped frees in the AoE driver.

A better strategy than RtlCopyMemory() might be to allocate
up to the nearest multiple of 'sizeof WVL_S_MEM_GROUP_ITEM_'
and use simple assignment.

9 years ago[driver,bus] Shuffle FDO attach around, use WvlThread*
Shao Miller [Tue, 4 Jan 2011 23:24:23 +0000 (18:24 -0500)]
[driver,bus] Shuffle FDO attach around, use WvlThread*

- DriverEntry() will now call WvBusEstablish().
  - WvBusEstablish() will create the bus FDO.
  - It will start the bus thread, which is now WvBusThread().
  - It will optionally create the bus PDO and attach it,
    depending on the PdoDone Registry value.
  - With at least the bus FDO and the bus thread established,
    WvBusEstablish() can return success to DriverEntry().

- WvBusThread() will wait on an internal signal as well as
  the old libbus-included signal.  If libbus is ever
  de-coupled from the "heavy" part of its thread logic, we
  can wait on a single signal.

9 years ago[driver] Remove WvTestThreadTest
Shao Miller [Tue, 4 Jan 2011 21:01:04 +0000 (16:01 -0500)]
[driver] Remove WvTestThreadTest

Testing was successful!

9 years ago[driver] Test stopping WvlThreadTest thread
Shao Miller [Tue, 4 Jan 2011 20:59:53 +0000 (15:59 -0500)]
[driver] Test stopping WvlThreadTest thread

In WvUnload(), we add a call to a new WvTestThreadTestStop()
function (which is purely for testing).  This new function:

- Enqueues itself for WvlThreadTest.
  - Since this is the first item, WvlThreadTest is started!
- The queued item then remembers WvlThreadGetCurrent(),
  since the WvlThreadTest thread is "self-contained".
- The queued item returns control to the original call via
  an event.
- The original call now knows the "contained" thread inside
  WvlThreadTest.  Then it calls WvlThreadSendStopAndWait().
- This last call enqueues a stopper for the thread, then
  waits for the stopper signal, then waits for the thread
  to exit.  (And closes the thread handle.)

9 years ago[driver] Remove WvlThreadTestMsg() test calls
Shao Miller [Tue, 4 Jan 2011 19:45:18 +0000 (14:45 -0500)]
[driver] Remove WvlThreadTestMsg() test calls

Testing of the thread library was successful.

9 years ago[libthread] Lots of good stuff
Shao Miller [Tue, 4 Jan 2011 08:34:53 +0000 (03:34 -0500)]
[libthread] Lots of good stuff

New functions for working with WinVBlock thread
library threads.

I really enjoy this code.

Some testing of this library has been added to the
WinVBlock driver.  These should be removed in a
future commit.

9 years ago[libthread] Introduce libthread
Shao Miller [Mon, 3 Jan 2011 14:26:24 +0000 (09:26 -0500)]
[libthread] Introduce libthread

9 years ago[libbus] Add thread ownership functions
Shao Miller [Mon, 3 Jan 2011 13:30:37 +0000 (08:30 -0500)]
[libbus] Add thread ownership functions

WvlBusRegisterOwnerThread() and WvlBusNotOwned().

9 years ago[aoe] Clear AoeBusPdo after IRP_MN_REMOVE_DEVICE on the bus
Shao Miller [Mon, 3 Jan 2011 13:01:17 +0000 (08:01 -0500)]
[aoe] Clear AoeBusPdo after IRP_MN_REMOVE_DEVICE on the bus

9 years ago[libbus/pnp] Increment reference count on dev. relations
Shao Miller [Mon, 3 Jan 2011 12:58:27 +0000 (07:58 -0500)]
[libbus/pnp] Increment reference count on dev. relations