Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 38 additions & 40 deletions drivers/filesystems/udfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,53 @@
include_directories(Include)

list(APPEND SOURCE
udf_info/alloc.cpp
udf_info/dirtree.cpp
udf_info/extent.cpp
udf_info/mount.cpp
udf_info/phys_eject.cpp
udf_info/physical.cpp
udf_info/remap.cpp
udf_info/udf_info.cpp
cleanup.cpp
close.cpp
create.cpp
devcntrl.cpp
dircntrl.cpp
env_spec.cpp
fastio.cpp
fileinfo.cpp
flush.cpp
fscntrl.cpp
lockctrl.cpp
mem.cpp
misc.cpp
namesup.cpp
prefxsup.cpp
pnp.cpp
read.cpp
secursup.cpp
shutdown.cpp
sys_spec.cpp
udf_dbg.cpp
udfinit.cpp
unload.cpp
verfysup.cpp
volinfo.cpp
write.cpp
strucsup.cpp
filobsup.cpp
udfdata.cpp
udf_info/alloc.c
udf_info/dirtree.c
udf_info/extent.c
udf_info/mount.c
udf_info/phys_eject.c
udf_info/physical.c
udf_info/remap.c
udf_info/udf_info.c
cleanup.c
close.c
create.c
devcntrl.c
dircntrl.c
env_spec.c
fastio.c
fileinfo.c
flush.c
fscntrl.c
lockctrl.c
mem.c
misc.c
namesup.c
prefxsup.c
pnp.c
read.c
secursup.c
shutdown.c
sys_spec.c
udf_dbg.c
udfinit.c
unload.c
verfysup.c
volinfo.c
write.c
strucsup.c
filobsup.c
udfdata.c
udffs.h)

add_library(udfs MODULE ${SOURCE} udffs.rc)

if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(udfs PRIVATE -Wno-unused-but-set-variable)
target_compile_options(udfs PRIVATE -Wno-invalid-offsetof)
target_compile_options(udfs PRIVATE -Wno-error -fpermissive)
endif()

if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(udfs PRIVATE -Wno-extern-c-compat -Wno-unused-value)
target_compile_options(udfs PRIVATE -Wno-unused-value)
target_compile_options(udfs PRIVATE -Wno-tautological-constant-out-of-range-compare)
target_compile_options(udfs PRIVATE -Wno-tautological-unsigned-zero-compare -Wno-self-assign)
target_compile_options(udfs PRIVATE -Wno-sometimes-uninitialized -Wno-parentheses-equality)
Expand Down
2 changes: 1 addition & 1 deletion drivers/filesystems/udfs/Include/Sys_spec_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ __inline LARGE_INTEGER UDFMakeLargeInteger(LONGLONG value) {

#define UDFGetNTFileId(Vcb, fi) \
UDFMakeLargeInteger((((fi)->Dloc->FELoc.Mapping[0].extLocation - UDFPartStart(Vcb, -2)) + \
((LONGLONG)Vcb<<32)))
((LONGLONG)(ULONG_PTR)Vcb<<32)))

#define UnicodeIsPrint(a) RtlIsValidOemCharacter(&(a))

Expand Down
11 changes: 7 additions & 4 deletions drivers/filesystems/udfs/Include/mem_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern ULONG MemTotalAllocated;
#define MY_HEAP_MAX_FRAMES 512
#define MY_HEAP_MAX_BLOCKS 4*1024 // blocks per frame

