SSHFS filesystem

Hi, I’m looking to create an sshfs filesystem-driver. What would be the best way to implement this? Would I create a minifilter that translates certain directories and use the WSK to handle SFTP comms?

> Would I create a minifilter that translates certain directories

If you are going to mount a directory to an existing file system then you need a filter that completes IRP_MJ_CREATE for files in this directory and takes care of all requests to these file objects. If this will be a separate volume then you need a file system driver, you can use RDBSS to facilitate in FSD development. Both solutions have a lot in common as they implement a full-fledged file system driver.

and use the WSK to handle SFTP comms

You can do this in kernel mode or communicate with a user mode service that establishes a remote connection, in the latter case you can use a full power of existing user mode components and libraries.

There are a number of open source FUSE like implementations for Windows,for example https://github.com/billziss-gh/winfsp .

> There are a number of open source FUSE like implementations for Windows,

I feel as though implementing it myself would give me a better grasp of
filesystem drivers, which is one of my goals.

If this will be a separate volume then you need a file system driver

How is this possible if the only types of filesystems that windows
recognizes are for disks, CDs, and tapes

On Thu, Sep 22, 2016 at 9:17 PM, wrote:

> > Would I create a minifilter that translates certain directories
>
> If you are going to mount a directory to an existing file system then you
> need a filter that completes IRP_MJ_CREATE for files in this directory and
> takes care of all requests to these file objects. If this will be a
> separate volume then you need a file system driver, you can use RDBSS to
> facilitate in FSD development. Both solutions have a lot in common as they
> implement a full-fledged file system driver.
>
> > and use the WSK to handle SFTP comms
>
> You can do this in kernel mode or communicate with a user mode service
> that establishes a remote connection, in the latter case you can use a full
> power of existing user mode components and libraries.
>
> There are a number of open source FUSE like implementations for
> Windows,for example https://github.com/billziss-gh/winfsp .
>
> —
> NTFSD is sponsored by OSR
>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>

> I feel as though implementing it myself would give me a better grasp of

filesystem drivers, which is one of my goals
I was going to say “why not write an explorer plugin, 90% of the utility for
10% of the gain”. Last time I looked that was how OneDrive worked. But
given that self education is a goal…

> If this will be a separate volume then you need a file system driver
How is this possible if the only types of filesystems that windows
recognizes are for disks, CDs, and tapes

Not if you write a recogniser, but maybe you’d be better to pretend to be a
network filesystem.

Frankly for a project like this I’d write it as a file system (network/local
I don’t care). They are so much easier to write than all but the simplest
filter. There’s much more typing involved than for a filter but you’ll not
spend the rest of your life wondering how that particular file system
handles that sort of behaviour and whether it changed in this particular
release. And after all this is really a network filesystem

And you’ll learn much more about file systems in general (rather than
NTFS/FAT/Whatever in particular)

/Rod

Network file systems don’t require a physical volume. For example the following file systems are in the network file systems class - SMB, RDP mapped drives, Citrix mapped drives, VmWare and VirtualBox shared host folders/drives .

Nevertheless, you can create a virtual volume if you need one for some reasons.

File systems don’t need physical volumes at all. One of my favorite file systems (probably because I wrote it) for testing was a simple bitbucket: it implemented all the interactions with the OS. Writes were discarded, reads were satisfied with zero filled buffers. I used it for performance testing our kernel file systems framework because this provides a blazingly fast file system (no I/O!) What always amazed me was how long the data would remain available in the cache. Not forever, but much longer than you might expect.

It shows up with a fixed drive letter, has no underlying volume, etc. The whole thing was ephemeral - directory data was stored in paged pool, so it provided a complete name space.

We’ve also built entire virtual stacks, complete with fake storage devices, which allows the mount manager to dynamically assign drive letters.

Tony
OSR

How would I go about writing a vitrual fs if the system only mounts
physical volumes? (Sorry for the newb questions im still new to fs drivers)

Namely, how would I load the FS driver from elsewhere, not @ boot

On Fri, Sep 23, 2016 at 5:34 PM, Moinak Bhattacharyya
wrote:

> How would I go about writing a vitrual fs if the system only mounts
> physical volumes? (Sorry for the newb questions im still new to fs drivers)
>

I normally do it from the command line with “net start”. :smiling_face:

Drive letters are just symbolic links, so you call IoCreateSymbolicLink and assuming you do it right, you end up with a drive letter.

Tony
OSR

So how would I go about implementing a network redirector? Is there example
code online i can find that has implemented one?

Also, when I call IoCreateDevice, would I
use FILE_DEVICE_NETWORK_FILE_SYSTEM as the DeviceType to register
with IoRegisterFileSystem or would it be FILE_DEVICE_NETWORK_REDIRECTOR? Is
a redirector even necessary?