Windows: FILE_FS_DEVICE_INFORMATION Device Type
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 25 Jan 2013 05:11:41 +0000 (00:11 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 2 Feb 2013 17:21:58 +0000 (09:21 -0800)
Consistently report our device type as FILE_DEVICE_NETWORK_FILE_SYSTEM
instead of FILE_DEVICE_DISK or FILE_DEVICE_DISK_FILE_SYSTEM except
when returning FILE_FS_DEVICE_INFORMATION where we must lie and state
that the device type is FILE_DEVICE_DISK.  Otherwise, the Win32 API
GetFileType() returns FILE_TYPE_UNKNOWN instead of FILE_TYPE_DISK.

Applications built from msys (but not current cygwin) treat files
of type FILE_TYPE_UNKNOWN as special character devices instead of
files.  This breaks msysGit.

Change-Id: I7107ae84ede31abb01481b2e8c3915588d9fd529
Reviewed-on: http://gerrit.openafs.org/8973
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSInit.cpp
src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp

index 6a69bfe..6bd8756 100644 (file)
@@ -165,7 +165,7 @@ DriverEntry( PDRIVER_OBJECT DriverObject,
         }
 
         //
-        // Initilize the control device
+        // Initialize the control device
         //
 
         RtlInitUnicodeString( &uniDeviceName,
@@ -174,7 +174,7 @@ DriverEntry( PDRIVER_OBJECT DriverObject,
         ntStatus = IoCreateDevice( DriverObject,
                                    sizeof( AFSDeviceExt),
                                    &uniDeviceName,
-                                   FILE_DEVICE_DISK_FILE_SYSTEM,
+                                   FILE_DEVICE_NETWORK_FILE_SYSTEM,
                                    0,
                                    FALSE,
                                    &AFSLibraryDeviceObject);
index deeacb4..672e4a6 100644 (file)
@@ -397,6 +397,14 @@ AFSQueryFsDeviceInfo( IN AFSVolumeInfoCB *VolumeInfo,
     if( *Length >= (LONG)sizeof( FILE_FS_DEVICE_INFORMATION))
     {
 
+        //
+        // This value is used to determine the return type of
+        // Win32 GetFileType().  Returning FILE_DEVICE_NETWORK_FILE_SYSTEM
+        // results in GetFileType returning FILE_TYPE_UNKNOWN which breaks
+        // msys-based applications.  They treat all files as character
+        // special devices instead of files.
+        //
+
         Buffer->DeviceType = FILE_DEVICE_DISK;
 
         Buffer->Characteristics = VolumeInfo->Characteristics;