#ifdef MY_USE_INTERNAL_MEMMANAGER
// Mem
BOOLEAN MyAllocInit(VOID);
VOID MyAllocRelease(VOID);
Expand All @@ -66,6 +67,8 @@ ULONG __fastcall MyReallocPool( PCHAR addr, ULONG OldLength, PCHAR* NewBuff, ULO
#endif
VOID __fastcall MyFreePool(PCHAR addr);

#endif // MY_USE_INTERNAL_MEMMANAGER

#ifdef MY_HEAP_CHECK_BOUNDS
#define MY_HEAP_ALIGN 63
#else
Expand Down Expand Up @@ -130,7 +133,7 @@ MyFindMemBaseByAddr(
#define MyAlignSize__(size) (size)
#endif

BOOLEAN inline MyAllocInit(VOID) {return TRUE;}
static inline BOOLEAN MyAllocInit(VOID) {return TRUE;}
#define MyAllocRelease()

#ifndef MY_MEM_BOUNDS_CHECK
Expand Down Expand Up @@ -176,7 +179,7 @@ PVOID inline MyAllocatePool__(ULONG type, ULONG len) {
}
*/

PVOID inline MyAllocatePoolTag__(ULONG type, ULONG len, /*PCHAR*/ULONG tag) {
static inline PVOID MyAllocatePoolTag__(ULONG type, ULONG len, /*PCHAR*/ULONG tag) {
PCHAR newaddr;
ULONG i;
// newaddr = (PCHAR)MyAllocatePoolTag_(type, len+MY_HEAP_ALIGN+1, tag);
Expand All @@ -193,7 +196,7 @@ PVOID inline MyAllocatePoolTag__(ULONG type, ULONG len, /*PCHAR*/ULONG tag) {
return newaddr;
}

VOID inline MyFreePool__(PVOID addr) {
static inline VOID MyFreePool__(PVOID addr) {
PCHAR newaddr;
// ULONG i;
newaddr = (PCHAR)addr;
Expand All @@ -220,7 +223,7 @@ VOID inline MyFreePool__(PVOID addr) {
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif

ULONG inline MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen) {
static inline ULONG MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen) {
ULONG _len, _newlen;
_newlen = MyAlignSize__(newlen);
_len = MyAlignSize__(len);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,14 +796,14 @@ UDFGetBlockSize(
if (UDFGetDevType(DeviceObject) == FILE_DEVICE_DISK) {
UDFPrint(("UDFGetBlockSize: HDD\n"));
RC = UDFPhSendIOCTL(IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,DeviceObject,
0,NULL,
NULL,0,
&DiskGeometryEx,sizeof(DISK_GEOMETRY_EX),
TRUE,NULL );

if (!NT_SUCCESS(RC))
try_return(RC);
RC = UDFPhSendIOCTL(IOCTL_DISK_GET_PARTITION_INFO,DeviceObject,
0,NULL,
NULL,0,
&PartitionInfo,sizeof(PARTITION_INFORMATION),
TRUE,NULL );
if (!NT_SUCCESS(RC)) {
Expand Down Expand Up @@ -1002,7 +1002,6 @@ UDFPrepareForReadOperation(
Vcb->VcbState &= ~UDF_VCB_LAST_WRITE;
return STATUS_SUCCESS;
}
uint32 i = Vcb->LastReadTrack;

#ifdef _UDF_STRUCTURES_H_
if (Vcb->BSBM_Bitmap) {
Expand Down Expand Up @@ -1036,7 +1035,7 @@ UDFReadSectors(
OUT PULONG ReadBytes
)
{
return UDFTRead(IrpContext, Vcb, Buffer, BCount*Vcb->SectorSize, Lba, ReadBytes);
return UDFTRead(IrpContext, Vcb, Buffer, BCount*Vcb->SectorSize, Lba, ReadBytes, 0);
} // end UDFReadSectors()

/*
Expand Down Expand Up @@ -1167,7 +1166,7 @@ UDFWriteSectors(
Vcb->LastLBA = Lba+BCount-1;
}

status = UDFTWrite(IrpContext, Vcb, Buffer, BCount<<Vcb->SectorShift, Lba, WrittenBytes);
status = UDFTWrite(IrpContext, Vcb, Buffer, BCount<<Vcb->SectorShift, Lba, WrittenBytes, 0);
ASSERT(NT_SUCCESS(status));

return status;
Expand Down
4 changes: 2 additions & 2 deletions drivers/filesystems/udfs/Include/phys_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ UDFTRead(
SIZE_T Length,
ULONG LBA,
PULONG ReadBytes,
ULONG Flags = 0
ULONG Flags
);

NTSTATUS
Expand All @@ -26,7 +26,7 @@ UDFTWrite(
IN SIZE_T Length,
IN ULONG LBA,
OUT PSIZE_T WrittenBytes,
IN ULONG Flags = 0
IN ULONG Flags
);

#define PH_TMP_BUFFER 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// This file was released under the GPLv2 on June 2015.
////////////////////////////////////////////////////////////////////

extern "C"
ULONG
MyRtlCompareMemory(
PVOID s1,
Expand All @@ -26,7 +25,6 @@ MyRtlCompareMemory(

#ifndef NT_NATIVE_MODE

extern "C"
ULONG
RtlCompareUnicodeString(
PUNICODE_STRING s1,
Expand All @@ -41,7 +39,6 @@ RtlCompareUnicodeString(
return i;
}

extern "C"
NTSTATUS
RtlUpcaseUnicodeString(
PUNICODE_STRING dst,
Expand All @@ -57,7 +54,6 @@ RtlUpcaseUnicodeString(
return STATUS_SUCCESS;
}

extern "C"
NTSTATUS
RtlAppendUnicodeToString(
IN PUNICODE_STRING Str1,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ UDFPhReadSynchronous(
PIO_STACK_LOCATION IrpSp;
KIRQL CurIrql = KeGetCurrentIrql();
PVOID IoBuf = NULL;
PVCB Vcb = NULL;

ROffset.QuadPart = Offset;
(*ReadBytes) = 0;
Expand Down Expand Up @@ -252,8 +251,6 @@ UDFPhWriteSynchronous(
KIRQL CurIrql = KeGetCurrentIrql();
PVOID IoBuf = NULL;

PVCB Vcb = NULL;

#ifdef DBG
if (UDF_SIMULATE_WRITES) {
/* FIXME ReactOS
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ UDFMountVolume(
ASSERT(IrpSp);
UDFPrint(("\n !!! UDFMountVolume\n"));

auto RealDevice = Vpb->RealDevice;
PDEVICE_OBJECT RealDevice = Vpb->RealDevice;

SetDoVerifyOnFail = UDFRealDevNeedsVerify(RealDevice);

Expand Down Expand Up @@ -1339,7 +1339,7 @@ UDFGetVolumeBitmap(

// Fill in the fixed part of the output buffer

__try {
_SEH2_TRY {

// StartingLcn in output = aligned starting block

Expand All @@ -1349,10 +1349,10 @@ UDFGetVolumeBitmap(

OutputBuffer->BitmapSize.QuadPart = DesiredClusters;

} __except (EXCEPTION_EXECUTE_HANDLER) {
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {

try_return(Status = STATUS_INVALID_USER_BUFFER);
}
} _SEH2_END

OutputBufferLength -= FIELD_OFFSET(VOLUME_BITMAP_BUFFER, Buffer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
// define the file specific bug-check id
#define UDF_BUG_CHECK_ID UDF_FILE_MEM

#include "Include/mem_tools.cpp"
#include "Include/mem_tools.c"
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ UDFCreateIrpContext(
}

// TODO: fix
if (false && IrpSp->FileObject != NULL) {
if (FALSE && IrpSp->FileObject != NULL) {

PFILE_OBJECT FileObject = IrpSp->FileObject;

Expand Down Expand Up @@ -1867,5 +1867,5 @@ UDFWaitForIoAtEof(
return TRUE;
}

#include "Include/regtools.cpp"
#include "Include/regtools.c"

File renamed without changes.
14 changes: 8 additions & 6 deletions drivers/filesystems/udfs/protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ UDFCommonShutdown(
/*************************************************************************
* Prototypes for the file UDFinit.cpp
*************************************************************************/
extern "C" NTSTATUS NTAPI DriverEntry(
NTSTATUS NTAPI DriverEntry(
PDRIVER_OBJECT DriverObject, // created by the I/O sub-system
PUNICODE_STRING RegistryPath); // path to the registry key

Expand Down Expand Up @@ -1337,6 +1337,8 @@ enum TYPE_OF_ACQUIRE {

};

typedef enum TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE;

_Requires_lock_held_(_Global_critical_region_)
_When_(Type == AcquireExclusive && return != FALSE, _Acquires_exclusive_lock_(*Resource))
_When_(Type == AcquireShared && return != FALSE, _Acquires_shared_lock_(*Resource))
Expand Down Expand Up @@ -1383,7 +1385,7 @@ UDFAcquireResource(
#define UDFReleasePagingIo(IC,F) \
ExReleaseResourceLite((F)->Header.PagingIoResource)

inline
static inline
ULONG
UDFHighBit(
ULONG Word
Expand All @@ -1407,7 +1409,7 @@ UDFHighBit(

#define SectorSize(V) ((V)->SectorSize)

inline
static inline
ULONG
SectorAlign(
PVCB Vcb,
Expand All @@ -1417,7 +1419,7 @@ SectorAlign(
return (Length + (Vcb->SectorSize - 1)) & ~(Vcb->SectorSize - 1);
}

inline
static inline
ULONGLONG
LlSectorAlign(
PVCB Vcb,
Expand All @@ -1439,15 +1441,15 @@ UDFSetThreadContext(
(IC)->ThreadContext = NULL


inline
static inline
BOOLEAN UdfIsExtendedFESupported(
_In_ PVCB Vcb
)
{
return Vcb->NSRDesc == VRS_NSR03_FOUND;
}

inline
static inline
BOOLEAN UDFIsStreamsSupported(
_In_ PVCB Vcb
)
Expand Down
File renamed without changes.
Loading