Shao Miller [Fri, 30 Apr 2010 21:26:12 +0000 (17:26 -0400)]
[build] Move userland utility into subdir
Shao Miller [Fri, 30 Apr 2010 21:16:05 +0000 (17:16 -0400)]
[build] Move driver loader into subdir
Shao Miller [Fri, 30 Apr 2010 20:15:48 +0000 (16:15 -0400)]
[build] Move PXE NBP sources into nbp subdir
It's time to re-organize the project's directory structure.
Shao Miller [Thu, 14 Jan 2010 19:19:19 +0000 (14:19 -0500)]
[version] Up version to 0.0.1.6
Shao Miller [Wed, 13 Jan 2010 21:28:17 +0000 (16:28 -0500)]
[driver] Remove old testing comments
Some code for outputting text to the initial Windows
kernel-mode boot screen was sitting inside a couple of
comment blocks. Now that code is no longer there to
potentially confuse anyone.
Shao Miller [Wed, 13 Jan 2010 20:19:22 +0000 (15:19 -0500)]
[filedisk] Close file handle
When a file-backed disk is removed, we close the file handle.
Shao Miller [Wed, 13 Jan 2010 19:46:09 +0000 (14:46 -0500)]
[bus_dev_ctl] Do not set boot drive on AoE mount
Shao Miller [Wed, 13 Jan 2010 19:19:31 +0000 (14:19 -0500)]
[bus,disk] Call close routine upon device deletion
For cleanup purposes.
Shao Miller [Wed, 13 Jan 2010 19:00:05 +0000 (14:00 -0500)]
[driver,disk] Add close routine
So that devices can be closed/detached/removed/deleted/whatever.
Implement a simple redirection in the disk module to redirect
a device close call to a disk close call.
Shao Miller [Wed, 13 Jan 2010 18:55:23 +0000 (13:55 -0500)]
[disk] Add close routine
A dummy default close routine for disks is implemented.
Shao Miller [Wed, 13 Jan 2010 17:27:35 +0000 (12:27 -0500)]
[aoe] Set media type for AoE SAN
Now that disk__create_pdo() uses the media type as an
index, we need to set this member beforehand.
Shao Miller [Fri, 8 Jan 2010 21:57:01 +0000 (16:57 -0500)]
[general] Quick header inclusion audit
Shao Miller [Fri, 8 Jan 2010 21:40:42 +0000 (16:40 -0500)]
[aoe] Move target list cleanup code out of bus module
Shao Miller [Fri, 8 Jan 2010 21:28:50 +0000 (16:28 -0500)]
[bus] Remove unused forward declaration for disk
Shao Miller [Fri, 8 Jan 2010 21:27:42 +0000 (16:27 -0500)]
[aoe] Move target list spin-lock into AoE module
Shao Miller [Fri, 8 Jan 2010 21:18:24 +0000 (16:18 -0500)]
[aoe] Move target list type and global into AoE module
Out of the bus module.
Shao Miller [Fri, 8 Jan 2010 20:51:14 +0000 (15:51 -0500)]
[bus] Remove Bus_Start routine
The AoE target-list was initialized in this routine, and
that was it. This initialization has thus been moved to
AoE_Start().
Shao Miller [Fri, 8 Jan 2010 20:46:22 +0000 (15:46 -0500)]
[bus] Remove Bus_AddTarget declaration from header
Forgot to remve this when Bus_AddTarget() was moved into the
AoE module as add_target().
Shao Miller [Fri, 8 Jan 2010 20:37:06 +0000 (15:37 -0500)]
[bus] Remove unused Bus_CleanupTargetList function
Shao Miller [Fri, 8 Jan 2010 20:33:49 +0000 (15:33 -0500)]
[aoe] Move Bus_AddTarget into AoE module
And rename it to add_target(). The AoE module was its
only consumer.
Shao Miller [Fri, 8 Jan 2010 20:03:32 +0000 (15:03 -0500)]
[bus] Bus_AddChild renamed to bus__add_child
Shao Miller [Fri, 8 Jan 2010 19:43:32 +0000 (14:43 -0500)]
[bus] Remove disk details from Bus_AddChild
A fair bit of shuffling. Devices extensions now have
a device operations member which is a struct of function
pointers; one for device creation and one for device
initialization. This is akin to the disk operations
structure found as a member of a disk.
Bus_AddChild() is now simply passed a device extension
pointer, which points at device extension details to add
to the bus. It will call the particular PDO creation
routine provided by whoever populated the device
extension. That routine will return a PDO that will be
attached to the bus. Bus_AddChild() is also still
passed a pointer to the bus device object to which the
child belongs.
The only PDO creation routine at this time is obviously
disk__create_pdo(), since we are a virtual SCSI driver!
The reason for this bit of abstraction is in case anyone
finds the code handy some day as a reference for the
bus-and-child model. This code is not at that stage yet.
Shao Miller [Fri, 8 Jan 2010 17:27:16 +0000 (12:27 -0500)]
[bus,disk] Move the disk counter into the disk module
Seems like a good place for it.
Shao Miller [Fri, 8 Jan 2010 17:21:37 +0000 (12:21 -0500)]
[driver] Introduce device initialization routine
Any device on the bus could have an initialization routine, so
the device extension now has an init function pointer member.
disk__create_pdo() will setup the device extension for disks
to redirect to the init function pointer member of the disk's
operations structure.
Shao Miller [Fri, 8 Jan 2010 15:55:56 +0000 (10:55 -0500)]
[driver] Move next_sibling_ptr out of disk module
It's a property of a device, not really of a disk.
Shao Miller [Fri, 8 Jan 2010 15:41:00 +0000 (10:41 -0500)]
[driver] Move Parent member out of disk module
It's a property of a device, not really of a disk.
Shao Miller [Fri, 8 Jan 2010 15:19:52 +0000 (10:19 -0500)]
[driver,aoe] Move AOEPROTOCOLVER define
Shao Miller [Fri, 8 Jan 2010 15:18:16 +0000 (10:18 -0500)]
[driver,protocol] Move AOEPROTOCOLID define
Shao Miller [Fri, 8 Jan 2010 15:14:55 +0000 (10:14 -0500)]
[disk] Remove AoE comment
Shao Miller [Fri, 8 Jan 2010 15:08:27 +0000 (10:08 -0500)]
[bus,disk] Move some disk device logic
Trying to move disk device creation logic out of the bus
module and into the disk module. We now have a disk PDO
creation function, disk__create_pdo().
Not all disk logic has been moved out yet.
Shao Miller [Fri, 8 Jan 2010 06:00:58 +0000 (01:00 -0500)]
[bus] Remove unused boolean argument for Bus_AddChild
Shao Miller [Fri, 8 Jan 2010 05:50:51 +0000 (00:50 -0500)]
[driver] Remove unused device extension member
Shao Miller [Fri, 8 Jan 2010 00:40:10 +0000 (19:40 -0500)]
[driver] Make a global pointer to the driver object
Shao Miller [Thu, 7 Jan 2010 22:59:10 +0000 (17:59 -0500)]
[mount] Prefix object manager global namespace for filedisks
ZwCreateFile() wants "\??\X:\PATH\FILE" so winvblk.exe will
throw "\??\" onto the beginning of the path that they
specify, on their behalf.
Shao Miller [Thu, 7 Jan 2010 14:13:48 +0000 (09:13 -0500)]
[version] Up version to 0.0.1.5
Shao Miller [Thu, 7 Jan 2010 08:08:17 +0000 (03:08 -0500)]
[driver] Fix use of un-initialized pointer
Big oops. For auto-generation of a bus device, we
use IoReportDetectedDevice(). It expects the final
parameter as a PDO pointer. If it's non-NULL, it is
assumed that we already have a PDO, which we don't.
Shao Miller [Thu, 7 Jan 2010 07:29:40 +0000 (02:29 -0500)]
[disk,filedisk,ramdisk] Move compat_ids into disk module
Having the same array in the filedisk and ramdisk modules
was redundant. It's universal and so belongs in disk.c.
Shao Miller [Thu, 7 Jan 2010 07:24:24 +0000 (02:24 -0500)]
[ramdisk] Use table for hardware and compatible IDs
Instead of the multiple and redundant ternary operations.
Shao Miller [Thu, 7 Jan 2010 07:17:18 +0000 (02:17 -0500)]
[filedisk] Use table for hardware and compatible IDs
Instead of the multiple and redundant ternary operations.
Shao Miller [Thu, 7 Jan 2010 07:00:20 +0000 (02:00 -0500)]
[disk_scsi] Removable-detection using table
The disk's media type is used as an index into a
MEDIA_TYPE table for whether the disk is removable or not.
Shao Miller [Thu, 7 Jan 2010 06:52:33 +0000 (01:52 -0500)]
[disk] Removable-detection using table
The disk's media type is used as an index into a boolean
table for whether the disk is removable or not.
Move the table from the last commit into the disk module,
since disk_pnp had similar logic to disk_dev_ctl.
Shao Miller [Thu, 7 Jan 2010 06:41:04 +0000 (01:41 -0500)]
[disk_dev_ctl] Removable-detection using table
The disk's media type is used as an index into a boolean
table for whether the disk is removable or not.
Shao Miller [Thu, 7 Jan 2010 06:28:07 +0000 (01:28 -0500)]
[bus] Remove double-ternary operation
Use a table instead, with a disk's media type as index.
Shao Miller [Wed, 6 Jan 2010 17:12:16 +0000 (12:12 -0500)]
[build] Update hardware installation file
Updated the .INF with a more accurate date as well as
proper detection for an auto-generated bus device.
Shao Miller [Wed, 6 Jan 2010 10:02:24 +0000 (05:02 -0500)]
[cosmetics] Replace string literal instances with a macro
In our project-common header we now define C preprocessor
macros which expand to the string "WinVBlock" in normal
and wide versions. Appropriate replacements committed.
Shao Miller [Wed, 6 Jan 2010 08:41:13 +0000 (03:41 -0500)]
[version] Up version to 0.0.1.4
Shao Miller [Wed, 6 Jan 2010 08:37:51 +0000 (03:37 -0500)]
[filedisk] Improve device IDs
The bus, device type, and location are better now:
WinVBlock\FileOpticalDisc\...Hash_FFFFFFFF
WinVBlock\FileFloppyDisk\...Hash_FFFFFFFF
WinVBlock\FileHardDisk\...Hash_FFFFFFFF
where
FFFFFFFF is the cheap "hash" for the disk.
Shao Miller [Wed, 6 Jan 2010 08:20:26 +0000 (03:20 -0500)]
[aoe] Improve device IDs
The bus, device type, and location are better now:
WinVBlock\AoEHardDisk\...AoE_at_Shelf_F.Slot_T
where F and T are the shelF and sloT numbers, resp.
Shao Miller [Wed, 6 Jan 2010 07:52:39 +0000 (02:52 -0500)]
[ramdisk] Improve device IDs
The bus, device type, and location are better now:
WinVBlock\RAMOpticalDisc\...RAM_at_FFFFFFFF
WinVBlock\RAMFloppyDisk\...RAM_at_FFFFFFFF
WinVBlock\RAMHardDisk\...RAM_at_FFFFFFFF
TODO: A static string table that disks point to
Shao Miller [Wed, 6 Jan 2010 06:56:27 +0000 (01:56 -0500)]
[driver,bus] Remove re-initialization routine
MAJOR LEARNING: A boot driver re-initialization routine is
too late to create the bus device and its disks! Why?
If the boot volume was not installed during a previous
session, that means it's a new volume. Never-before-seen
volumes are only registered as possible boot volumes at a
point before boot driver re-initialization routines are
called.
As such, our previous re-initialization routine was _only_
useful if the expected boot volume on one of the RAM disks
was somehow already installed... It so happens that in
testing, I often modify the RAM disk image by using it
with QEmu as the virtual machine's hard disk drive. Thus,
the volume gets installed at that time and persists. The
Blue Screen of Death that folks were having was pretty
mysterious. The symptoms involved the Session Manager
crashing at a post-0x0000007B time, which was unexpected.
The crash was due to an uninstalled volume being installed
too late, as mentioned. So now probe__disks() happens
at bus creation time, and bus creation time happens either
during DriverEntry (if the user requests) or when the PnP
Manager re-establishes a previously installed bus device.
Both of these times occur before a boot driver
re-initialization routine occurs.
An easy way to reproduce the issue was to change the MBR
signature on a disk already installed, thus making it a
"brand new" disk, with "brand new" volumes on it.
This also explains why the Recovery Console will only boot
from a WinVBlock RAM disk with the /WINVBLOCK=BUS=1 switch.
This switch caused early bus creation _and_ early disk
probing.
EXTRA NOTE: Including the previous commit in CHANGES.log,
which was missed.
Shao Miller [Wed, 6 Jan 2010 06:24:23 +0000 (01:24 -0500)]
[debug] Add DEBUGIRPS to file for convenience
This means that two changes to debug.h will enable verbose
debugging, whenever needed. Purely for convenience's sake.
Shao Miller [Sun, 3 Jan 2010 11:45:37 +0000 (06:45 -0500)]
[disk] Minor cosmetic touch-ups
Shao Miller [Sun, 3 Jan 2010 11:27:39 +0000 (06:27 -0500)]
[disk] Abstract disk PnP ID response routine as a disk operation
Each disk class implements their own PnP ID response routine,
so we formalize this as a disk operation.
Shao Miller [Sun, 3 Jan 2010 10:53:25 +0000 (05:53 -0500)]
[disk] Abstract initialization routine as a disk operation
Each disk class implements their own initialization routine,
so we formalize this as a disk operation.
Shao Miller [Sun, 3 Jan 2010 10:16:25 +0000 (05:16 -0500)]
[disk] Abstract max_xfer_len routine as a disk operation
Each disk class implements their own max_xfer_len routine,
so we formalize this as a disk operation.
Shao Miller [Sun, 3 Jan 2010 09:25:34 +0000 (04:25 -0500)]
[disk] Abstract I/O routine as a disk operation
Each disk class implements their own I/O routine, so we
formalize this as a disk operation.
Shao Miller [Sun, 3 Jan 2010 08:37:48 +0000 (03:37 -0500)]
[disk,aoe] Move search state from disk into AoE
disk__search_state renamed to search_state.
All enum members renamed.
Shao Miller [Sun, 3 Jan 2010 08:08:59 +0000 (03:08 -0500)]
[disk] DISK_DISKTYPE renamed to disk__media
FloppyDisk renamed to disk__media_floppy
HardDisk renamed to disk__media_hard
OpticalDisc renamed to disk__media_optical
Shao Miller [Sun, 3 Jan 2010 02:41:46 +0000 (21:41 -0500)]
[aoe] AOE_DISKSEARCH renamed to disk_search
Shao Miller [Sun, 3 Jan 2010 02:16:35 +0000 (21:16 -0500)]
[aoe] AOE_TAG renamed to work_tag
Shao Miller [Sun, 3 Jan 2010 01:36:07 +0000 (20:36 -0500)]
[aoe] AOE_REQUEST renamed to io_req
Shao Miller [Sun, 3 Jan 2010 01:23:22 +0000 (20:23 -0500)]
[aoe] AOE_PACKET renamed to packet
Shao Miller [Sun, 3 Jan 2010 00:56:07 +0000 (19:56 -0500)]
[aoe] AOE_TAGTYPE renamed to tag_type
AoE_RequestType renamed to tag_type_io
AoE_SearchDriveType renamed to tag_type_search_drive
Shao Miller [Sun, 3 Jan 2010 00:35:01 +0000 (19:35 -0500)]
[aoe] AoE_Thread renamed to thread
Shao Miller [Sun, 3 Jan 2010 00:15:05 +0000 (19:15 -0500)]
[cosmetics] VOID renamed to void
And PVOID changed to 'void *'. Why not?
Shao Miller [Sat, 2 Jan 2010 22:52:12 +0000 (17:52 -0500)]
[filedisk] Initial file-backed disk support
Fairly messy, this commit introduces file-backed disk support.
The aoe.exe user-mode program has been renamed to winvblk.exe.
It now accepts two new commands:
winvblk attach \??\<path> <type> <cyls> <heads> <sectors>
winvblk detach <disk num>
<path> is the file path to a disk image. For now, you should prefix
"\??\" in front of the path.
<type> is one of 'f', 'c', 'h' for floppy, optical disc, hard disk,
respectively.
<cyls> is the cylinder count. Common values might be:
65535: for an optical disc drive
80: for a floppy disk
<heads> is the count of heads. Common values might be:
255: for an optical disc drive
2: for a floppy disk
<sectors> is the count of sectors per track, not to be confused
with the total sector count for the media. Common values might be:
15: for an optical disc drive
18: for a 1.44 MB floppy disk
36: for a 2.88 MB floppy disk
These geometry parameters are not optional at this time.
<disk num> is the internal disk number. Unfortunately the only
way to currently find this out is with 'winvblk show', which yields
some garbage since it is interpreting all disks as AoE SANs. This
is obviously a FIXME item.
GRUB4DOS and MEMDISK modules also got a slight fix to initialize
disk parameters with all zeroes.
The file-backed disk logic currently leaks HANDLES, since it does
not close them upon a 'detach'. This is obviously a FIXME item.
To prevent duplicate PDOs, every file-backed disk has a 32-bit
"hash" which is really just a very stupid attempt at a unique ID
based on LBADiskSize and the file path to the disk image. Heh.
Some examples for attaching file-backed disks:
winvblk attach \??\d:\RamXP.HDD h 52 128 63
winvblk attach \??\d:\some.iso c 65535 255 15
winvblk attach \??\d:\floppy144.vfd f 80 2 18
Shao Miller [Tue, 29 Dec 2009 07:07:49 +0000 (02:07 -0500)]
[filedisk] Introduce skeleton for file-backed disk class
A rip-off of the RAM disk module, minus RAM disk functionality.
This skeleton will be developed into a file-backed disk class.
Currently implemented is a probing routine which will create a
single 10 MB dummy HDD which silently discards writes and reads
as all zeroes.
Shao Miller [Tue, 29 Dec 2009 03:28:35 +0000 (22:28 -0500)]
[cosmetics] Run indent twice due to indent bug
You might or might not have noticed that 'indent' will take
a file and change its mind about how to indent it. Take that
resulting file and run 'indent' again and it will put the file
back the way it was. Thus there is an "even" format and an
"odd" format. This is silly. As a work-around, the indent.sh
and indent_add.sh scripts will run 'indent' twice on a file.
Yeesh.
Shao Miller [Tue, 29 Dec 2009 03:22:38 +0000 (22:22 -0500)]
[probe] Split aBFT probing out into the AoE module
Probing of the aBFT for a boot-time AoE disk is now a
routine in the AoE module (aoe.c).
Testing an AoE SAN-boot from gPXE yielded pleasant results.
Shao Miller [Tue, 29 Dec 2009 02:58:36 +0000 (21:58 -0500)]
[probe] Split GRUB4DOS out into its own module
GRUB4DOS specifics are now in their own module.
Probing of the aBFT for a boot-time AoE disk should
undergo the same treatment.
Shao Miller [Tue, 29 Dec 2009 02:38:36 +0000 (21:38 -0500)]
[probe] Split MEMDISK out into its own module
MEMDISK specifics are now in their own module.
GRUB4DOS RAM disks should undergo the same treatment.
Shao Miller [Mon, 28 Dec 2009 23:38:08 +0000 (18:38 -0500)]
[major] Turn disk structure inside out
...Kind of. There are currently five places where devices are
created:
1. Bus created in bus.c
2. AoE disk created in bus_dev_ctl.c
3. AoE disk created in probe.c
4. GRUB4DOS disk created in probe.c
5. MEMDISK created in probe.c
Each of these places is currently responsible for populating the
details of the device class structures. They will now inform
the Bus_AddChild() routine of how much device extension space
they require.
For example, a RAM disk contains a disk and a disk contains the
device-common structure. Thus Bus_AddChild() needs to allocate
(via IoCreateDevice()) enough device extension space for all of
this.
Previously, the disk structure contained a union of the different
disk classes. I prefer the model where a child class can have
knowledge of a parent class, but not vice versa.
This change involved a lot of shuffling, as well as the need to
fix a bug which probably should have been fixed separately;
see the DeviceTextLocationInformation handling in disk_pnp.c.
Shao Miller [Mon, 28 Dec 2009 09:48:28 +0000 (04:48 -0500)]
[disk_pnp] Split ID query logic for disk class
The PnP ID query now calls disk__query_id() which in turn
calls the disk class-specific function to return the right
ID(s) in the passed wide-char string buffer.
There should no longer be any checks anywhere for the
IsRamdisk boolean member of the disk structure. Now we
are free to remove that member and re-arrange how we use the
device extension space, rather than having a union for our
difference disk classes.
Shao Miller [Mon, 28 Dec 2009 08:19:53 +0000 (03:19 -0500)]
[disk_dev_ctl] Split MaximumTransferLength logic for disk class
The MaximumTransferLength we return for an IOCTL_STORAGE_QUERY_PROPERTY
is now returned from a disk class-specific function: The max_xfer_len
function pointer member of the disk type structure.
AoE and RAM disk modules now implement their own max_xfer_len() func.
Shao Miller [Mon, 28 Dec 2009 07:36:37 +0000 (02:36 -0500)]
[disk] Split disk IO into AoE and RAM disk modules
The disk structure now includes a function pointer member to
represent the appropriate I/O routine for the different disk
classes. These classes are currently AoE and RAM, but could
include others in the future, such as file-backed disks.
disk__io() is a function which calls the appropriate routine
for a given disk (via the device extension space for now).
The AoE module no longer has any knowledge of RAM disks. Yay.
Shao Miller [Sun, 27 Dec 2009 22:27:30 +0000 (17:27 -0500)]
[disk] aoedisk module becomes disk module
aoedisk.c was hardly AoE-specific anymore, so it is renamed
to disk.c. Details from aoedisk.h and ramdisk.h have been
temporarily merged into disk.h. These details should be moved
out at some point, perhaps.
Shao Miller [Sun, 27 Dec 2009 20:27:34 +0000 (15:27 -0500)]
[aoe] Implement fast_copy for RAM disks
According to karyonix (developer of FiraDisk), the Windows
compiler intrinsics __movsd and __movsq are faster than
RtlCopyMemory() for RAM disk I/O. We implement fast_copy()
in aoe.c to accomplish this.
Of course, once AoE and RAM disks have been properly split,
this should end up with just the RAM disks.
Shao Miller [Thu, 24 Dec 2009 22:52:24 +0000 (17:52 -0500)]
[driver] OsLoadOptions support needed for Recovery Console
We now make a note of the OsLoadOptions during registry checking
and implement get_opt() in the driver module for finding a
specific WinVBlock option. WinVBlock options should appear in
BOOT.INI or TXTSETUP.SIF as a switch like this:
/WINVBLOCK=option1=value1,option2=value2
Recovery Console requires our disks to be discovered before the
driver re-initialization routine. Using the above feature, we
will now execute the re-initialization routine early if the user
requests, since this routine will create a bus object. The user
requests this with an OsLoadOption like this:
/WINVBLOCK=BUS=1
Shao Miller [Tue, 22 Dec 2009 15:52:04 +0000 (10:52 -0500)]
[doc] Update ReadMe.txt and changelog.txt
Quick note in ReadMe.txt to introduce WinVBlock.
Changes are now tracked in CHANGES.log. changelog.txt from WinAoE
says as much. CHANGES.log is simply the git commit log.
Shao Miller [Tue, 22 Dec 2009 15:34:55 +0000 (10:34 -0500)]
[driver] Use pre-installed bus if possible
To ensure that we function, we've historically forced the creation
of the bus device. The documentation suggests that users use the
Add New Hardware Wizard to add the driver. This resulted in two bus
devices: The proper one known as a SCSI adapter, and a boot-up
unknown device which was annoying. For PE environments where our
driver is very simply injected through TXTSETUP.SIF entries, the
boot-up unknown device bus will still be generated.
Shao Miller [Mon, 21 Dec 2009 15:48:39 +0000 (10:48 -0500)]
[fixups] Clean compilation
Notably:
Commit
f92581dcd0d3e80f5a4b26959a3a5621d8378c83 should not have
changed ULONG_PTR to winvblock__uint32_ptr. ULONG_PTR is not
an unsigned long *, but an unsigned long which pointers are
sometimes cast to and from.
ExAllocatePool() is deprecated and so has been wrapped with a
macro which instead calls ExAllocatePoolWithTag() with the tag
'klBV' ("VBlk").
NdisQueryBuffer -> NdisQueryBufferSafe
NdisBufferVirtualAddress -> MmGetSystemAddressForMdlSafe
Some cast fix-ups.
Cleanly compiled under a variety of build environments:
2000 x86
XP x86
2003 x86
2003 x64/IA-64
Vista x86
Shao Miller [Mon, 21 Dec 2009 08:47:01 +0000 (03:47 -0500)]
[disk] Fix booting Windows 2003 PE .ISO
Several changes made hither and thither to pay closer attention
to fixed versus removable media responses to queries. Windows
Server 2003 appeared to be trying to probe for a FAT filesystem
on the emulated ODD. That's fixed now.
Also fixed MEMDISK probing to correctly set the heads, cylinders
and sectors-per-track.
A lot of the responses we provide to queries could be simpler
copies of structures built at device creation time. These could
go into the device extension space. Another ToDo.
Shao Miller [Sun, 20 Dec 2009 07:19:26 +0000 (02:19 -0500)]
[aoedisk,disk] Split aoedisk into dev_ctl, pnp, scsi portions
Major code shuffling. The mini IRP stack handling is used in
aoedisk now. The handling has been split into disk_dev_ctl,
disk_pnp and disk_scsi modules.
"aoedisk" should eventually simply become "disk", where RAM
disk versus AoE disk specifics are moved into appropriate
modules.
Shao Miller [Wed, 16 Dec 2009 15:39:10 +0000 (10:39 -0500)]
[bus] Move remaining IRP handling to mini stack
In this module only. Things are getting cleaner.
Shao Miller [Wed, 16 Dec 2009 15:21:42 +0000 (10:21 -0500)]
[bus] Remove Bus_DispatchDeviceControl from header
Forgot to remove this extern declaration earlier.
Shao Miller [Wed, 16 Dec 2009 14:28:20 +0000 (09:28 -0500)]
[headers] ULONG renamed to winvblock__uint32
Includes PULONG and ULONG_PTR renamed to winvblock__uint32_ptr.
Shao Miller [Wed, 16 Dec 2009 05:54:10 +0000 (00:54 -0500)]
[bus_dev_ctl] Move bus device control IRP handling into bus_dev_ctl
Put in own file. Should eventually mimic the mini IRP handling.
Shao Miller [Wed, 16 Dec 2009 04:12:50 +0000 (23:12 -0500)]
[bus_pnp] Move bus PnP IRP handling into bus_pnp
Changed functions to use mini IRP handling. Put in own file.
Shao Miller [Wed, 16 Dec 2009 01:51:45 +0000 (20:51 -0500)]
[bus] Initial test for mini IRP handling
Implemented handling_table[] in the bus module. The bus module has
also been updated to copy this table into a new bus device.
The picture of a bus device's mini IRP handling stack now goes:
IRP_MJ_PNP && IRP_MN_QUERY_DEVICE_RELATIONS ? bus foo()
IRP_MJ_PNP && IRP_MN_START_DEVICE ? bus pnp_start_dev()
IRP_MJ_CREATE ? driver create_close()
IRP_MJ_CLOSE ? driver create_close()
driver old_strategy()
driver all_irps()
Where lower handlings are only pursued if
the completion boolean is not set.
A simple foo() which catches IRP_MJ_PNP with
IRP_MN_QUERY_DEVICE_RELATIONS just for testing.
foo() should be removed soon.
IRP_MJ_PNP, IRP_MN_START_DEVICE moved to pnp_start_dev()
Shao Miller [Wed, 16 Dec 2009 00:45:22 +0000 (19:45 -0500)]
[driver] First test with new mini IRP handling strategy
The driver IRP dispatch routine now scans through the DeviceObject's
DeviceExtension's irp_handler_stack(_ptr) looking for IRP major and
minor function matches. An appropriate handler function is called,
if available.
The IRP_MJ_CREATE and IRP_MJ_CLOSE have their own create_close()
IRP handler function now, for example.
Now each of the case labels in the IRP function-handling switch
statements in all modules can be re-worked to use this system.
This means less indentation!
Also of note is a change to the bus module to copy the default
mini-stack of IRP handlings from the driver module to any new device.
Shao Miller [Tue, 15 Dec 2009 20:17:45 +0000 (15:17 -0500)]
[irp,driver] Add mini IRP handling stacks
An irp__handling structure esentially matches an irp__handler
function to the IRP major and minor functions it is intended to
handle. Booleans are used for the case where such a handler handles
multiple major and/or minor combinations.
In order to facilitate knowledge of when an Irp has been fully
handled for the driver module, we implement a boolean completion
status parameter. If an irp__handler wants to prevent the Irp
from further processing by the driver Irp dispatch routine, it
should set the completion status to TRUE.
This miniature IRP handling strategy is sitting doing nothing until
routines are ported to use it.
Shao Miller [Tue, 15 Dec 2009 04:21:24 +0000 (23:21 -0500)]
[cosmetics] Remove STDCALL where unneeded
STDCALL should not affect 'foo func(void)' functions. (Functions
taking no parameters.)
Shao Miller [Tue, 15 Dec 2009 03:46:16 +0000 (22:46 -0500)]
[cosmetics] Fix tab-size
All this time the tab-size was set to two spaces. Wrong.
It made things in git look like... Well, gitweb, that is, looked
pretty poor. Better now, I hope.
Shao Miller [Tue, 15 Dec 2009 01:34:34 +0000 (20:34 -0500)]
[bus] Fix AoE unmounting
When we invalidate our bus relations, we are queried for them. Each
of the PDOs that were previously known are dereferenced, so we need to
balance that by referencing each PDO we report before the report is
complete.
This is the fix for item 10 in V.'s readme.txt (I believe).
Shao Miller [Mon, 14 Dec 2009 20:18:40 +0000 (15:18 -0500)]
[protocol] Fix AoE startup
Use NDIS 4.0. Check if we registered the protocol properly.
Startup AoE upon IOCTL_AOE_SCAN.
Shao Miller [Mon, 14 Dec 2009 18:38:36 +0000 (13:38 -0500)]
[driver] Remove bus and disk details from the device extension
The eventual goal is for each module to know what it needs to know
and to delegate module-specific tasks to the appropriate modules.
In working towards this goal, the device extension in driver.h no
longer contains space for bus or disk structures. This involved
major access changes. Where modules used to access the bus/disk
members of the device extension, they now use helper functions to
get a pointer to these structures.
The helper functions get_bus_ptr() and get_disk_ptr() are in the bus
module. This isn't really right, since the bus module should
eventually know nothing about disks. It's a temporary measure.
The bus module has always been responsible for adding child devices
as well as the bus device itself. When adding a device, the bus
module now allocates enough device extension space to include the
driver-common structure as well as the appropriate bus- or disk-
specific structure.
It might be good if other modules inform
the bus module of how much device extension space they need in the
future. This commit does not introduce such logic, but it's an
idea for later.
Shao Miller [Mon, 14 Dec 2009 04:49:57 +0000 (23:49 -0500)]
[bus] Do not include bus.h from driver.h
bus__bus renamed to bus__type. bus.h is included by modules
before they include driver.h, since driver.h needs to know the size
of bus__type.
Shao Miller [Mon, 14 Dec 2009 04:38:29 +0000 (23:38 -0500)]
[disk] Do not include disk.h from driver.h
DISK_DISK renamed to disk__type. disk.h is included by modules
before they include driver.h, since driver.h needs to know the size
of disk__type.
Shao Miller [Mon, 14 Dec 2009 03:45:31 +0000 (22:45 -0500)]
[irp] Introduce IRP header
Moved some IRP specifics out of driver.h.
We have an unfortunate circular dependency where several modules
need to know the driver__dev_ext structure from driver.h, but that
structure also includes structures from irp.h, bus.h, disk.h. These
things need to be shuffled around some more until they're prettier.
Shao Miller [Sun, 13 Dec 2009 23:44:34 +0000 (18:44 -0500)]
[probe] Minor functions renames
Probe_GetSafeHook() renamed to get_safe_hook()
Probe_MemDisk_mBFT() renamed to check_mbft()