IRP_MJ_CREATE Volume Open

Real basic question here, my apologies. So when I get IRP_MJ_CREATE with NULL name, and NULL relativeObject, it is known as a “volume open”.

I used to simply grab the root "" object, and return that. But this is causing some issues, in that I now have two Fileobjects with FsContext pointing to one vnode of "". (Open of literal "" and volume open).

So, what IS a volume open anyway? What operations is generally performed on a volume handle? Are read/writes done, and if so, what data is expected? Is it perhaps like opening the raw disk? (then, why not just open the disk, instead of via the filesystem)

A volume is a logical grouping of one or more partitions. So, opening the disk is not equivalent.

Yes, you can read and write the volume (e.g. this is how format works). Normally you see queries for volume level information (free space, etc) but there are a bunch other requests that require a volume handle (defrag comes to mind). The FASTFAT source should give you a good baseline of what the file system is supposed to do with a volume open. Note that there are some special semantics around what it means to open a volume with no share. Again see FASTFAT.

“A volume is a logical grouping of one or more partitions.” that sounds almost like opening the raw device on Unix, as opposed to a slice/partition.

Following the thread of Volume Open in FASTFAT sources was not easy, but I will attempt it again. I guess I need to decide what to do with Volume Opens in ZFS, since there isn’t (always) a single physical device under the mount (mirror/raids) but it does sound that, besides the disk-size requests and similar things, I can just return zero data on READ requests, and “make up” correctish looking partitions for the dataset that is open. I don’t anticipate working with defrag or format.