Comments (7)
So I was looking at Windows Sample code disk.sys
to help with
- Reading GPT/EFI partitions, and creating \Volume\X entries for each partition
- Fixing mount codes virtual \Volume\X which are currently not-right
- Fixing ZVOL virtual \Volume\ which are not-right
I was under the impression that disk.sys
would be fed (probed? scanned?) \PhysicalDriveX DeviceObjects, attempt to read partitions, and create valid \Volume\X devices as needed.
Compiling disk.sys
into ZFS, the only callback called is ClassAddDevice = DiskAddDevice;
which I guess is called when it's time for driver to add devices or something? The DeviceObject passed is not a PhysicalDriveX though. I am unsure then what processes \PhysicalDriveX devices, but it does look like disk.sys
does read the partition table to create \Volumes.
Ignoring DiskAddDevice
, I instead try to call disk.sys
's DiskCreateFdo()
to make my own virtual \Volume, but alas, this dies very early on in the call to IoAttachDeviceToDeviceStack()
with c0000001.
I'm unsure if this is a reasonable path to take, or if I'm going the wrong way.
from zfsin.
disk.sys has not been that useful so far, but it is interesting to note that ramdisk example is also adding the disk to the registry, I wonder if I have to as well.
from zfsin.
Not entirely sure what version of the Dokan sources I was looking at, but the guys here dokan-dev/dokany#50 list the same issues that we have now, and seem to have moved beyond them. Wonder how approachable those devs are, but in the meantime, I should check their much improved sources.
from zfsin.
So I have been looking at the latest-dokany sources, and I think it is supposed to work like;
- register as fs with
IoRegisterFileSystem()
- receive
IRP_MN_MOUNT_VOLUME
for any mountable device
Most of which we ignore by returning STATUS_UNRECOGNIZED_VOLUME
- but if we find one of ours, we reply with STATUS_FS_DRIVER_REQUIRED
to then receive IRP_MN_LOAD_FILE_SYSTEM
.
When we want to mount a ZFS dataset
IoCreateDeviceSecure(FILE_DEVICE_DISK)
Which will cause all filesystems to be called with IRP_MN_MOUNT_VOLUME
-
and since we detect it is ZFS (DeviceExtension is ours) to start the mounting process.
But the bugger does not work. It creates and sets everything up as expected:
SPL: beginning spl_free_thread() loop, spl_free == 0
hdr_recl called
hdr_recl called
hdr_recl called
ZFS: created kernel device node: FFFFCE8964968300: name ZFS: created kernel device node:
FFFFCE8964968300: name DiskFileSystemDevice: 0x0 \FileSystem\ZFS created
ZFS: created userland device symlink
Filesystem FFFFCE89641E9D20: '\Device\Mup'
Filesystem FFFFCE89641E9D20: '\Device\Mup'
Filesystem FFFFCE89629BEE30: '\FileSystem\UdfsCdRomRecognizer'
Filesystem FFFFCE89641ED9D0: '\FileSystem\FatCdRomRecognizer'
Filesystem FFFFCE89629BEC00: '\FileSystem\CdfsRecognizer'
Filesystem FFFFCE8964055E40: '\Ntfs'
Filesystem FFFFCE89641E6060: '\FileSystem\FatDiskRecognizer'
Filesystem FFFFCE89641E66A0: '\FileSystem\ExFatRecognizer'
Filesystem FFFFCE89641E6470: '\FileSystem\ReFSRecognizer'
Filesystem FFFFCE89641EDE30: '\FileSystem\ReFSv1Recognizer'
Filesystem FFFFCE89641EDC00: '\FileSystem\UdfsDiskRecognizer'
Filesystem FFFFCE89633651B0: '\FileSystem\ZFS'
ZFS: Loaded module v1.6.0-1, ZFS pool version 5000, ZFS filesystem version 5
ZFS filesystem version: 5
Device names:
ZFS_DEV_KERNEL L"\\Device\\ZFSCTL" # The FILE_DEVICE_UNKNOWN
ZFS_GLOBAL_FS_DISK_DEVICE_NAME L"\\FileSystem\\ZFS" # FILE_DEVICE_DISK_FILE_SYSTEM
ZFS_DEV_DOS L"\\DosDevices\\Global\\ZFS"
But no IRP_MN_MOUNT_VOLUME
at all received. It is especially annoying since it worked twice (I wasn't paying attention, but in the scroll back of the debugger immediate window:)
ZFS filesystem version: 5
dispatcher: enter: major 13: minor 1: IRP_MJ_FILE_SYSTEM_CONTROL(IRP_MN_MOUNT_VOLUME)
ioctlDispatcher: enter: major 13: minor 1: IRP_MJ_FILE_SYSTEM_CONTROL(IRP_MN_MOUNT_VOLUME) ioctlDeviceObject
IRP_MN_MOUNT_VOLUME ioctl
*** mount request for FFFFCE8964339040
mount strlen 46
mount about '\Device\HarddiskVolume3'
dispatcher: exit: 0xc000014f <*****> Information 0x0
For all devices mountable. Dang, I wonder what I did to make that work.
The init code is all here;
ZFSin/ZFSin/zfs/module/zfs/zfs_ioctl.c
Line 6672 in 05b9f43
modeled after dokany - but I have tried many variants of course.
from zfsin.
Minor success with 79fcef1 so its a step forward.
from zfsin.
This handles most of the mounts, in C: or separate drive, and mounts inside ZFS which was a whole other thing. Includes a few IFSTEST passing as well, so the occasional function is correct.
from zfsin.
ZVOLs are now working, I ended up using miniport/storport, which was definitely the right thing to do.
from zfsin.
Related Issues (20)
- Unable to import or detect a pool HOT 33
- System hangs on "zpool import" HOT 1
- Stuck when export a pool create by O3X HOT 1
- [BSOD]critical process died on zpool import win10 2004 HOT 2
- zstd / openzfs 2.0.3? HOT 7
- Exporting a USB-based pool, can't import because UNAVAIL HOT 1
- zpool export does not work HOT 2
- xattr=sa support? HOT 2
- Wrong modification times? HOT 2
- TargetId and Lun is created for zvol before it is fully open HOT 1
- Is FC HBA WMI functionality required? HOT 1
- ZFS on windows HOT 2
- alive ? HOT 9
- QuickPrint dekstop application on mac HOT 4
- bug check HOT 4
- ZDB failing on debug 2.1.6 HOT 1
- Creating zpool on separate partition on same vdev works but flags an error HOT 5
- Archive this repository HOT 2
- Zpool import takes ~10 mins. HOT 11
- Crashes my device HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zfsin.