ReactOS  0.4.14-dev-583-g2a1ba2c
phys_lib.h
Go to the documentation of this file.
1 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3 // All rights reserved
4 // This file was released under the GPLv2 on June 2015.
6 
7 #ifndef __UDF_PHYS_LIB__H__
8 #define __UDF_PHYS_LIB__H__
9 
10 #ifndef UDF_FORMAT_MEDIA
11 extern BOOLEAN open_as_device;
13 extern ULONG LockMode;
14 #endif //UDF_FORMAT_MEDIA
15 
16 extern NTSTATUS UDFSyncCache(
17  IN PVCB Vcb
18  );
19 
23  IN void* _Vcb,
24  IN void* Buffer, // Target buffer
26  IN uint32 LBA,
27  OUT PSIZE_T IOBytes,
29  );
30 
31 extern OSSTATUS
33  IN void* _Vcb,
34  IN void* Buffer, // Target buffer
36  IN uint32 LBA,
37  OUT PSIZE_T WrittenBytes,
39  );
40 
41 extern OSSTATUS
43  IN void* _Vcb,
44  IN void* Buffer, // Target buffer
46  IN uint32 LBA,
49  );
50 
51 extern OSSTATUS UDFTRead(PVOID _Vcb,
52  PVOID Buffer, // Target buffer
53  SIZE_T Length,
54  ULONG LBA,
56  ULONG Flags = 0);
57 
58 extern OSSTATUS UDFTWrite(IN PVOID _Vcb,
59  IN PVOID Buffer, // Target buffer
61  IN ULONG LBA,
62  OUT PSIZE_T WrittenBytes,
63  IN ULONG Flags = 0);
64 
65 #define PH_TMP_BUFFER 1
66 #define PH_VCB_IN_RETLEN 2
67 #define PH_LOCK_CACHE 0x10000000
68 
69 #define PH_EX_WRITE 0x80000000
70 #define PH_IO_LOCKED 0x20000000
71 
72 
73 extern
75 UDFDoOPC(
76  IN PVCB Vcb
77  );
78 
80  IN PVCB Vcb,
81  IN ULONG Lba,
82  IN ULONG BCount);
83 
84 extern OSSTATUS UDFReadDiscTrackInfo(PDEVICE_OBJECT DeviceObject, // the target device object
85  PVCB Vcb); // Volume Control Block for ^ DevObj
86 
87 extern OSSTATUS UDFReadAndProcessFullToc(PDEVICE_OBJECT DeviceObject, // the target device object
88  PVCB Vcb);
89 
90 extern OSSTATUS UDFUseStandard(PDEVICE_OBJECT DeviceObject, // the target device object
91  PVCB Vcb); // Volume control block fro this DevObj
92 
93 extern OSSTATUS UDFGetBlockSize(PDEVICE_OBJECT DeviceObject, // the target device object
94  PVCB Vcb); // Volume control block fro this DevObj
95 
96 extern OSSTATUS UDFGetDiskInfo(IN PDEVICE_OBJECT DeviceObject, // the target device object
97  IN PVCB Vcb); // Volume control block from this DevObj
98 
100 
102 
104  IN uint32 Lba,
105  IN uint32 BCount
106  );
107 //#define UDFPrepareForReadOperation(a,b) (STATUS_SUCCESS)
108 
109 extern VOID UDFUpdateNWA(PVCB Vcb,
110  ULONG LBA,
111  ULONG BCount,
112  OSSTATUS RC);
113 
116  IN BOOLEAN Eject);
117 
118 // read physical sectors
119 /*OSSTATUS UDFReadSectors(IN PVCB Vcb,
120  IN BOOLEAN Translate,// Translate Logical to Physical
121  IN ULONG Lba,
122  IN ULONG BCount,
123  IN BOOLEAN Direct,
124  OUT PCHAR Buffer,
125  OUT PULONG ReadBytes);*/
126 #define UDFReadSectors(Vcb, Translate, Lba, BCount, Direct, Buffer, ReadBytes) \
127  (( WCacheIsInitialized__(&((Vcb)->FastCache)) && (KeGetCurrentIrql() < DISPATCH_LEVEL)) ? \
128  (WCacheReadBlocks__(&((Vcb)->FastCache), Vcb, Buffer, Lba, BCount, ReadBytes, Direct)) : \
129  (UDFTRead(Vcb, Buffer, ((SIZE_T)(BCount))<<((Vcb)->BlockSizeBits), Lba, ReadBytes, 0)))
130 
131 
132 // read data inside physical sector
134  IN BOOLEAN Translate, // Translate Logical to Physical
135  IN ULONG Lba,
136  IN ULONG i, // offset in sector
137  IN ULONG l, // transfer length
138  IN BOOLEAN Direct,
139  OUT PCHAR Buffer,
141 // read unaligned data
143  IN BOOLEAN Translate, // Translate Logical to Physical
145  IN ULONG Length,
146  IN BOOLEAN Direct,
147  OUT PCHAR Buffer,
149 
150 #ifndef UDF_READ_ONLY_BUILD
151 // write physical sectors
153  IN BOOLEAN Translate, // Translate Logical to Physical
154  IN ULONG Lba,
155  IN ULONG WBCount,
156  IN BOOLEAN Direct, // setting this flag delays flushing of given
157  // data to indefinite term
158  IN PCHAR Buffer,
159  OUT PSIZE_T WrittenBytes);
160 // write directly to cached sector
162  IN BOOLEAN Translate, // Translate Logical to Physical
163  IN ULONG Lba,
164  IN ULONG i, // offset in sector
165  IN ULONG l, // transfer length
166  IN BOOLEAN Direct,
167  OUT PCHAR Buffer,
168  OUT PSIZE_T WrittenBytes);
169 // write data at unaligned offset & length
171  IN BOOLEAN Translate, // Translate Logical to Physical
173  IN SIZE_T Length,
174  IN BOOLEAN Direct, // setting this flag delays flushing of given
175  // data to indefinite term
176  IN PCHAR Buffer,
177  OUT PSIZE_T WrittenBytes);
178 #endif //UDF_READ_ONLY_BUILD
179 
182  IN BOOLEAN Unlock);
183 
184 
185 #endif //__UDF_PHYS_LIB__H__
signed char * PCHAR
Definition: retypes.h:7
#define IN
Definition: typedefs.h:38
OSSTATUS UDFTRead(PVOID _Vcb, PVOID Buffer, SIZE_T Length, ULONG LBA, PSIZE_T ReadBytes, ULONG Flags=0)
OSSTATUS UDFWriteData(IN PVCB Vcb, IN BOOLEAN Translate, IN LONGLONG Offset, IN SIZE_T Length, IN BOOLEAN Direct, IN PCHAR Buffer, OUT PSIZE_T WrittenBytes)
VOID NTAPI UDFEjectReqWaiter(IN PVOID Context)
#define __fastcall
Definition: sync.c:41
unsigned int uint32
Definition: types.h:32
LONG NTSTATUS
Definition: precomp.h:26
Definition: cdstruc.h:504
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
Definition: phys_lib.cpp:4199
OSSTATUS UDFReadData(IN PVCB Vcb, IN BOOLEAN Translate, IN LONGLONG Offset, IN ULONG Length, IN BOOLEAN Direct, OUT PCHAR Buffer, OUT PSIZE_T ReadBytes)
OSSTATUS UDFUseStandard(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
Definition: phys_lib.cpp:2386
OSSTATUS UDFWriteInSector(IN PVCB Vcb, IN BOOLEAN Translate, IN ULONG Lba, IN ULONG i, IN ULONG l, IN BOOLEAN Direct, OUT PCHAR Buffer, OUT PSIZE_T WrittenBytes)
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID UDFUpdateNWA(PVCB Vcb, ULONG LBA, ULONG BCount, OSSTATUS RC)
Definition: phys_lib.cpp:3826
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define OSSTATUS
Definition: env_spec_w32.h:57
VOID UDFStopEjectWaiter(PVCB Vcb)
Definition: phys_eject.cpp:673
unsigned char BOOLEAN
Definition: bufpool.h:45
OSSTATUS UDFPrepareForWriteOperation(IN PVCB Vcb, IN ULONG Lba, IN ULONG BCount)
Definition: phys_lib.cpp:893
static NTSTATUS ReadBytes(IN PDEVICE_OBJECT LowerDevice, OUT PUCHAR Buffer, IN ULONG BufferSize, OUT PULONG_PTR FilledBytes)
Definition: detect.c:67
r l[0]
Definition: byte_order.h:167
OSSTATUS UDFGetDiskInfo(IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
Definition: phys_lib.cpp:3050
int64_t LONGLONG
Definition: typedefs.h:66
#define Vcb
Definition: cdprocs.h:1425
OSSTATUS UDFWriteSectors(IN PVCB Vcb, IN BOOLEAN Translate, IN ULONG Lba, IN ULONG WBCount, IN BOOLEAN Direct, IN PCHAR Buffer, OUT PSIZE_T WrittenBytes)
OSSTATUS UDFReadInSector(IN PVCB Vcb, IN BOOLEAN Translate, IN ULONG Lba, IN ULONG i, IN ULONG l, IN BOOLEAN Direct, OUT PCHAR Buffer, OUT PSIZE_T ReadBytes)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
OSSTATUS UDFTWrite(IN PVOID _Vcb, IN PVOID Buffer, IN SIZE_T Length, IN ULONG LBA, OUT PSIZE_T WrittenBytes, IN ULONG Flags=0)
BOOLEAN open_as_device
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS UDFSyncCache(IN PVCB Vcb)
Definition: phys_lib.cpp:52
OSSTATUS UDFReadDiscTrackInfo(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
Definition: phys_lib.cpp:1635
OSSTATUS UDFTWriteVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T WrittenBytes, IN uint32 Flags)
OSSTATUS UDFDoOPC(IN PVCB Vcb)
Definition: phys_lib.cpp:850
ULONG LockMode
Definition: env_spec_w32.cpp:8
OSSTATUS UDFGetBlockSize(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
#define OUT
Definition: typedefs.h:39
OSSTATUS __fastcall UDFTIOVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T IOBytes, IN uint32 Flags)
unsigned int ULONG
Definition: retypes.h:1
OSSTATUS UDFPrepareForReadOperation(IN PVCB Vcb, IN uint32 Lba, IN uint32 BCount)
Definition: phys_lib.cpp:3670
BOOLEAN opt_invalidate_volume
Definition: env_spec_w32.cpp:9
OSSTATUS UDFTReadVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
OSSTATUS UDFReadAndProcessFullToc(PDEVICE_OBJECT DeviceObject, PVCB Vcb)
Definition: phys_lib.cpp:2243
OSSTATUS UDFDoDismountSequence(IN PVCB Vcb, IN PPREVENT_MEDIA_REMOVAL_USER_IN Buf, IN BOOLEAN Eject)
Definition: phys_eject.cpp:704
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1664