0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WinFsp で仮想ファイルシステムを作る (2)

Last updated at Posted at 2025-10-28

パス・スルーの動作確認

前の記事 で作成したプロジェクトのデバッグ時の引数に以下を設定し、デバッグを実行するとパス・スルーの動作が確認できる。

-u \passthrough\C$\$(MSBuildProjectDirectoryNoRoot) -m Y:

  • -u UNC の形式で、マウント元となるディレクトリを指定する
  • -m マウント先のドライブを指定する

上記は変数を展開して、以下のように書いても良い。

-u \passthrough\C$\cxx\project\03-winfsp-passthrough -m Y:

image.png

この状態でデバッグを実行すると、コンソールには以下の出力が行われ、マウント先のドライブにアクセスできるようになる。

passthrough -u \passthrough\C$\cxx\project\03-winfsp-passthrough -p C:\cxx\project\03-winfsp-passthrough -m Y:
The service passthrough has been started.

マウント元のディレクトリ
C:\cxx\project\03-winfsp-passthrough

image.png

マウント先のドライブ(Y:)

image.png

(当然だが) Windows Terminal でコマンド実行もできる。

C:\WORK>y:

Y:\>dir
 ドライブ Y のボリューム ラベルがありません。
 ボリューム シリアル番号は 0000-0000 です

 Y:\ のディレクトリ

2025/10/28  14:48    <DIR>          .
2025/10/28  14:43    <DIR>          ..
2025/10/28  14:48    <DIR>          03-winfs.59ee3fec
2025/10/28  14:45                41 03-winfsp-passthrough.cpp
2025/10/28  14:43             1,468 03-winfsp-passthrough.sln
2025/10/28  14:48             7,134 03-winfsp-passthrough.vcxproj
2025/10/28  14:48             1,144 03-winfsp-passthrough.vcxproj.filters
2025/10/28  14:48               709 03-winfsp-passthrough.vcxproj.user
2023/02/07  21:16            30,128 passthrough.c
2025/10/28  14:48    <DIR>          x64
               6 個のファイル              40,624 バイト
               4 個のディレクトリ  607,498,145,792 バイトの空き領域

Y:\>

ログを出力する

デバッグ時の引数に以下を追加することで、WinFsp 内部のログを記録できる。

  • -d -1 デバッグログの出力を有効化 (-1 は全てのログの意味)
  • -D {PATH} 記録するログ・ファイルのパス

具体的には、次のような引数になる。

-u \passthrough\C$\$(MSBuildProjectDirectoryNoRoot) -m Y: -d -1 -D $(SolutionDir)log.txt

デバッガを起動すると以下のようなログが記録される。

C:\cxx\project\03-winfsp-passthrough\log.txt

03-winfsp-passthrou[TID=abd0]: FFFF808DA68F63D0: >>Create [UT----] "\", FILE_OPEN, CreateOptions=21, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000000250[PID=10f8], DesiredAccess=100000, GrantedAccess=0, ShareAccess=3
03-winfsp-passthrou[TID=abd0]: FFFF808DA68F63D0: <<Create IoStatus=0[1] UserContext=0000000000000000:0000029EAA7FCAB0, GrantedAccess=100000, FileInfo={FileAttributes=10, ReparseTag=0, AllocationSize=0:1000, FileSize=0:1000, CreationTime=2025-10-28T05:43:44.891Z, LastAccessTime=2025-10-28T06:14:40.167Z, LastWriteTime=2025-10-28T06:14:40.167Z, ChangeTime=2025-10-28T06:14:40.167Z, IndexNumber=170000:2296c}
03-winfsp-passthrou[TID=abd0]: FFFF808DD04DE010: >>QueryVolumeInformation
03-winfsp-passthrou[TID=abd0]: FFFF808DD04DE010: <<QueryVolumeInformation IoStatus=0[0] VolumeInfo={TotalSize=e9:18dff000, FreeSize=8d:73f21000, VolumeLabel=""}
03-winfsp-passthrou[TID=abd0]: FFFF808DA8EC3470: >>Close 0000000000000000:0000029EAA7FCAB0
03-winfsp-passthrou[TID=abd0]: FFFF808DA8EC3470: <<Close IoStatus=0[0]
03-winfsp-passthrou[TID=abd0]: FFFF808DD04DE010: >>Create [UT----] "\", FILE_OPEN, CreateOptions=800021, FileAttributes=10, Security=NULL, AllocationSize=0:0, AccessToken=0000000000000254[PID=10f8], DesiredAccess=100000, GrantedAccess=0, ShareAccess=0
03-winfsp-passthrou[TID=abd0]: FFFF808DD04DE010: <<Create IoStatus=0[1] UserContext=0000000000000000:0000029EAA7FCAB0, GrantedAccess=100000, FileInfo={FileAttributes=10, ReparseTag=0, AllocationSize=0:1000, FileSize=0:1000, CreationTime=2025-10-28T05:43:44.891Z, LastAccessTime=2025-10-28T06:14:40.167Z, LastWriteTime=2025-10-28T06:14:40.167Z, ChangeTime=2025-10-28T06:14:40.167Z, IndexNumber=170000:2296c}
03-winfsp-passthrou[TID=abd0]: FFFF808DA1E049A0: >>Close 0000000000000000:0000029EAA7FCAB0
03-winfsp-passthrou[TID=abd0]: FFFF808DA1E049A0: <<Close IoStatus=0[0]
...

net use を使ってマウントする方法を試してみる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?