2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: drivers/filesystems/npfs/volume.c
5 * PURPOSE: Named pipe filesystem
6 * PROGRAMMER: Eric Kohl
9 /* INCLUDES *****************************************************************/
16 /* FUNCTIONS ****************************************************************/
20 NpQueryFsDeviceInformation(IN PFILE_FS_DEVICE_INFORMATION FsDeviceInfo
,
21 OUT PULONG BufferLength
)
24 DPRINT("NpfsQueryFsDeviceInformation()\n");
25 DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo
);
27 if (*BufferLength
< sizeof(FILE_FS_DEVICE_INFORMATION
))
29 return STATUS_BUFFER_OVERFLOW
;
32 FsDeviceInfo
->DeviceType
= FILE_DEVICE_NAMED_PIPE
;
33 FsDeviceInfo
->Characteristics
= 0;
35 *BufferLength
-= sizeof(FILE_FS_DEVICE_INFORMATION
);
37 DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
39 return STATUS_SUCCESS
;
44 NpQueryFsFullSizeInfo(IN PFILE_FS_FULL_SIZE_INFORMATION FsSizeInfo
,
45 OUT PULONG BufferSize
)
47 RtlZeroMemory(FsSizeInfo
, sizeof(FILE_FS_FULL_SIZE_INFORMATION
));
48 *BufferSize
-= sizeof(FILE_FS_FULL_SIZE_INFORMATION
);
49 return STATUS_SUCCESS
;
54 NpQueryFsSizeInfo(IN PFILE_FS_SIZE_INFORMATION FsSizeInfo
,
55 OUT PULONG BufferSize
)
57 FsSizeInfo
->TotalAllocationUnits
.LowPart
= 0;
58 FsSizeInfo
->TotalAllocationUnits
.HighPart
= 0;
59 FsSizeInfo
->AvailableAllocationUnits
.LowPart
= 0;
60 FsSizeInfo
->AvailableAllocationUnits
.HighPart
= 0;
61 FsSizeInfo
->SectorsPerAllocationUnit
= 1;
62 FsSizeInfo
->BytesPerSector
= 1;
63 *BufferSize
-= sizeof(FILE_FS_SIZE_INFORMATION
);
64 return STATUS_SUCCESS
;
69 NpQueryFsAttributeInformation(IN PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo
,
70 OUT PULONG BufferLength
)
73 DPRINT("NpfsQueryFsAttributeInformation() called.\n");
74 DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo
);
76 if (*BufferLength
< sizeof(FILE_FS_ATTRIBUTE_INFORMATION
) + 8)
79 return STATUS_BUFFER_OVERFLOW
;
82 FsAttributeInfo
->FileSystemAttributes
= FILE_CASE_PRESERVED_NAMES
;
83 FsAttributeInfo
->MaximumComponentNameLength
= -1;
84 FsAttributeInfo
->FileSystemNameLength
= 8;
85 wcscpy(FsAttributeInfo
->FileSystemName
, L
"NPFS");
87 DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
88 *BufferLength
-= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION
) + 8);
90 return STATUS_SUCCESS
;
95 NpCommonQueryVolumeInformation(IN PIRP Irp
)
97 PIO_STACK_LOCATION Stack
;
98 FS_INFORMATION_CLASS FsInformationClass
;
104 Stack
= IoGetCurrentIrpStackLocation(Irp
);
105 FsInformationClass
= Stack
->Parameters
.QueryVolume
.FsInformationClass
;
106 BufferLength
= Stack
->Parameters
.QueryVolume
.Length
;
107 SystemBuffer
= Irp
->AssociatedIrp
.SystemBuffer
;
109 DPRINT("FsInformationClass %d\n", FsInformationClass
);
110 DPRINT("SystemBuffer %p\n", SystemBuffer
);
112 switch (FsInformationClass
)
114 case FileFsFullSizeInformation
:
115 Status
= NpQueryFsFullSizeInfo(SystemBuffer
, &BufferLength
);
117 case FileFsSizeInformation
:
118 Status
= NpQueryFsSizeInfo(SystemBuffer
, &BufferLength
);
121 case FileFsDeviceInformation
:
122 Status
= NpQueryFsDeviceInformation(SystemBuffer
, &BufferLength
);
125 case FileFsAttributeInformation
:
126 Status
= NpQueryFsAttributeInformation(SystemBuffer
, &BufferLength
);
130 DPRINT1("Query not implemented: %d\n", FsInformationClass
);
131 Status
= STATUS_NOT_SUPPORTED
;
134 Irp
->IoStatus
.Information
= Stack
->Parameters
.QueryVolume
.Length
- BufferLength
;
140 NpfsQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject
,
145 DPRINT("NpfsQueryVolumeInformation(DeviceObject %p, Irp %p)\n", DeviceObject
, Irp
);
147 FsRtlEnterFileSystem();
148 Status
= NpCommonQueryVolumeInformation(Irp
);
149 FsRtlExitFileSystem();
151 if (Status
!= STATUS_PENDING
)
153 Irp
->IoStatus
.Status
= Status
;
155 IoCompleteRequest(Irp
, IO_DISK_INCREMENT
);