ReactOS  0.4.14-dev-52-g6116262
rfsd.h File Reference
#include <linux/module.h>
#include "reiserfs.h"
#include <ntdddisk.h>
Include dependency graph for rfsd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RFSD_IDENTIFIER
 
struct  _RFSD_REPINNED_BCBS
 
struct  _RFSD_GLOBAL
 
struct  RFSDFS_EXT
 
struct  _RFSD_FCBVCB
 
struct  _RFSD_VCB
 
struct  _RFSD_FCB
 
struct  _RFSD_MCB
 
struct  _RFSD_CCB
 
struct  _RFSD_IRP_CONTEXT
 
struct  _RFSD_ALLOC_HEADER
 
struct  _FCB_LIST_ENTRY
 
struct  _RFSD_BDL
 

Macros

#define RFSD_CALLBACK(name)   NTSTATUS(* name )(ULONG BlockNumber, PVOID pContext)
 
#define RFSD_NAME_LEN   255
 
#define SUPER_BLOCK_OFFSET   REISERFS_DISK_OFFSET_IN_BYTES
 
#define SUPER_BLOCK_SIZE   sizeof(RFSD_SUPER_BLOCK)
 
#define RFSD_ROOT_PARENT_ID   1
 
#define RFSD_ROOT_OBJECT_ID   2
 
#define RFSD_IS_ROOT_KEY(x)   (x.k_dir_id == RFSD_ROOT_PARENT_ID && x.k_objectid == RFSD_ROOT_OBJECT_ID)
 
#define RFSD_IS_PTR_TO_ROOT_KEY(x)   (x->k_dir_id == RFSD_ROOT_PARENT_ID && x->k_objectid == RFSD_ROOT_OBJECT_ID)
 
#define RFSD_KEY_VERSION_1   0
 
#define RFSD_KEY_VERSION_2   1
 
#define RFSD_KEY_VERSION_UNKNOWN   7
 
#define RFSD_KEYS_MATCH   0
 
#define RFSD_KEY_SMALLER   -1
 
#define RFSD_KEY_LARGER   1
 
#define RFSD_LEAF_BLOCK_LEVEL   1
 
#define DbgBreak()   DbgPrint("rfsd: breakpoint ignored.\n")
 
#define RFSD_VERSION   "0.26"
 
#define RFSD_READ_ONLY   TRUE
 
#define RFSD_UNLOAD   TRUE
 
#define RFSD_POOL_TAG   'dsfR'
 
#define RFSD_BLOCK_TYPES   (0x04)
 
#define MAXIMUM_RECORD_LENGTH   (0x10000)
 
#define SECTOR_BITS   (Vcb->SectorBits)
 
#define SECTOR_SIZE   (Vcb->DiskGeometry.BytesPerSector)
 
#define DEFAULT_SECTOR_SIZE   (0x200)
 
#define READ_AHEAD_GRANULARITY   (0x10000)
 
#define SUPER_BLOCK   (Vcb->SuperBlock)
 
#define BLOCK_SIZE   (Vcb->BlockSize)
 
#define BLOCK_BITS   (SUPER_BLOCK->s_log_block_size + 10)
 
#define INODES_COUNT   (Vcb->SuperBlock->s_inodes_count)
 
#define INODES_PER_GROUP   (SUPER_BLOCK->s_inodes_per_group)
 
#define BLOCKS_PER_GROUP   (SUPER_BLOCK->s_blocks_per_group)
 
#define TOTAL_BLOCKS   (SUPER_BLOCK->s_blocks_count)
 
#define RFSD_FIRST_DATA_BLOCK   (SUPER_BLOCK->s_first_data_block)
 
#define CEILING_ALIGNED(A, B)   (((A) + (B) - 1) & (~((B) - 1)))
 
#define __STR2__(x)   #x
 
#define __STR1__(x)   __STR2__(x)
 
#define __SLINE__   __STR1__(__LINE__)
 
#define DRIVER_NAME   "Rfsd"
 
#define DEVICE_NAME   L"\\Rfsd"
 
#define PARAMETERS_KEY   L"\\Parameters"
 
#define WRITING_SUPPORT   L"WritingSupport"
 
#define CHECKING_BITMAP   L"CheckingBitmap"
 
#define EXT3_FORCEWRITING   L"Ext3ForceWriting"
 
#define EXT3_CODEPAGE   L"CodePage"
 
#define SetFlag(x, f)   ((x) |= (f))
 
#define ClearFlag(x, f)   ((x) &= ~(f))
 
#define IsFlagOn(a, b)   ((BOOLEAN)(FlagOn(a,b) == b))
 
#define RfsdRaiseStatus(IRPCONTEXT, STATUS)
 
#define RfsdNormalizeAndRaiseStatus(IRPCONTEXT, STATUS)
 
#define FILE_WRITE_TO_END_OF_FILE   0xffffffff
 
#define FILE_USE_FILE_POINTER_POSITION   0xfffffffe
 
#define IsEndOfFile(Pos)
 
#define IsDirectory(Fcb)   IsFlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)
 
#define RFSD_FILE_SYSTEM   (FILE_SYSTEM)
 
#define RFSD_BUGCHK_BLOCK   (0x00010000)
 
#define RFSD_BUGCHK_CLEANUP   (0x00020000)
 
#define RFSD_BUGCHK_CLOSE   (0x00030000)
 
#define RFSD_BUGCHK_CMCB   (0x00040000)
 
#define RFSD_BUGCHK_CREATE   (0x00050000)
 
#define RFSD_BUGCHK_DEBUG   (0x00060000)
 
#define RFSD_BUGCHK_DEVCTL   (0x00070000)
 
#define RFSD_BUGCHK_DIRCTL   (0x00080000)
 
#define RFSD_BUGCHK_DISPATCH   (0x00090000)
 
#define RFSD_BUGCHK_EXCEPT   (0x000A0000)
 
#define RFSD_BUGCHK_RFSD   (0x000B0000)
 
#define RFSD_BUGCHK_FASTIO   (0x000C0000)
 
#define RFSD_BUGCHK_FILEINFO   (0x000D0000)
 
#define RFSD_BUGCHK_FLUSH   (0x000E0000)
 
#define RFSD_BUGCHK_FSCTL   (0x000F0000)
 
#define RFSD_BUGCHK_INIT   (0x00100000)
 
#define RFSD_BUGCHK_LOCK   (0x0011000)
 
#define RFSD_BUGCHK_MEMORY   (0x0012000)
 
#define RFSD_BUGCHK_MISC   (0x0013000)
 
#define RFSD_BUGCHK_READ   (0x00140000)
 
#define RFSD_BUGCHK_SHUTDOWN   (0x00150000)
 
#define RFSD_BUGCHK_VOLINFO   (0x00160000)
 
#define RFSD_BUGCHK_WRITE   (0x00170000)
 
#define RFSD_BUGCHK_LAST   (0x00170000)
 
#define RfsdBugCheck(A, B, C, D)   { KeBugCheckEx(RFSD_FILE_SYSTEM, A | __LINE__, B, C, D ); }
 
#define RFSD_MIN_BLOCK   1024
 
#define RFSD_MIN_FRAG   1024
 
#define S_IFMT   0x0F000 /* 017 0000 */
 
#define S_IFSOCK   0x0C000 /* 014 0000 */
 
#define S_IFLNK   0x0A000 /* 012 0000 */
 
#define S_IFREG   0x08000 /* 010 0000 */
 
#define S_IFBLK   0x06000 /* 006 0000 */
 
#define S_IFDIR   0x04000 /* 004 0000 */
 
#define S_IFCHR   0x02000 /* 002 0000 */
 
#define S_IFIFO   0x01000 /* 001 0000 */
 
#define S_ISUID   0x00800 /* 000 4000 */
 
#define S_ISGID   0x00400 /* 000 2000 */
 
#define S_ISVTX   0x00200 /* 000 1000 */
 
#define S_ISREG(m)   (((m) & S_IFMT) == S_IFREG)
 
#define S_ISSOCK(m)   (((m) & S_IFMT) == S_IFSOCK)
 
#define S_ISLNK(m)   (((m) & S_IFMT) == S_IFLNK)
 
#define S_ISFIL(m)   (((m) & S_IFMT) == S_IFFIL)
 
#define S_ISBLK(m)   (((m) & S_IFMT) == S_IFBLK)
 
#define S_ISDIR(m)   (((m) & S_IFMT) == S_IFDIR)
 
#define S_ISCHR(m)   (((m) & S_IFMT) == S_IFCHR)
 
#define S_ISFIFO(m)   (((m) & S_IFMT) == S_IFIFO)
 
#define S_IPERMISSION_MASK   0x1FF /* */
 
#define S_IRWXU   0x1C0 /* 0 0700 */
 
#define S_IRUSR   0x100 /* 0 0400 */
 
#define S_IWUSR   0x080 /* 0 0200 */
 
#define S_IXUSR   0x040 /* 0 0100 */
 
#define S_IRWXG   0x038 /* 0 0070 */
 
#define S_IRGRP   0x020 /* 0 0040 */
 
#define S_IWGRP   0x010 /* 0 0020 */
 
#define S_IXGRP   0x008 /* 0 0010 */
 
#define S_IRWXO   0x007 /* 0 0007 */
 
#define S_IROTH   0x004 /* 0 0004 */
 
#define S_IWOTH   0x002 /* 0 0002 */
 
#define S_IXOTH   0x001 /* 0 0001 */
 
#define S_IRWXUGO   (S_IRWXU|S_IRWXG|S_IRWXO)
 
#define S_IALLUGO   (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
 
#define S_IRUGO   (S_IRUSR|S_IRGRP|S_IROTH)
 
#define S_IWUGO   (S_IWUSR|S_IWGRP|S_IWOTH)
 
#define S_IXUGO   (S_IXUSR|S_IXGRP|S_IXOTH)
 
#define S_ISREADABLE(m)   (((m) & S_IPERMISSION_MASK) == (S_IRUSR | S_IRGRP | S_IROTH))
 
#define S_ISWRITABLE(m)   (((m) & S_IPERMISSION_MASK) == (S_IWUSR | S_IWGRP | S_IWOTH))
 
#define RfsdSetReadable(m)   (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))
 
#define RfsdSetWritable(m)   (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))
 
#define RfsdSetReadOnly(m)   (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))
 
#define RfsdIsReadOnly(m)   (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))
 
#define I_DIRTY_SYNC   1 /* Not dirty enough for O_DATASYNC */
 
#define I_DIRTY_DATASYNC   2 /* Data-related inode changes pending */
 
#define I_DIRTY_PAGES   4 /* Data-related inode changes pending */
 
#define I_LOCK   8
 
#define I_FREEING   16
 
#define I_CLEAR   32
 
#define I_DIRTY   (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
 
#define NodeType(Ptr)   (*((RFSD_IDENTIFIER_TYPE *)(Ptr)))
 
#define RFSD_REPINNED_BCBS_ARRAY_SIZE   (8)
 
#define CODEPAGE_MAXLEN   0x20
 
#define PAGE_TABLE   RfsdGlobal->CodePage.PageTable
 
#define RFSD_UNLOAD_PENDING   0x00000001
 
#define RFSD_SUPPORT_WRITING   0x00000002
 
#define EXT3_FORCE_WRITING   0x00000004
 
#define RFSD_CHECKING_BITMAP   0x00000008
 
#define VCB_INITIALIZED   0x00000001
 
#define VCB_VOLUME_LOCKED   0x00000002
 
#define VCB_MOUNTED   0x00000004
 
#define VCB_DISMOUNT_PENDING   0x00000008
 
#define VCB_READ_ONLY   0x00000010
 
#define VCB_WRITE_PROTECTED   0x10000000
 
#define VCB_FLOPPY_DISK   0x20000000
 
#define VCB_REMOVAL_PREVENTED   0x40000000
 
#define VCB_REMOVABLE_MEDIA   0x80000000
 
#define IsMounted(Vcb)   (IsFlagOn(Vcb->Flags, VCB_MOUNTED))
 
#define FCB_FROM_POOL   0x00000001
 
#define FCB_PAGE_FILE   0x00000002
 
#define FCB_DELETE_ON_CLOSE   0x00000004
 
#define FCB_DELETE_PENDING   0x00000008
 
#define FCB_FILE_DELETED   0x00000010
 
#define FCB_FILE_MODIFIED   0x00000020
 
#define MCB_FROM_POOL   0x00000001
 
#define MCB_IN_TREE   0x00000002
 
#define MCB_IN_USE   0x00000004
 
#define IsMcbUsed(Mcb)   IsFlagOn(Mcb->Flags, MCB_IN_USE)
 
#define CCB_FROM_POOL   0x00000001
 
#define CCB_ALLOW_EXTENDED_DASD_IO   0x80000000
 
#define IRP_CONTEXT_FLAG_FROM_POOL   (0x00000001)
 
#define IRP_CONTEXT_FLAG_WAIT   (0x00000002)
 
#define IRP_CONTEXT_FLAG_WRITE_THROUGH   (0x00000004)
 
#define IRP_CONTEXT_FLAG_FLOPPY   (0x00000008)
 
#define IRP_CONTEXT_FLAG_RECURSIVE_CALL   (0x00000010)
 
#define IRP_CONTEXT_FLAG_DISABLE_POPUPS   (0x00000020)
 
#define IRP_CONTEXT_FLAG_DEFERRED   (0x00000040)
 
#define IRP_CONTEXT_FLAG_VERIFY_READ   (0x00000080)
 
#define IRP_CONTEXT_STACK_IO_CONTEXT   (0x00000100)
 
#define IRP_CONTEXT_FLAG_REQUEUED   (0x00000200)
 
#define IRP_CONTEXT_FLAG_USER_IO   (0x00000400)
 
#define IRP_CONTEXT_FLAG_DELAY_CLOSE   (0x00000800)
 
#define CanRfsdWait(IRP)   IoIsOperationSynchronous(Irp)
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define DBG_VITAL   0
 
#define DBG_ERROR   1
 
#define DBG_USER   2
 
#define DBG_TRACE   3
 
#define DBG_INFO   4
 
#define DBG_FUNC   5
 
#define RfsdPrint(arg)
 
#define RfsdPrintNoIndent(arg)
 
#define RfsdCompleteRequest(Irp, bPrint, PriorityBoost)   IoCompleteRequest(Irp, PriorityBoost)
 
#define RfsdGetCurrentProcessName()
 

Typedefs

typedef struct reiserfs_super_block_v1 RFSD_SUPER_BLOCK
 
typedef struct reiserfs_super_block_v1PRFSD_SUPER_BLOCK
 
typedef struct stat_data RFSD_INODE
 
typedef struct stat_dataPRFSD_INODE
 
typedef struct block_head RFSD_BLOCK_HEAD
 
typedef struct block_headPRFSD_BLOCK_HEAD
 
typedef struct reiserfs_de_head RFSD_DENTRY_HEAD
 
typedef struct reiserfs_de_headPRFSD_DENTRY_HEAD
 
typedef struct item_head RFSD_ITEM_HEAD
 
typedef struct item_headPRFSD_ITEM_HEAD
 
typedef struct reiserfs_key RFSD_KEY_ON_DISK
 
typedef struct reiserfs_keyPRFSD_KEY_ON_DISK
 
typedef struct reiserfs_cpu_key RFSD_KEY_IN_MEMORY
 
typedef struct reiserfs_cpu_keyPRFSD_KEY_IN_MEMORY
 
typedef struct disk_child RFSD_DISK_NODE_REF
 
typedef struct disk_childPRFSD_DISK_NODE_REF
 
typedef short RFSD_KEY_COMPARISON
 
typedef __u16 RFSD_KEY_VERSION
 
typedef enum _RFSD_IDENTIFIER_TYPE RFSD_IDENTIFIER_TYPE
 
typedef struct _RFSD_IDENTIFIER RFSD_IDENTIFIER
 
typedef struct _RFSD_IDENTIFIERPRFSD_IDENTIFIER
 
typedef struct _RFSD_MCB RFSD_MCB
 
typedef struct _RFSD_MCBPRFSD_MCB
 
typedef PVOID PBCB
 
typedef struct _RFSD_REPINNED_BCBS RFSD_REPINNED_BCBS
 
typedef struct _RFSD_REPINNED_BCBSPRFSD_REPINNED_BCBS
 
typedef struct _RFSD_GLOBAL RFSD_GLOBAL
 
typedef struct _RFSD_GLOBALPRFSD_GLOBAL
 
typedef struct RFSDFS_EXTPRFSDFS_EXT
 
typedef struct _RFSD_FCBVCB RFSD_FCBVCB
 
typedef struct _RFSD_FCBVCBPRFSD_FCBVCB
 
typedef struct _RFSD_VCB RFSD_VCB
 
typedef struct _RFSD_VCBPRFSD_VCB
 
typedef struct _RFSD_FCB RFSD_FCB
 
typedef struct _RFSD_FCBPRFSD_FCB
 
typedef struct _RFSD_CCB RFSD_CCB
 
typedef struct _RFSD_CCBPRFSD_CCB
 
typedef struct _RFSD_IRP_CONTEXT RFSD_IRP_CONTEXT
 
typedef struct _RFSD_IRP_CONTEXTPRFSD_IRP_CONTEXT
 
typedef struct _RFSD_ALLOC_HEADER RFSD_ALLOC_HEADER
 
typedef struct _RFSD_ALLOC_HEADERPRFSD_ALLOC_HEADER
 
typedef struct _FCB_LIST_ENTRY FCB_LIST_ENTRY
 
typedef struct _FCB_LIST_ENTRYPFCB_LIST_ENTRY
 
typedef struct _RFSD_BDL RFSD_BDL
 
typedef struct _RFSD_BDLPRFSD_BDL
 

Enumerations

enum  _RFSD_IDENTIFIER_TYPE {
  RFSDFGD = ':DGF', RFSDVCB = ':BCV', RFSDFCB = ':BCF', RFSDCCB = ':BCC',
  RFSDICX = ':XCI', RFSDMCB = ':BCM'
}
 

Functions

NTSTATUS RfsdFindItemHeaderInBlock (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY pKey, IN PUCHAR pBlockBuffer, OUT PRFSD_ITEM_HEAD *ppTargetItemHeader, IN RFSD_KEY_COMPARISON(*fpComparisonFunction)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY))
 
NTSTATUS RfsdLoadItem (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY pItemKey, OUT PRFSD_ITEM_HEAD *ppMatchingItemHeader, OUT PUCHAR *ppItemBuffer, OUT PUCHAR *ppBlockBuffer, OUT PULONG pBlockNumber, IN RFSD_KEY_COMPARISON(*fpComparisonFunction)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY))
 
NTSTATUS RfsdLockUserBuffer (IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
 
PVOID RfsdGetUserBuffer (IN PIRP Irp)
 
NTSTATUS RfsdReadWriteBlocks (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_BDL RfsdBDL, IN ULONG Length, IN ULONG Count, IN BOOLEAN bVerify)
 
PUCHAR RfsdAllocateAndLoadBlock (IN PRFSD_VCB Vcb, IN ULONG BlockIndex)
 
NTSTATUS RfsdReadSync (IN PRFSD_VCB Vcb, IN ULONGLONG Offset, IN ULONG Length, OUT PVOID Buffer, IN BOOLEAN bVerify)
 
NTSTATUS RfsdReadDisk (IN PRFSD_VCB Vcb, IN ULONGLONG Offset, IN ULONG Size, IN PVOID Buffer, IN BOOLEAN bVerify)
 
NTSTATUS RfsdDiskIoControl (IN PDEVICE_OBJECT DeviceOjbect, IN ULONG IoctlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer, IN OUT PULONG OutputBufferSize)
 
VOID RfsdMediaEjectControl (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN BOOLEAN bPrevent)
 
NTSTATUS RfsdDiskShutDown (PRFSD_VCB Vcb)
 
NTSTATUS RfsdCleanup (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdClose (IN PRFSD_IRP_CONTEXT IrpContext)
 
VOID RfsdQueueCloseRequest (IN PRFSD_IRP_CONTEXT IrpContext)
 
VOID NTAPI RfsdDeQueueCloseRequest (IN PVOID Context)
 
BOOLEAN NTAPI RfsdAcquireForLazyWrite (IN PVOID Context, IN BOOLEAN Wait)
 
VOID NTAPI RfsdReleaseFromLazyWrite (IN PVOID Context)
 
BOOLEAN NTAPI RfsdAcquireForReadAhead (IN PVOID Context, IN BOOLEAN Wait)
 
BOOLEAN NTAPI RfsdNoOpAcquire (IN PVOID Fcb, IN BOOLEAN Wait)
 
VOID NTAPI RfsdNoOpRelease (IN PVOID Fcb)
 
VOID NTAPI RfsdReleaseFromReadAhead (IN PVOID Context)
 
PRFSD_FCB RfsdSearchFcbList (IN PRFSD_VCB Vcb, IN ULONG inode)
 
NTSTATUS RfsdScanDir (IN PRFSD_VCB Vcb, IN PRFSD_MCB ParentMcb, IN PUNICODE_STRING FileName, IN OUT PULONG Index, IN OUT PRFSD_DENTRY_HEAD rfsd_dir)
 
NTSTATUS RfsdLookupFileName (IN PRFSD_VCB Vcb, IN PUNICODE_STRING FullFileName, IN PRFSD_MCB ParentMcb, OUT PRFSD_MCB *RfsdMcb, IN OUT PRFSD_INODE Inode)
 
NTSTATUS RfsdCreateFile (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb)
 
NTSTATUS RfsdCreateVolume (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb)
 
NTSTATUS RfsdCreate (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdCreateInode (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB pParentFcb, IN ULONG Type, IN ULONG FileAttr, IN PUNICODE_STRING FileName)
 
NTSTATUS RfsdSupersedeOrOverWriteFile (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb, IN ULONG Disposition)
 
VOID __cdecl RfsdPrintf (LONG DebugPrintLevel, PCHAR DebugMessage,...)
 
VOID __cdecl RfsdNIPrintf (LONG DebugPrintLevel, PCHAR DebugMessage,...)
 
ULONG RfsdGetProcessNameOffset (VOID)
 
VOID RfsdDbgPrintCall (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
VOID RfsdDbgPrintComplete (IN PIRP Irp, IN BOOLEAN bPrint)
 
PUCHAR RfsdNtStatusToString (IN NTSTATUS Status)
 
NTSTATUS RfsdDeviceControlNormal (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdPrepareToUnload (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdDeviceControl (IN PRFSD_IRP_CONTEXT IrpContext)
 
ULONG RfsdGetInfoLength (IN FILE_INFORMATION_CLASS FileInformationClass)
 
ULONG RfsdProcessDirEntry (IN PRFSD_VCB Vcb, IN FILE_INFORMATION_CLASS FileInformationClass, IN __u32 Key_ParentID, IN __u32 Key_ObjectID, IN PVOID Buffer, IN ULONG UsedLength, IN ULONG Length, IN ULONG FileIndex, IN PUNICODE_STRING pName, IN BOOLEAN Single, IN PVOID pPreviousEntry)
 
NTSTATUS RfsdQueryDirectory (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdNotifyChangeDirectory (IN PRFSD_IRP_CONTEXT IrpContext)
 
VOID RfsdNotifyReportChange (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb, IN ULONG Filter, IN ULONG Action)
 
NTSTATUS RfsdDirectoryControl (IN PRFSD_IRP_CONTEXT IrpContext)
 
BOOLEAN RfsdIsDirectoryEmpty (IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb)
 
NTSTATUS RfsdQueueRequest (IN PRFSD_IRP_CONTEXT IrpContext)
 
VOID NTAPI RfsdDeQueueRequest (IN PVOID Context)
 
NTSTATUS RfsdDispatchRequest (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS NTAPI RfsdBuildRequest (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS RfsdExceptionFilter (IN PRFSD_IRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
 
NTSTATUS RfsdExceptionHandler (IN PRFSD_IRP_CONTEXT IrpContext)
 
PRFSD_SUPER_BLOCK RfsdLoadSuper (IN PRFSD_VCB Vcb, IN BOOLEAN bVerify)
 
BOOLEAN RfsdSaveSuper (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb)
 
BOOLEAN RfsdLoadGroup (IN PRFSD_VCB Vcb)
 
BOOLEAN RfsdSaveGroup (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG Group)
 
BOOLEAN RfsdGetInodeLba (IN PRFSD_VCB Vcb, IN __u32 DirectoryID, IN __u32 ParentID, OUT PLONGLONG offset)
 
BOOLEAN RfsdLoadInode (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY pKey, IN OUT PRFSD_INODE Inode)
 
BOOLEAN RfsdLoadInode2 (IN PRFSD_VCB Vcb, IN __u32 a, IN __u32 b, IN OUT PRFSD_INODE Inode)
 
BOOLEAN RfsdSaveInode (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG inode, IN PRFSD_INODE Inode)
 
BOOLEAN RfsdLoadBlock (IN PRFSD_VCB Vcb, IN ULONG dwBlk, IN PVOID Buffer)
 
BOOLEAN RfsdSaveBlock (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG dwBlk, IN PVOID Buf)
 
BOOLEAN RfsdSaveBuffer (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN LONGLONG Offset, IN ULONG Size, IN PVOID Buf)
 
NTSTATUS RfsdGetBlock (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG dwContent, IN ULONG Index, IN ULONG Layer, IN BOOLEAN bAlloc, OUT PULONG pBlock)
 
NTSTATUS RfsdBlockMap (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG InodeNo, IN PRFSD_INODE Inode, IN ULONG Index, IN BOOLEAN bAlloc, OUT PULONG pBlock)
 
NTSTATUS RfsdBuildBDL2 (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY pKey, IN PRFSD_INODE pInode, OUT PULONG out_Count, OUT PRFSD_BDL *out_ppBdl)
 
NTSTATUS RfsdBuildBDL (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY InodeNo, IN PRFSD_INODE Inode, IN ULONGLONG Offset, IN ULONG Size, IN BOOLEAN bAlloc, OUT PRFSD_BDL *Bdls, OUT PULONG Count)
 
NTSTATUS RfsdNewBlock (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG GroupHint, ULONG BlockHint, PULONG dwRet)
 
NTSTATUS RfsdFreeBlock (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Block)
 
NTSTATUS RfsdExpandBlock (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, ULONG dwContent, ULONG Index, ULONG layer, BOOLEAN bNew, ULONG *dwRet)
 
NTSTATUS RfsdExpandInode (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, ULONG *dwRet)
 
NTSTATUS RfsdNewInode (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG GroupHint, ULONG mode, PULONG Inode)
 
BOOLEAN RfsdFreeInode (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Inode, ULONG Type)
 
NTSTATUS RfsdAddEntry (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG FileType, IN ULONG Inode, IN PUNICODE_STRING FileName)
 
NTSTATUS RfsdRemoveEntry (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG FileType, IN ULONG Inode)
 
NTSTATUS RfsdSetParentEntry (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG OldParent, IN ULONG NewParent)
 
NTSTATUS RfsdTruncateBlock (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb, IN ULONG dwContent, IN ULONG Index, IN ULONG layer, OUT BOOLEAN *bFreed)
 
NTSTATUS RfsdTruncateInode (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb)
 
BOOLEAN RfsdAddMcbEntry (IN PRFSD_VCB Vcb, IN LONGLONG Lba, IN LONGLONG Length)
 
VOID RfsdRemoveMcbEntry (IN PRFSD_VCB Vcb, IN LONGLONG Lba, IN LONGLONG Length)
 
BOOLEAN RfsdLookupMcbEntry (IN PRFSD_VCB Vcb, IN LONGLONG Offset, OUT PLONGLONG Lba OPTIONAL, OUT PLONGLONG Length OPTIONAL, OUT PLONGLONG RunStart OPTIONAL, OUT PLONGLONG RunLength OPTIONAL, OUT PULONG Index OPTIONAL)
 
BOOLEAN SuperblockContainsMagicKey (PRFSD_SUPER_BLOCK sb)
 
__u32 ConvertKeyTypeUniqueness (__u32 k_uniqueness)
 
void FillInMemoryKey (IN PRFSD_KEY_ON_DISK pKeyOnDisk, IN RFSD_KEY_VERSION KeyVersion, IN OUT PRFSD_KEY_IN_MEMORY pKeyInMemory)
 
RFSD_KEY_VERSION DetermineOnDiskKeyFormat (const PRFSD_KEY_ON_DISK key)
 
RFSD_KEY_COMPARISON CompareShortKeys (IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
 
RFSD_KEY_COMPARISON CompareKeysWithoutOffset (IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
 
RFSD_KEY_COMPARISON CompareKeys (IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
 
NTSTATUS NavigateToLeafNode (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY Key, IN ULONG StartingBlockNumber, OUT PULONG out_NextBlockNumber)
 
NTSTATUS RfsdParseFilesystemTree (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY Key, IN ULONG StartingBlockNumber, IN RFSD_CALLBACK(fpDirectoryCallback), IN PVOID Context)
 
NTSTATUS _NavigateToLeafNode (IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY Key, IN ULONG StartingBlockNumber, OUT PULONG out_NextBlockNumber, IN BOOLEAN ReturnOnFirstMatch, IN RFSD_KEY_COMPARISON(*fpComparisonFunction)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY), RFSD_CALLBACK(fpDirectoryCallback), IN PVOID pContext)
 
BOOLEAN NTAPI RfsdFastIoCheckIfPossible (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN BOOLEAN CheckForReadOperation, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoRead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoWrite (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoQueryBasicInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_BASIC_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoQueryStandardInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_STANDARD_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoLock (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN BOOLEAN FailImmediately, IN BOOLEAN ExclusiveLock, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoUnlockSingle (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoUnlockAll (IN PFILE_OBJECT FileObject, IN PEPROCESS Process, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoUnlockAllByKey (IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI RfsdFastIoQueryNetworkOpenInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_NETWORK_OPEN_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
NTSTATUS RfsdQueryInformation (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdSetInformation (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdExpandFile (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, PLARGE_INTEGER AllocationSize)
 
NTSTATUS RfsdTruncateFile (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, PLARGE_INTEGER AllocationSize)
 
NTSTATUS RfsdSetDispositionInfo (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, BOOLEAN bDelete)
 
NTSTATUS RfsdSetRenameInfo (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb)
 
NTSTATUS RfsdDeleteFile (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb)
 
NTSTATUS RfsdFlushFiles (IN PRFSD_VCB Vcb, BOOLEAN bShutDown)
 
NTSTATUS RfsdFlushVolume (IN PRFSD_VCB Vcb, BOOLEAN bShutDown)
 
NTSTATUS RfsdFlushFile (IN PRFSD_FCB Fcb)
 
NTSTATUS RfsdFlush (IN PRFSD_IRP_CONTEXT IrpContext)
 
VOID RfsdSetVpbFlag (IN PVPB Vpb, IN USHORT Flag)
 
VOID RfsdClearVpbFlag (IN PVPB Vpb, IN USHORT Flag)
 
BOOLEAN RfsdCheckDismount (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN BOOLEAN bForce)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPurgeVolume (IN PRFSD_VCB Vcb, IN BOOLEAN FlushBeforePurge)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPurgeFile (IN PRFSD_FCB Fcb, IN BOOLEAN FlushBeforePurge)
 
BOOLEAN RfsdIsHandleCountZero (IN PRFSD_VCB Vcb)
 
NTSTATUS RfsdLockVcb (IN PRFSD_VCB Vcb, IN PFILE_OBJECT FileObject)
 
NTSTATUS RfsdLockVolume (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdUnlockVcb (IN PRFSD_VCB Vcb, IN PFILE_OBJECT FileObject)
 
NTSTATUS RfsdUnlockVolume (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdAllowExtendedDasdIo (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdUserFsRequest (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdMountVolume (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdVerifyVolume (IN PRFSD_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdIsVolumeMounted (IN PRFSD_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdDismountVolume (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdFileSystemControl (IN PRFSD_IRP_CONTEXT IrpContext)
 
BOOLEAN RfsdQueryParameters (IN PUNICODE_STRING RegistryPath)
 
VOID NTAPI DriverUnload (IN PDRIVER_OBJECT DriverObject)
 
NTSTATUS RfsdLockControl (IN PRFSD_IRP_CONTEXT IrpContext)
 
PRFSD_IRP_CONTEXT RfsdAllocateIrpContext (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
VOID RfsdFreeIrpContext (IN PRFSD_IRP_CONTEXT IrpContext)
 
PRFSD_FCB RfsdAllocateFcb (IN PRFSD_VCB Vcb, IN PRFSD_MCB RfsdMcb, IN PRFSD_INODE Inode)
 
VOID RfsdFreeFcb (IN PRFSD_FCB Fcb)
 
PRFSD_CCB RfsdAllocateCcb (VOID)
 
VOID RfsdFreeMcb (IN PRFSD_MCB Mcb)
 
PRFSD_FCB RfsdCreateFcbFromMcb (PRFSD_VCB Vcb, PRFSD_MCB Mcb)
 
VOID RfsdFreeCcb (IN PRFSD_CCB Ccb)
 
PRFSD_MCB RfsdAllocateMcb (PRFSD_VCB, PUNICODE_STRING FileName, ULONG FileAttr)
 
PRFSD_MCB RfsdSearchMcbTree (PRFSD_VCB Vcb, PRFSD_MCB RfsdMcb, PRFSD_KEY_IN_MEMORY Key)
 
PRFSD_MCB RfsdSearchMcb (PRFSD_VCB Vcb, PRFSD_MCB Parent, PUNICODE_STRING FileName)
 
BOOLEAN RfsdGetFullFileName (PRFSD_MCB Mcb, PUNICODE_STRING FileName)
 
VOID RfsdRefreshMcb (PRFSD_VCB Vcb, PRFSD_MCB Mcb)
 
VOID RfsdAddMcbNode (PRFSD_VCB Vcb, PRFSD_MCB Parent, PRFSD_MCB Child)
 
BOOLEAN RfsdDeleteMcbNode (PRFSD_VCB Vcb, PRFSD_MCB McbTree, PRFSD_MCB RfsdMcb)
 
VOID RfsdFreeMcbTree (PRFSD_MCB McbTree)
 
BOOLEAN RfsdCheckSetBlock (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Block)
 
BOOLEAN RfsdCheckBitmapConsistency (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb)
 
VOID RfsdInsertVcb (PRFSD_VCB Vcb)
 
VOID RfsdRemoveVcb (PRFSD_VCB Vcb)
 
NTSTATUS RfsdInitializeVcb (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_SUPER_BLOCK RfsdSb, PDEVICE_OBJECT TargetDevice, PDEVICE_OBJECT VolumeDevice, PVPB Vpb)
 
VOID RfsdFreeVcb (IN PRFSD_VCB Vcb)
 
VOID RfsdRepinBcb (IN PRFSD_IRP_CONTEXT IrpContext, IN PBCB Bcb)
 
VOID RfsdUnpinRepinnedBcbs (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdCompleteIrpContext (IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
 
VOID RfsdSyncUninitializeCacheMap (IN PFILE_OBJECT FileObject)
 
static USHORT RfsdStringLength (PUCHAR buffer, USHORT MaximumLength)
 
ULONG RfsdLog2 (ULONG Value)
 
LARGE_INTEGER RfsdSysTime (IN ULONG i_time)
 
ULONG RfsdInodeTime (IN LARGE_INTEGER SysTime)
 
ULONG RfsdOEMToUnicodeSize (IN PANSI_STRING Oem)
 
NTSTATUS RfsdOEMToUnicode (IN OUT PUNICODE_STRING Oem, IN POEM_STRING Unicode)
 
ULONG RfsdUnicodeToOEMSize (IN PUNICODE_STRING Unicode)
 
NTSTATUS RfsdUnicodeToOEM (IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
 
int RfsdLoadAllNls ()
 
VOID RfsdUnloadAllNls ()
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPnp (IN PRFSD_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPnpQueryRemove (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPnpRemove (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPnpCancelRemove (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb)
 
__drv_mustHoldCriticalRegion NTSTATUS RfsdPnpSurpriseRemove (PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb)
 
BOOLEAN RfsdCopyRead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
 
NTSTATUS RfsdReadInode (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY Key, IN PRFSD_INODE Inode, IN ULONGLONG Offset, IN PVOID Buffer, IN ULONG Size, OUT PULONG dwReturn)
 
NTSTATUS RfsdRead (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdShutDown (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdQueryVolumeInformation (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdSetVolumeInformation (IN PRFSD_IRP_CONTEXT IrpContext)
 
NTSTATUS RfsdWriteInode (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG InodeNo, IN PRFSD_INODE Inode, IN ULONGLONG Offset, IN PVOID Buffer, IN ULONG Size, IN BOOLEAN bWriteToDisk, OUT PULONG dwReturn)
 
VOID RfsdStartFloppyFlushDpc (PRFSD_VCB Vcb, PRFSD_FCB Fcb, PFILE_OBJECT FileObject)
 
BOOLEAN RfsdZeroHoles (IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PFILE_OBJECT FileObject, IN LONGLONG Offset, IN LONGLONG Count)
 
NTSTATUS RfsdWrite (IN PRFSD_IRP_CONTEXT IrpContext)
 

Variables

ULONG ProcessNameOffset
 

Macro Definition Documentation

◆ __SLINE__

#define __SLINE__   __STR1__(__LINE__)

Definition at line 137 of file rfsd.h.

◆ __STR1__

#define __STR1__ (   x)    __STR2__(x)

Definition at line 136 of file rfsd.h.

◆ __STR2__

#define __STR2__ (   x)    #x

Definition at line 135 of file rfsd.h.

◆ BLOCK_BITS

#define BLOCK_BITS   (SUPER_BLOCK->s_log_block_size + 10)

Definition at line 118 of file rfsd.h.

◆ BLOCK_SIZE

#define BLOCK_SIZE   (Vcb->BlockSize)

Definition at line 117 of file rfsd.h.

◆ BLOCKS_PER_GROUP

#define BLOCKS_PER_GROUP   (SUPER_BLOCK->s_blocks_per_group)

Definition at line 123 of file rfsd.h.

◆ CanRfsdWait

#define CanRfsdWait (   IRP)    IoIsOperationSynchronous(Irp)

Definition at line 849 of file rfsd.h.

◆ CCB_ALLOW_EXTENDED_DASD_IO

#define CCB_ALLOW_EXTENDED_DASD_IO   0x80000000

Definition at line 745 of file rfsd.h.

◆ CCB_FROM_POOL

#define CCB_FROM_POOL   0x00000001

Definition at line 743 of file rfsd.h.

◆ CEILING_ALIGNED

#define CEILING_ALIGNED (   A,
  B 
)    (((A) + (B) - 1) & (~((B) - 1)))

Definition at line 130 of file rfsd.h.

◆ CHECKING_BITMAP

#define CHECKING_BITMAP   L"CheckingBitmap"

Definition at line 150 of file rfsd.h.

◆ ClearFlag

#define ClearFlag (   x,
  f 
)    ((x) &= ~(f))

Definition at line 172 of file rfsd.h.

◆ CODEPAGE_MAXLEN

#define CODEPAGE_MAXLEN   0x20

Definition at line 374 of file rfsd.h.

◆ DBG_ERROR

#define DBG_ERROR   1

Definition at line 1053 of file rfsd.h.

◆ DBG_FUNC

#define DBG_FUNC   5

Definition at line 1057 of file rfsd.h.

◆ DBG_INFO

#define DBG_INFO   4

Definition at line 1056 of file rfsd.h.

◆ DBG_TRACE

#define DBG_TRACE   3

Definition at line 1055 of file rfsd.h.

◆ DBG_USER

#define DBG_USER   2

Definition at line 1054 of file rfsd.h.

◆ DBG_VITAL

#define DBG_VITAL   0

Definition at line 1052 of file rfsd.h.

◆ DbgBreak

#define DbgBreak ( )    DbgPrint("rfsd: breakpoint ignored.\n")

Definition at line 78 of file rfsd.h.

◆ DEFAULT_SECTOR_SIZE

#define DEFAULT_SECTOR_SIZE   (0x200)

Definition at line 111 of file rfsd.h.

◆ DEVICE_NAME

#define DEVICE_NAME   L"\\Rfsd"

Definition at line 143 of file rfsd.h.

◆ DRIVER_NAME

#define DRIVER_NAME   "Rfsd"

Definition at line 142 of file rfsd.h.

◆ EXT3_CODEPAGE

#define EXT3_CODEPAGE   L"CodePage"

Definition at line 152 of file rfsd.h.

◆ EXT3_FORCE_WRITING

#define EXT3_FORCE_WRITING   0x00000004

Definition at line 449 of file rfsd.h.

◆ EXT3_FORCEWRITING

#define EXT3_FORCEWRITING   L"Ext3ForceWriting"

Definition at line 151 of file rfsd.h.

◆ FCB_DELETE_ON_CLOSE

#define FCB_DELETE_ON_CLOSE   0x00000004

Definition at line 667 of file rfsd.h.

◆ FCB_DELETE_PENDING

#define FCB_DELETE_PENDING   0x00000008

Definition at line 668 of file rfsd.h.

◆ FCB_FILE_DELETED

#define FCB_FILE_DELETED   0x00000010

Definition at line 669 of file rfsd.h.

◆ FCB_FILE_MODIFIED

#define FCB_FILE_MODIFIED   0x00000020

Definition at line 670 of file rfsd.h.

◆ FCB_FROM_POOL

#define FCB_FROM_POOL   0x00000001

Definition at line 665 of file rfsd.h.

◆ FCB_PAGE_FILE

#define FCB_PAGE_FILE   0x00000002

Definition at line 666 of file rfsd.h.

◆ FILE_USE_FILE_POINTER_POSITION

#define FILE_USE_FILE_POINTER_POSITION   0xfffffffe

Definition at line 193 of file rfsd.h.

◆ FILE_WRITE_TO_END_OF_FILE

#define FILE_WRITE_TO_END_OF_FILE   0xffffffff

Definition at line 192 of file rfsd.h.

◆ I_CLEAR

#define I_CLEAR   32

Definition at line 306 of file rfsd.h.

◆ I_DIRTY

Definition at line 308 of file rfsd.h.

◆ I_DIRTY_DATASYNC

#define I_DIRTY_DATASYNC   2 /* Data-related inode changes pending */

Definition at line 302 of file rfsd.h.

◆ I_DIRTY_PAGES

#define I_DIRTY_PAGES   4 /* Data-related inode changes pending */

Definition at line 303 of file rfsd.h.

◆ I_DIRTY_SYNC

#define I_DIRTY_SYNC   1 /* Not dirty enough for O_DATASYNC */

Definition at line 301 of file rfsd.h.

◆ I_FREEING

#define I_FREEING   16

Definition at line 305 of file rfsd.h.

◆ I_LOCK

#define I_LOCK   8

Definition at line 304 of file rfsd.h.

◆ INODES_COUNT

#define INODES_COUNT   (Vcb->SuperBlock->s_inodes_count)

Definition at line 120 of file rfsd.h.

◆ INODES_PER_GROUP

#define INODES_PER_GROUP   (SUPER_BLOCK->s_inodes_per_group)

Definition at line 122 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_DEFERRED

#define IRP_CONTEXT_FLAG_DEFERRED   (0x00000040)

Definition at line 806 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_DELAY_CLOSE

#define IRP_CONTEXT_FLAG_DELAY_CLOSE   (0x00000800)

Definition at line 811 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_DISABLE_POPUPS

#define IRP_CONTEXT_FLAG_DISABLE_POPUPS   (0x00000020)

Definition at line 805 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_FLOPPY

#define IRP_CONTEXT_FLAG_FLOPPY   (0x00000008)

Definition at line 803 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_FROM_POOL

#define IRP_CONTEXT_FLAG_FROM_POOL   (0x00000001)

Definition at line 800 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_RECURSIVE_CALL

#define IRP_CONTEXT_FLAG_RECURSIVE_CALL   (0x00000010)

Definition at line 804 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_REQUEUED

#define IRP_CONTEXT_FLAG_REQUEUED   (0x00000200)

Definition at line 809 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_USER_IO

#define IRP_CONTEXT_FLAG_USER_IO   (0x00000400)

Definition at line 810 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_VERIFY_READ

#define IRP_CONTEXT_FLAG_VERIFY_READ   (0x00000080)

Definition at line 807 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_WAIT

#define IRP_CONTEXT_FLAG_WAIT   (0x00000002)

Definition at line 801 of file rfsd.h.

◆ IRP_CONTEXT_FLAG_WRITE_THROUGH

#define IRP_CONTEXT_FLAG_WRITE_THROUGH   (0x00000004)

Definition at line 802 of file rfsd.h.

◆ IRP_CONTEXT_STACK_IO_CONTEXT

#define IRP_CONTEXT_STACK_IO_CONTEXT   (0x00000100)

Definition at line 808 of file rfsd.h.

◆ IsDirectory

#define IsDirectory (   Fcb)    IsFlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)

Definition at line 198 of file rfsd.h.

◆ IsEndOfFile

#define IsEndOfFile (   Pos)
Value:
((Pos.LowPart == FILE_WRITE_TO_END_OF_FILE) && \
ush Pos
Definition: deflate.h:92
#define FILE_WRITE_TO_END_OF_FILE
Definition: rfsd.h:192
#define FILE_USE_FILE_POINTER_POSITION
Definition: rfsd.h:193

Definition at line 195 of file rfsd.h.

◆ IsFlagOn

#define IsFlagOn (   a,
  b 
)    ((BOOLEAN)(FlagOn(a,b) == b))

Definition at line 175 of file rfsd.h.

◆ IsMcbUsed

#define IsMcbUsed (   Mcb)    IsFlagOn(Mcb->Flags, MCB_IN_USE)

Definition at line 716 of file rfsd.h.

◆ IsMounted

#define IsMounted (   Vcb)    (IsFlagOn(Vcb->Flags, VCB_MOUNTED))

Definition at line 595 of file rfsd.h.

◆ max

#define max (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 852 of file rfsd.h.

◆ MAXIMUM_RECORD_LENGTH

#define MAXIMUM_RECORD_LENGTH   (0x10000)

Definition at line 107 of file rfsd.h.

◆ MCB_FROM_POOL

#define MCB_FROM_POOL   0x00000001

Definition at line 712 of file rfsd.h.

◆ MCB_IN_TREE

#define MCB_IN_TREE   0x00000002

Definition at line 713 of file rfsd.h.

◆ MCB_IN_USE

#define MCB_IN_USE   0x00000004

Definition at line 714 of file rfsd.h.

◆ min

#define min (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 856 of file rfsd.h.

◆ NodeType

#define NodeType (   Ptr)    (*((RFSD_IDENTIFIER_TYPE *)(Ptr)))

Definition at line 341 of file rfsd.h.

◆ PAGE_TABLE

Definition at line 442 of file rfsd.h.

◆ PARAMETERS_KEY

#define PARAMETERS_KEY   L"\\Parameters"

Definition at line 147 of file rfsd.h.

◆ READ_AHEAD_GRANULARITY

#define READ_AHEAD_GRANULARITY   (0x10000)

Definition at line 113 of file rfsd.h.

◆ RFSD_BLOCK_TYPES

#define RFSD_BLOCK_TYPES   (0x04)

Definition at line 105 of file rfsd.h.

◆ RFSD_BUGCHK_BLOCK

#define RFSD_BUGCHK_BLOCK   (0x00010000)

Definition at line 206 of file rfsd.h.

◆ RFSD_BUGCHK_CLEANUP

#define RFSD_BUGCHK_CLEANUP   (0x00020000)

Definition at line 207 of file rfsd.h.

◆ RFSD_BUGCHK_CLOSE

#define RFSD_BUGCHK_CLOSE   (0x00030000)

Definition at line 208 of file rfsd.h.

◆ RFSD_BUGCHK_CMCB

#define RFSD_BUGCHK_CMCB   (0x00040000)

Definition at line 209 of file rfsd.h.

◆ RFSD_BUGCHK_CREATE

#define RFSD_BUGCHK_CREATE   (0x00050000)

Definition at line 210 of file rfsd.h.

◆ RFSD_BUGCHK_DEBUG

#define RFSD_BUGCHK_DEBUG   (0x00060000)

Definition at line 211 of file rfsd.h.

◆ RFSD_BUGCHK_DEVCTL

#define RFSD_BUGCHK_DEVCTL   (0x00070000)

Definition at line 212 of file rfsd.h.

◆ RFSD_BUGCHK_DIRCTL

#define RFSD_BUGCHK_DIRCTL   (0x00080000)

Definition at line 213 of file rfsd.h.

◆ RFSD_BUGCHK_DISPATCH

#define RFSD_BUGCHK_DISPATCH   (0x00090000)

Definition at line 214 of file rfsd.h.

◆ RFSD_BUGCHK_EXCEPT

#define RFSD_BUGCHK_EXCEPT   (0x000A0000)

Definition at line 215 of file rfsd.h.

◆ RFSD_BUGCHK_FASTIO

#define RFSD_BUGCHK_FASTIO   (0x000C0000)

Definition at line 217 of file rfsd.h.

◆ RFSD_BUGCHK_FILEINFO

#define RFSD_BUGCHK_FILEINFO   (0x000D0000)

Definition at line 218 of file rfsd.h.

◆ RFSD_BUGCHK_FLUSH

#define RFSD_BUGCHK_FLUSH   (0x000E0000)

Definition at line 219 of file rfsd.h.

◆ RFSD_BUGCHK_FSCTL

#define RFSD_BUGCHK_FSCTL   (0x000F0000)

Definition at line 220 of file rfsd.h.

◆ RFSD_BUGCHK_INIT

#define RFSD_BUGCHK_INIT   (0x00100000)

Definition at line 221 of file rfsd.h.

◆ RFSD_BUGCHK_LAST

#define RFSD_BUGCHK_LAST   (0x00170000)

Definition at line 230 of file rfsd.h.

◆ RFSD_BUGCHK_LOCK

#define RFSD_BUGCHK_LOCK   (0x0011000)

Definition at line 222 of file rfsd.h.

◆ RFSD_BUGCHK_MEMORY

#define RFSD_BUGCHK_MEMORY   (0x0012000)

Definition at line 223 of file rfsd.h.

◆ RFSD_BUGCHK_MISC

#define RFSD_BUGCHK_MISC   (0x0013000)

Definition at line 224 of file rfsd.h.

◆ RFSD_BUGCHK_READ

#define RFSD_BUGCHK_READ   (0x00140000)

Definition at line 225 of file rfsd.h.

◆ RFSD_BUGCHK_RFSD

#define RFSD_BUGCHK_RFSD   (0x000B0000)

Definition at line 216 of file rfsd.h.

◆ RFSD_BUGCHK_SHUTDOWN

#define RFSD_BUGCHK_SHUTDOWN   (0x00150000)

Definition at line 226 of file rfsd.h.

◆ RFSD_BUGCHK_VOLINFO

#define RFSD_BUGCHK_VOLINFO   (0x00160000)

Definition at line 227 of file rfsd.h.

◆ RFSD_BUGCHK_WRITE

#define RFSD_BUGCHK_WRITE   (0x00170000)

Definition at line 228 of file rfsd.h.

◆ RFSD_CALLBACK

#define RFSD_CALLBACK (   name)    NTSTATUS(* name )(ULONG BlockNumber, PVOID pContext)

Definition at line 35 of file rfsd.h.

◆ RFSD_CHECKING_BITMAP

#define RFSD_CHECKING_BITMAP   0x00000008

Definition at line 450 of file rfsd.h.

◆ RFSD_FILE_SYSTEM

#define RFSD_FILE_SYSTEM   (FILE_SYSTEM)

Definition at line 204 of file rfsd.h.

◆ RFSD_FIRST_DATA_BLOCK

#define RFSD_FIRST_DATA_BLOCK   (SUPER_BLOCK->s_first_data_block)

Definition at line 126 of file rfsd.h.

◆ RFSD_IS_PTR_TO_ROOT_KEY

#define RFSD_IS_PTR_TO_ROOT_KEY (   x)    (x->k_dir_id == RFSD_ROOT_PARENT_ID && x->k_objectid == RFSD_ROOT_OBJECT_ID)

Definition at line 53 of file rfsd.h.

◆ RFSD_IS_ROOT_KEY

#define RFSD_IS_ROOT_KEY (   x)    (x.k_dir_id == RFSD_ROOT_PARENT_ID && x.k_objectid == RFSD_ROOT_OBJECT_ID)

Definition at line 52 of file rfsd.h.

◆ RFSD_KEY_LARGER

#define RFSD_KEY_LARGER   1

Definition at line 65 of file rfsd.h.

◆ RFSD_KEY_SMALLER

#define RFSD_KEY_SMALLER   -1

Definition at line 64 of file rfsd.h.

◆ RFSD_KEY_VERSION_1

#define RFSD_KEY_VERSION_1   0

Definition at line 58 of file rfsd.h.

◆ RFSD_KEY_VERSION_2

#define RFSD_KEY_VERSION_2   1

Definition at line 59 of file rfsd.h.

◆ RFSD_KEY_VERSION_UNKNOWN

#define RFSD_KEY_VERSION_UNKNOWN   7

Definition at line 60 of file rfsd.h.

◆ RFSD_KEYS_MATCH

#define RFSD_KEYS_MATCH   0

Definition at line 63 of file rfsd.h.

◆ RFSD_LEAF_BLOCK_LEVEL

#define RFSD_LEAF_BLOCK_LEVEL   1

Definition at line 68 of file rfsd.h.

◆ RFSD_MIN_BLOCK

#define RFSD_MIN_BLOCK   1024

Definition at line 237 of file rfsd.h.

◆ RFSD_MIN_FRAG

#define RFSD_MIN_FRAG   1024

Definition at line 238 of file rfsd.h.

◆ RFSD_NAME_LEN

#define RFSD_NAME_LEN   255

Definition at line 45 of file rfsd.h.

◆ RFSD_POOL_TAG

#define RFSD_POOL_TAG   'dsfR'

Definition at line 99 of file rfsd.h.

◆ RFSD_READ_ONLY

#define RFSD_READ_ONLY   TRUE

Definition at line 91 of file rfsd.h.

◆ RFSD_REPINNED_BCBS_ARRAY_SIZE

#define RFSD_REPINNED_BCBS_ARRAY_SIZE   (8)

Definition at line 352 of file rfsd.h.

◆ RFSD_ROOT_OBJECT_ID

#define RFSD_ROOT_OBJECT_ID   2

Definition at line 51 of file rfsd.h.

◆ RFSD_ROOT_PARENT_ID

#define RFSD_ROOT_PARENT_ID   1

Definition at line 50 of file rfsd.h.

◆ RFSD_SUPPORT_WRITING

#define RFSD_SUPPORT_WRITING   0x00000002

Definition at line 448 of file rfsd.h.

◆ RFSD_UNLOAD

#define RFSD_UNLOAD   TRUE

Definition at line 95 of file rfsd.h.

◆ RFSD_UNLOAD_PENDING

#define RFSD_UNLOAD_PENDING   0x00000001

Definition at line 447 of file rfsd.h.

◆ RFSD_VERSION

#define RFSD_VERSION   "0.26"

Definition at line 83 of file rfsd.h.

◆ RfsdBugCheck

#define RfsdBugCheck (   A,
  B,
  C,
  D 
)    { KeBugCheckEx(RFSD_FILE_SYSTEM, A | __LINE__, B, C, D ); }

Definition at line 232 of file rfsd.h.

◆ RfsdCompleteRequest

#define RfsdCompleteRequest (   Irp,
  bPrint,
  PriorityBoost 
)    IoCompleteRequest(Irp, PriorityBoost)

Definition at line 1072 of file rfsd.h.

◆ RfsdGetCurrentProcessName

#define RfsdGetCurrentProcessName ( )
Value:
( \
)
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG ProcessNameOffset
#define PsGetCurrentProcess
Definition: psfuncs.h:17

Definition at line 1095 of file rfsd.h.

◆ RfsdIsReadOnly

#define RfsdIsReadOnly (   m)    (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))

Definition at line 295 of file rfsd.h.

◆ RfsdNormalizeAndRaiseStatus

#define RfsdNormalizeAndRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
/* (IRPCONTEXT)->ExceptionStatus = (STATUS); */ \
}
#define ExRaiseStatus
Definition: ntoskrnl.h:95
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
#define STATUS
Definition: blue.h:128
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:455
NTSTATUS NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus)
Definition: filter.c:90

Definition at line 182 of file rfsd.h.

◆ RfsdPrint

#define RfsdPrint (   arg)

Definition at line 1069 of file rfsd.h.

◆ RfsdPrintNoIndent

#define RfsdPrintNoIndent (   arg)

Definition at line 1070 of file rfsd.h.

◆ RfsdRaiseStatus

#define RfsdRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
(IRPCONTEXT)->ExceptionCode = (STATUS); \
ExRaiseStatus( (STATUS) ); \
}
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1782
#define STATUS
Definition: blue.h:128

Definition at line 177 of file rfsd.h.

◆ RfsdSetReadable

#define RfsdSetReadable (   m)    (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))

Definition at line 291 of file rfsd.h.

◆ RfsdSetReadOnly

#define RfsdSetReadOnly (   m)    (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))

Definition at line 294 of file rfsd.h.

◆ RfsdSetWritable

#define RfsdSetWritable (   m)    (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))

Definition at line 292 of file rfsd.h.

◆ S_IALLUGO

#define S_IALLUGO   (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)

Definition at line 283 of file rfsd.h.

◆ S_IFBLK

#define S_IFBLK   0x06000 /* 006 0000 */

Definition at line 248 of file rfsd.h.

◆ S_IFCHR

#define S_IFCHR   0x02000 /* 002 0000 */

Definition at line 250 of file rfsd.h.

◆ S_IFDIR

#define S_IFDIR   0x04000 /* 004 0000 */

Definition at line 249 of file rfsd.h.

◆ S_IFIFO

#define S_IFIFO   0x01000 /* 001 0000 */

Definition at line 251 of file rfsd.h.

◆ S_IFLNK

#define S_IFLNK   0x0A000 /* 012 0000 */

Definition at line 246 of file rfsd.h.

◆ S_IFMT

#define S_IFMT   0x0F000 /* 017 0000 */

Definition at line 244 of file rfsd.h.

◆ S_IFREG

#define S_IFREG   0x08000 /* 010 0000 */

Definition at line 247 of file rfsd.h.

◆ S_IFSOCK

#define S_IFSOCK   0x0C000 /* 014 0000 */

Definition at line 245 of file rfsd.h.

◆ S_IPERMISSION_MASK

#define S_IPERMISSION_MASK   0x1FF /* */

Definition at line 265 of file rfsd.h.

◆ S_IRGRP

#define S_IRGRP   0x020 /* 0 0040 */

Definition at line 273 of file rfsd.h.

◆ S_IROTH

#define S_IROTH   0x004 /* 0 0004 */

Definition at line 278 of file rfsd.h.

◆ S_IRUGO

#define S_IRUGO   (S_IRUSR|S_IRGRP|S_IROTH)

Definition at line 284 of file rfsd.h.

◆ S_IRUSR

#define S_IRUSR   0x100 /* 0 0400 */

Definition at line 268 of file rfsd.h.

◆ S_IRWXG

#define S_IRWXG   0x038 /* 0 0070 */

Definition at line 272 of file rfsd.h.

◆ S_IRWXO

#define S_IRWXO   0x007 /* 0 0007 */

Definition at line 277 of file rfsd.h.

◆ S_IRWXU

#define S_IRWXU   0x1C0 /* 0 0700 */

Definition at line 267 of file rfsd.h.

◆ S_IRWXUGO

#define S_IRWXUGO   (S_IRWXU|S_IRWXG|S_IRWXO)

Definition at line 282 of file rfsd.h.

◆ S_ISBLK

#define S_ISBLK (   m)    (((m) & S_IFMT) == S_IFBLK)

Definition at line 260 of file rfsd.h.

◆ S_ISCHR

#define S_ISCHR (   m)    (((m) & S_IFMT) == S_IFCHR)

Definition at line 262 of file rfsd.h.

◆ S_ISDIR

#define S_ISDIR (   m)    (((m) & S_IFMT) == S_IFDIR)

Definition at line 261 of file rfsd.h.

◆ S_ISFIFO

#define S_ISFIFO (   m)    (((m) & S_IFMT) == S_IFIFO)

Definition at line 263 of file rfsd.h.

◆ S_ISFIL

#define S_ISFIL (   m)    (((m) & S_IFMT) == S_IFFIL)

Definition at line 259 of file rfsd.h.

◆ S_ISGID

#define S_ISGID   0x00400 /* 000 2000 */

Definition at line 253 of file rfsd.h.

◆ S_ISLNK

#define S_ISLNK (   m)    (((m) & S_IFMT) == S_IFLNK)

Definition at line 258 of file rfsd.h.

◆ S_ISREADABLE

#define S_ISREADABLE (   m)    (((m) & S_IPERMISSION_MASK) == (S_IRUSR | S_IRGRP | S_IROTH))

Definition at line 288 of file rfsd.h.

◆ S_ISREG

#define S_ISREG (   m)    (((m) & S_IFMT) == S_IFREG)

Definition at line 256 of file rfsd.h.

◆ S_ISSOCK

#define S_ISSOCK (   m)    (((m) & S_IFMT) == S_IFSOCK)

Definition at line 257 of file rfsd.h.

◆ S_ISUID

#define S_ISUID   0x00800 /* 000 4000 */

Definition at line 252 of file rfsd.h.

◆ S_ISVTX

#define S_ISVTX   0x00200 /* 000 1000 */

Definition at line 254 of file rfsd.h.

◆ S_ISWRITABLE

#define S_ISWRITABLE (   m)    (((m) & S_IPERMISSION_MASK) == (S_IWUSR | S_IWGRP | S_IWOTH))

Definition at line 289 of file rfsd.h.

◆ S_IWGRP

#define S_IWGRP   0x010 /* 0 0020 */

Definition at line 274 of file rfsd.h.

◆ S_IWOTH

#define S_IWOTH   0x002 /* 0 0002 */

Definition at line 279 of file rfsd.h.

◆ S_IWUGO

#define S_IWUGO   (S_IWUSR|S_IWGRP|S_IWOTH)

Definition at line 285 of file rfsd.h.

◆ S_IWUSR

#define S_IWUSR   0x080 /* 0 0200 */

Definition at line 269 of file rfsd.h.

◆ S_IXGRP

#define S_IXGRP   0x008 /* 0 0010 */

Definition at line 275 of file rfsd.h.

◆ S_IXOTH

#define S_IXOTH   0x001 /* 0 0001 */

Definition at line 280 of file rfsd.h.

◆ S_IXUGO

#define S_IXUGO   (S_IXUSR|S_IXGRP|S_IXOTH)

Definition at line 286 of file rfsd.h.

◆ S_IXUSR

#define S_IXUSR   0x040 /* 0 0100 */

Definition at line 270 of file rfsd.h.

◆ SECTOR_BITS

#define SECTOR_BITS   (Vcb->SectorBits)

Definition at line 109 of file rfsd.h.

◆ SECTOR_SIZE

#define SECTOR_SIZE   (Vcb->DiskGeometry.BytesPerSector)

Definition at line 110 of file rfsd.h.

◆ SetFlag

#define SetFlag (   x,
  f 
)    ((x) |= (f))

Definition at line 168 of file rfsd.h.

◆ SUPER_BLOCK

#define SUPER_BLOCK   (Vcb->SuperBlock)

Definition at line 115 of file rfsd.h.

◆ SUPER_BLOCK_OFFSET

#define SUPER_BLOCK_OFFSET   REISERFS_DISK_OFFSET_IN_BYTES

Definition at line 47 of file rfsd.h.

◆ SUPER_BLOCK_SIZE

#define SUPER_BLOCK_SIZE   sizeof(RFSD_SUPER_BLOCK)

Definition at line 48 of file rfsd.h.

◆ TOTAL_BLOCKS

#define TOTAL_BLOCKS   (SUPER_BLOCK->s_blocks_count)

Definition at line 124 of file rfsd.h.

◆ VCB_DISMOUNT_PENDING

#define VCB_DISMOUNT_PENDING   0x00000008

Definition at line 586 of file rfsd.h.

◆ VCB_FLOPPY_DISK

#define VCB_FLOPPY_DISK   0x20000000

Definition at line 590 of file rfsd.h.

◆ VCB_INITIALIZED

#define VCB_INITIALIZED   0x00000001

Definition at line 583 of file rfsd.h.

◆ VCB_MOUNTED

#define VCB_MOUNTED   0x00000004

Definition at line 585 of file rfsd.h.

◆ VCB_READ_ONLY

#define VCB_READ_ONLY   0x00000010

Definition at line 587 of file rfsd.h.

◆ VCB_REMOVABLE_MEDIA

#define VCB_REMOVABLE_MEDIA   0x80000000

Definition at line 592 of file rfsd.h.

◆ VCB_REMOVAL_PREVENTED

#define VCB_REMOVAL_PREVENTED   0x40000000

Definition at line 591 of file rfsd.h.

◆ VCB_VOLUME_LOCKED

#define VCB_VOLUME_LOCKED   0x00000002

Definition at line 584 of file rfsd.h.

◆ VCB_WRITE_PROTECTED

#define VCB_WRITE_PROTECTED   0x10000000

Definition at line 589 of file rfsd.h.

◆ WRITING_SUPPORT

#define WRITING_SUPPORT   L"WritingSupport"

Definition at line 149 of file rfsd.h.

Typedef Documentation

◆ FCB_LIST_ENTRY

◆ PBCB

typedef PVOID PBCB

Definition at line 346 of file rfsd.h.

◆ PFCB_LIST_ENTRY

◆ PRFSD_ALLOC_HEADER

◆ PRFSD_BDL

◆ PRFSD_BLOCK_HEAD

Definition at line 38 of file rfsd.h.

◆ PRFSD_CCB

◆ PRFSD_DENTRY_HEAD

Definition at line 39 of file rfsd.h.

◆ PRFSD_DISK_NODE_REF

Definition at line 43 of file rfsd.h.

◆ PRFSD_FCB

◆ PRFSD_FCBVCB

◆ PRFSD_GLOBAL

◆ PRFSD_IDENTIFIER

◆ PRFSD_INODE

Definition at line 33 of file rfsd.h.

◆ PRFSD_IRP_CONTEXT

◆ PRFSD_ITEM_HEAD

Definition at line 40 of file rfsd.h.

◆ PRFSD_KEY_IN_MEMORY

Definition at line 42 of file rfsd.h.

◆ PRFSD_KEY_ON_DISK

Definition at line 41 of file rfsd.h.

◆ PRFSD_MCB

Definition at line 343 of file rfsd.h.

◆ PRFSD_REPINNED_BCBS

◆ PRFSD_SUPER_BLOCK

Definition at line 32 of file rfsd.h.

◆ PRFSD_VCB

◆ PRFSDFS_EXT

◆ RFSD_ALLOC_HEADER

◆ RFSD_BDL

◆ RFSD_BLOCK_HEAD

Definition at line 38 of file rfsd.h.

◆ RFSD_CCB

◆ RFSD_DENTRY_HEAD

Definition at line 39 of file rfsd.h.

◆ RFSD_DISK_NODE_REF

Definition at line 43 of file rfsd.h.

◆ RFSD_FCB

◆ RFSD_FCBVCB

◆ RFSD_GLOBAL

◆ RFSD_IDENTIFIER

◆ RFSD_IDENTIFIER_TYPE

◆ RFSD_INODE

Definition at line 33 of file rfsd.h.

◆ RFSD_IRP_CONTEXT

◆ RFSD_ITEM_HEAD

Definition at line 40 of file rfsd.h.

◆ RFSD_KEY_COMPARISON

Definition at line 55 of file rfsd.h.

◆ RFSD_KEY_IN_MEMORY

Definition at line 42 of file rfsd.h.

◆ RFSD_KEY_ON_DISK

Definition at line 41 of file rfsd.h.

◆ RFSD_KEY_VERSION

Definition at line 56 of file rfsd.h.

◆ RFSD_MCB

Definition at line 343 of file rfsd.h.

◆ RFSD_REPINNED_BCBS

◆ RFSD_SUPER_BLOCK

Definition at line 32 of file rfsd.h.

◆ RFSD_VCB

Enumeration Type Documentation

◆ _RFSD_IDENTIFIER_TYPE

Enumerator
RFSDFGD 
RFSDVCB 
RFSDFCB 
RFSDCCB 
RFSDICX 
RFSDMCB 

Definition at line 321 of file rfsd.h.

321  {
322  RFSDFGD = ':DGF',
323  RFSDVCB = ':BCV',
324  RFSDFCB = ':BCF',
325  RFSDCCB = ':BCC',
326  RFSDICX = ':XCI',
327  RFSDMCB = ':BCM'
enum _RFSD_IDENTIFIER_TYPE RFSD_IDENTIFIER_TYPE
Definition: rfsd.h:327
Definition: rfsd.h:323
Definition: rfsd.h:324
Definition: rfsd.h:326
Definition: rfsd.h:322
Definition: rfsd.h:325

Function Documentation

◆ _NavigateToLeafNode()

NTSTATUS _NavigateToLeafNode ( IN PRFSD_VCB  Vcb,
IN PRFSD_KEY_IN_MEMORY  Key,
IN ULONG  StartingBlockNumber,
OUT PULONG  out_NextBlockNumber,
IN BOOLEAN  ReturnOnFirstMatch,
IN RFSD_KEY_COMPARISON(*)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY fpComparisonFunction,
RFSD_CALLBACK(fpDirectoryCallback)  ,
IN PVOID  pContext 
)

Returns the block number of the leaf node that should contain key (if that key exists at all within the disk tree).

STATUS_INVALID_HANDLE if a block or block header could not be read STATUS_INSUFFICIENT_RESOURCES if processing was terminated due to a failure of memory allocation STATUS_SUCCESS on success NOTE: the return value can also be anything defined by the invoked callback

Definition at line 2934 of file rfsd.c.

2946 {
2948  ULONG leafNodeBlockNumber; // The result to be calculated
2949  PRFSD_DISK_NODE_REF pTargetDiskNodeReference = NULL; //
2950 
2951  // Read in this disk node's data
2952  PUCHAR pBlockBuffer = RfsdAllocateAndLoadBlock(Vcb, StartingBlockNumber);
2953 
2954  // Read the block header
2955  PRFSD_BLOCK_HEAD pBlockHeader = (PRFSD_BLOCK_HEAD) pBlockBuffer;
2956 
2957  PAGED_CODE();
2958 
2959  // Sanity check that we could read the block and the header is there
2960  if (!pBlockBuffer) { return STATUS_INVALID_HANDLE; }
2961 
2962  // If this block is a leaf, just return it (or invoke the given callback on the leaf block)
2963  if (pBlockHeader->blk_level == RFSD_LEAF_BLOCK_LEVEL)
2964  {
2966 
2967  ExFreePool(pBlockBuffer);
2968 
2969  *out_NextBlockNumber = StartingBlockNumber;
2970 
2971  // If a callback should be invoked on finding a matching leaf node, do so...
2972  if (fpDirectoryCallback) return (*fpDirectoryCallback)(StartingBlockNumber, pContext);
2973  else return STATUS_SUCCESS;
2974  }
2975 
2976  // Otherwise, find the next node down in the tree, by obtaining pTargetDiskNodeReference
2977  {
2978  ULONG idxRightKey = 0;
2979  PRFSD_KEY_ON_DISK pLeftKeyOnDisk = NULL;
2980  PRFSD_KEY_ON_DISK pRightKeyOnDisk = NULL;
2981 
2982  RFSD_KEY_IN_MEMORY LeftKeyInMemory, RightKeyInMemory;
2983  RFSD_KEY_COMPARISON leftComparison, rightComparison;
2984 
2985  RightKeyInMemory.k_dir_id = 0; // (Dummy statement to prevent needless warning aboujt using RightKeyInMemory before being initialized)
2986 
2987  // Search (within the increasing list of target Keys), for the target key that Key is <= to.
2988  for (idxRightKey = 0; idxRightKey <= pBlockHeader->blk_nr_item; idxRightKey++)
2989  {
2990  // Advance the left key to become what was the right key, and the right key to become the next key
2991  pLeftKeyOnDisk = pRightKeyOnDisk;
2992  pRightKeyOnDisk = (idxRightKey == pBlockHeader->blk_nr_item) ?
2994  (PRFSD_KEY_ON_DISK) (pBlockBuffer + sizeof(RFSD_BLOCK_HEAD) + (idxRightKey * sizeof(RFSD_KEY_ON_DISK)));
2995 
2996  LeftKeyInMemory = RightKeyInMemory;
2997  if (pRightKeyOnDisk)
2998  FillInMemoryKey(pRightKeyOnDisk, RFSD_KEY_VERSION_UNKNOWN, &(RightKeyInMemory));
2999 
3000 
3001  // Find if the target key falls in the range in between the left and right keys...
3002  {
3003  // We must be smaller than the right key (if it exists). However, we will allow the key to match if short key comparisons are in use.
3004  rightComparison = pRightKeyOnDisk ? ((*fpComparisonFunction)(Key, &RightKeyInMemory)) : RFSD_KEY_SMALLER;
3005  if (fpComparisonFunction == &CompareShortKeys)
3006  { if (rightComparison == RFSD_KEY_LARGER) continue; }
3007  else
3008  { if (rightComparison != RFSD_KEY_SMALLER) continue; }
3009 
3010  // And larger than or equal to the left key.
3011  leftComparison = pLeftKeyOnDisk ? ((*fpComparisonFunction)(Key, &LeftKeyInMemory)) : RFSD_KEY_LARGER;
3012  if ( (leftComparison == RFSD_KEY_LARGER) || (leftComparison == RFSD_KEYS_MATCH) )
3013  {
3014  // The target range has been found. Read the reference to the disk node child, lower in the tree.
3015  // This returns the pointer preceding the righthand key.
3016  pTargetDiskNodeReference = (PRFSD_DISK_NODE_REF) (pBlockBuffer
3017  + sizeof(RFSD_BLOCK_HEAD) + (pBlockHeader->blk_nr_item * sizeof(RFSD_KEY_ON_DISK)) + (idxRightKey * sizeof(RFSD_DISK_NODE_REF)));
3018 
3019  // Continue recursion downwards; eventually a leaf node will be returned.
3021  Vcb, Key, pTargetDiskNodeReference->dc_block_number,
3022  &(leafNodeBlockNumber),
3023  ReturnOnFirstMatch, fpComparisonFunction, fpDirectoryCallback, pContext); // <
3024 
3025  if (ReturnOnFirstMatch || Status == STATUS_EVENT_DONE || // Success cases
3027  { goto return_results; }
3028  }
3029  }
3030  }
3031  }
3032 
3033 return_results:
3034 
3035  ExFreePool(pBlockBuffer);
3036  *out_NextBlockNumber = leafNodeBlockNumber;
3037  return Status;
3038 }
struct reiserfs_key RFSD_KEY_ON_DISK
Definition: rfsd.h:41
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG Key
Definition: fatprocs.h:2697
struct disk_child RFSD_DISK_NODE_REF
Definition: rfsd.h:43
#define STATUS_EVENT_DONE
Definition: ntstatus.h:132
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
PUCHAR RfsdAllocateAndLoadBlock(IN PRFSD_VCB Vcb, IN ULONG BlockIndex)
Definition: rfsdblock.c:34
__u16 blk_level
Definition: reiserfs_fs.h:679
struct reiserfs_key * PRFSD_KEY_ON_DISK
Definition: rfsd.h:41
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define PAGED_CODE()
Definition: video.h:57
RFSD_KEY_COMPARISON CompareShortKeys(IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
Definition: rfsd.c:2811
__u16 blk_nr_item
Definition: reiserfs_fs.h:680
smooth NULL
Definition: ftsmooth.c:416
struct disk_child * PRFSD_DISK_NODE_REF
Definition: rfsd.h:43
#define RFSD_KEY_SMALLER
Definition: rfsd.h:64
NTSTATUS _NavigateToLeafNode(IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY Key, IN ULONG StartingBlockNumber, OUT PULONG out_NextBlockNumber, IN BOOLEAN ReturnOnFirstMatch, IN RFSD_KEY_COMPARISON(*fpComparisonFunction)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY), RFSD_CALLBACK(fpDirectoryCallback), IN PVOID pContext)
Definition: rfsd.c:2934
#define RFSD_KEYS_MATCH
Definition: rfsd.h:63
#define Vcb
Definition: cdprocs.h:1425
#define RFSD_KEY_LARGER
Definition: rfsd.h:65
_In_ FLT_PREOP_CALLBACK_STATUS CallbackStatus
Definition: fltkernel.h:1020
void FillInMemoryKey(IN PRFSD_KEY_ON_DISK pKeyOnDisk, IN RFSD_KEY_VERSION KeyVersion, IN OUT PRFSD_KEY_IN_MEMORY pKeyInMemory)
Definition: rfsd.c:2777
#define RFSD_KEY_VERSION_UNKNOWN
Definition: rfsd.h:60
#define RFSD_LEAF_BLOCK_LEVEL
Definition: rfsd.h:68
Status
Definition: gdiplustypes.h:24
short RFSD_KEY_COMPARISON
Definition: rfsd.h:55
struct block_head * PRFSD_BLOCK_HEAD
Definition: rfsd.h:38
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
__u32 dc_block_number
Definition: reiserfs_fs.h:1114
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NavigateToLeafNode(), and RfsdParseFilesystemTree().

◆ CompareKeys()

Compares two in memory keys, returning KEY_SMALLER, KEY_LARGER, or KEYS_MATCH relative to the first key given.

Definition at line 2856 of file rfsd.c.

2859 {
2860  PAGED_CODE();
2861 
2862  // compare 1. integer
2863  if( a->k_dir_id < b->k_dir_id ) return RFSD_KEY_SMALLER;
2864  if( a->k_dir_id > b->k_dir_id ) return RFSD_KEY_LARGER;
2865 
2866  // compare 2. integer
2867  if( a->k_objectid < b->k_objectid ) return RFSD_KEY_SMALLER;
2868  if( a->k_objectid > b->k_objectid ) return RFSD_KEY_LARGER;
2869 
2870  // compare 3. integer
2871  if( a->k_offset < b->k_offset ) return RFSD_KEY_SMALLER;
2872  if( a->k_offset > b->k_offset ) return RFSD_KEY_LARGER;
2873 
2874  // compare 4. integer
2875  // NOTE: Buchholz says that if we get to here in navigating the file tree, something has gone wrong...
2876  if( a->k_type < b->k_type ) return RFSD_KEY_SMALLER;
2877  if( a->k_type > b->k_type ) return RFSD_KEY_LARGER;
2878 
2879  return RFSD_KEYS_MATCH;
2880 }
#define PAGED_CODE()
Definition: video.h:57
#define RFSD_KEY_SMALLER
Definition: rfsd.h:64
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define RFSD_KEYS_MATCH
Definition: rfsd.h:63
#define RFSD_KEY_LARGER
Definition: rfsd.h:65
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by NavigateToLeafNode(), RfsdBuildBDL2(), and RfsdLoadInode().

◆ CompareKeysWithoutOffset()

RFSD_KEY_COMPARISON CompareKeysWithoutOffset ( IN PRFSD_KEY_IN_MEMORY  a,
IN PRFSD_KEY_IN_MEMORY  b 
)

Compares two in memory keys, returning KEY_SMALLER, KEY_LARGER, or KEYS_MATCH relative to the first key given.

Definition at line 2831 of file rfsd.c.

2834 {
2835  PAGED_CODE();
2836 
2837  // compare 1. integer
2838  if( a->k_dir_id < b->k_dir_id ) return RFSD_KEY_SMALLER;
2839  if( a->k_dir_id > b->k_dir_id ) return RFSD_KEY_LARGER;
2840 
2841  // compare 2. integer
2842  if( a->k_objectid < b->k_objectid ) return RFSD_KEY_SMALLER;
2843  if( a->k_objectid > b->k_objectid ) return RFSD_KEY_LARGER;
2844 
2845  // compare 4. integer
2846  // NOTE: Buchholz says that if we get to here in navigating the file tree, something has gone wrong...
2847  if( a->k_type < b->k_type ) return RFSD_KEY_SMALLER;
2848  if( a->k_type > b->k_type ) return RFSD_KEY_LARGER;
2849 
2850  return RFSD_KEYS_MATCH;
2851 }
#define PAGED_CODE()
Definition: video.h:57
#define RFSD_KEY_SMALLER
Definition: rfsd.h:64
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define RFSD_KEYS_MATCH
Definition: rfsd.h:63
#define RFSD_KEY_LARGER
Definition: rfsd.h:65
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by RfsdDirectoryCallback(), and RfsdScanDirCallback().

◆ CompareShortKeys()

Compares two in memory keys, returning KEY_SMALLER, KEY_LARGER, or KEYS_MATCH relative to the first key given.

Definition at line 2811 of file rfsd.c.

2814 {
2815  PAGED_CODE();
2816 
2817  // compare 1. integer
2818  if( a->k_dir_id < b->k_dir_id ) return RFSD_KEY_SMALLER;
2819  if( a->k_dir_id > b->k_dir_id ) return RFSD_KEY_LARGER;
2820 
2821  // compare 2. integer
2822  if( a->k_objectid < b->k_objectid ) return RFSD_KEY_SMALLER;
2823  if( a->k_objectid > b->k_objectid ) return RFSD_KEY_LARGER;
2824 
2825  return RFSD_KEYS_MATCH;
2826 }
#define PAGED_CODE()
Definition: video.h:57
#define RFSD_KEY_SMALLER
Definition: rfsd.h:64
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define RFSD_KEYS_MATCH
Definition: rfsd.h:63
#define RFSD_KEY_LARGER
Definition: rfsd.h:65
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by _NavigateToLeafNode(), RfsdParseFilesystemTree(), and RfsdSearchMcbTree().

◆ ConvertKeyTypeUniqueness()

__u32 ConvertKeyTypeUniqueness ( __u32  k_uniqueness)

Given the uniqueness value from a version 1 KEY_ON_DISK, convert that to the v2 equivalent type (which is used for the KEY_IN_MEMORY structures)

Definition at line 2758 of file rfsd.c.

2759 {
2760  switch (k_uniqueness)
2761  {
2766 
2767  default:
2768  RfsdPrint((DBG_ERROR, "Unexpected uniqueness value %i", k_uniqueness));
2769  // NOTE: If above value is 555, it's the 'any' value, which I'd be surprised to see on disk.
2770  DbgBreak();
2771  return 0xF; // We'll return v2 'any', just to see what happens...
2772  }
2773 }
#define RFSD_KEY_TYPE_v1_DIRENTRY
Definition: reiserfs.h:280
#define RFSD_KEY_TYPE_v2_STAT_DATA
Definition: reiserfs.h:282
#define RFSD_KEY_TYPE_v1_DIRECT
Definition: reiserfs.h:279
#define RFSD_KEY_TYPE_v1_STAT_DATA
Definition: reiserfs.h:277
#define RfsdPrint(arg)
Definition: rfsd.h:1069
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define RFSD_KEY_TYPE_v2_DIRENTRY
Definition: reiserfs.h:285
#define RFSD_KEY_TYPE_v1_INDIRECT
Definition: reiserfs.h:278
#define RFSD_KEY_TYPE_v2_DIRECT
Definition: reiserfs.h:284
#define RFSD_KEY_TYPE_v2_INDIRECT
Definition: reiserfs.h:283
#define DbgBreak()
Definition: ext2fs.h:46

Referenced by FillInMemoryKey().

◆ DetermineOnDiskKeyFormat()

RFSD_KEY_VERSION DetermineOnDiskKeyFormat ( const PRFSD_KEY_ON_DISK  key)

Guess whether a key is v1, or v2, by investigating its type field. NOTE: I based this off Florian Buchholz's code snippet, which is from reisefs lib.

Old keys (on i386) have k_offset_v2.k_type == 15 (direct and indirect) or == 0 (dir items and stat data).

Definition at line 2743 of file rfsd.c.

2744 {
2745  int type = (int) key->u.k_offset_v2.k_type;
2746 
2747  PAGED_CODE();
2748 
2749  if ( type == 0x0 || type == 0xF )
2750  return RFSD_KEY_VERSION_1;
2751 
2752  return RFSD_KEY_VERSION_2;
2753 }
GLint x0
Definition: linetemp.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define PAGED_CODE()
Definition: video.h:57
#define RFSD_KEY_VERSION_2
Definition: rfsd.h:59
#define RFSD_KEY_VERSION_1
Definition: rfsd.h:58
Definition: path.c:42
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by FillInMemoryKey().

◆ DriverUnload()

VOID NTAPI DriverUnload ( IN PDRIVER_OBJECT  DriverObject)

Definition at line 15 of file green.c.

16 {
17  // nothing to do here yet
18 }

Referenced by DriverEntry().

◆ FillInMemoryKey()

void FillInMemoryKey ( IN PRFSD_KEY_ON_DISK  pKeyOnDisk,
IN RFSD_KEY_VERSION  KeyVersion,
IN OUT PRFSD_KEY_IN_MEMORY  pKeyInMemory 
)

Fills an in-memory key structure with equivalent data as that given by an on-disk key, converting any older v1 information ito the new v2 formats.

Definition at line 2777 of file rfsd.c.

2781 {
2782  PAGED_CODE();
2783 
2784  // Sanity check that the input and output locations exist
2785  if (!pKeyOnDisk || !pKeyInMemory) { DbgBreak(); return; }
2786 
2787  // Copy over the fields that are compatible between keys
2788  pKeyInMemory->k_dir_id = pKeyOnDisk->k_dir_id;
2789  pKeyInMemory->k_objectid = pKeyOnDisk->k_objectid;
2790 
2791  if (KeyVersion == RFSD_KEY_VERSION_UNKNOWN)
2792  { KeyVersion = DetermineOnDiskKeyFormat(pKeyOnDisk); }
2793 
2794  // Copy over the fields that are incompatible between keys, converting older type fields to the v2 format
2795  switch (KeyVersion)
2796  {
2797  case RFSD_KEY_VERSION_1:
2798  pKeyInMemory->k_offset = pKeyOnDisk->u.k_offset_v1.k_offset;
2799  pKeyInMemory->k_type = ConvertKeyTypeUniqueness( pKeyOnDisk->u.k_offset_v1.k_uniqueness );
2800  break;
2801 
2802  case RFSD_KEY_VERSION_2:
2803  pKeyInMemory->k_offset = pKeyOnDisk->u.k_offset_v2.k_offset;
2804  pKeyInMemory->k_type = (__u32) pKeyOnDisk->u.k_offset_v2.k_type;
2805  break;
2806  }
2807 }
#define PAGED_CODE()
Definition: video.h:57
#define RFSD_KEY_VERSION_2
Definition: rfsd.h:59
__u32 ConvertKeyTypeUniqueness(__u32 k_uniqueness)
Definition: rfsd.c:2758
unsigned int __u32
Definition: compat.h:90
RFSD_KEY_VERSION DetermineOnDiskKeyFormat(const PRFSD_KEY_ON_DISK key)
Definition: rfsd.c:2743
#define RFSD_KEY_VERSION_UNKNOWN
Definition: rfsd.h:60
#define RFSD_KEY_VERSION_1
Definition: rfsd.h:58
#define DbgBreak()
Definition: ext2fs.h:46

Referenced by _NavigateToLeafNode(), and RfsdFindItemHeaderInBlock().

◆ NavigateToLeafNode()

NTSTATUS NavigateToLeafNode ( IN PRFSD_VCB  Vcb,
IN PRFSD_KEY_IN_MEMORY  Key,
IN ULONG  StartingBlockNumber,
OUT PULONG  out_NextBlockNumber 
)

Definition at line 2896 of file rfsd.c.

2902 {
2903  PAGED_CODE();
2904 
2905  return _NavigateToLeafNode(Vcb, Key, StartingBlockNumber, out_NextBlockNumber, TRUE, &CompareKeys, NULL, NULL);
2906 }
#define TRUE
Definition: types.h:120
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS _NavigateToLeafNode(IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY Key, IN ULONG StartingBlockNumber, OUT PULONG out_NextBlockNumber, IN BOOLEAN ReturnOnFirstMatch, IN RFSD_KEY_COMPARISON(*fpComparisonFunction)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY), RFSD_CALLBACK(fpDirectoryCallback), IN PVOID pContext)
Definition: rfsd.c:2934
#define Vcb
Definition: cdprocs.h:1425
RFSD_KEY_COMPARISON CompareKeys(IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
Definition: rfsd.c:2856

Referenced by RfsdLoadItem().

◆ RfsdAcquireForLazyWrite()

BOOLEAN NTAPI RfsdAcquireForLazyWrite ( IN PVOID  Context,
IN BOOLEAN  Wait 
)

Definition at line 32 of file cmcb.c.

35 {
36  PRFSD_FCB Fcb;
37 
38  PAGED_CODE();
39 
40  Fcb = (PRFSD_FCB) Context;
41 
42  ASSERT(Fcb != NULL);
43 
45  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
46 
47  RfsdPrint((DBG_INFO, "RfsdAcquireForLazyWrite: %s %s %s\n",
49  "ACQUIRE_FOR_LAZY_WRITE",
50  Fcb->AnsiFileName.Buffer ));
51 
52  if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY)) {
53  RfsdPrint(( DBG_INFO, "RfsdAcquireForLazyWrite: Key=%x,%xh %S\n",
54  Fcb->RfsdMcb->Key.k_dir_id, Fcb->RfsdMcb->Key.k_objectid, Fcb->RfsdMcb->ShortName.Buffer ));
55 
58  return FALSE;
59  }
60  }
61 
63 
65 
66  return TRUE;
67 }
#define TRUE
Definition: types.h:120
#define PAGED_CODE()
Definition: video.h:57
Definition: rfsd.h:324
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
smooth NULL
Definition: ftsmooth.c:416
#define RfsdGetCurrentProcessName()
Definition: rfsd.h:1095
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define RfsdPrint(arg)
Definition: rfsd.h:1069
ULONG Type
Definition: ntfs.h:95
#define VCB_READ_ONLY
Definition: ext2fs.h:795
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
ERESOURCE PagingIoResource
Definition: ntfs.h:523
PVCB Vcb
Definition: cdstruc.h:939
#define DBG_INFO
Definition: ffsdrv.h:1034
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1114
ULONG Size
Definition: ntfs.h:96
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by DriverEntry().

◆ RfsdAcquireForReadAhead()

BOOLEAN NTAPI RfsdAcquireForReadAhead ( IN PVOID  Context,
IN BOOLEAN  Wait 
)

Definition at line 104 of file cmcb.c.

106 {
107  PRFSD_FCB Fcb;
108 
109  PAGED_CODE();
110 
111  Fcb = (PRFSD_FCB) Context;
112 
113  ASSERT(Fcb != NULL);
114 
115  ASSERT((Fcb->Identifier.Type == RFSDFCB) &&
116  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
117 
118  RfsdPrint(( DBG_INFO, "RfsdAcquireForReadAhead: Inode=%x,%xh %S\n",
119  Fcb->RfsdMcb->Key.k_dir_id, Fcb->RfsdMcb->Key.k_objectid, Fcb->RfsdMcb->ShortName.Buffer ));
120 
122  &Fcb->MainResource, Wait ))
123  return FALSE;
124 
126 
128 
129  return TRUE;
130 }
#define TRUE
Definition: types.h:120
#define PAGED_CODE()
Definition: video.h:57
Definition: rfsd.h:324
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
smooth NULL
Definition: ftsmooth.c:416
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define RfsdPrint(arg)
Definition: rfsd.h:1069
ULONG Type
Definition: ntfs.h:95
ERESOURCE MainResource
Definition: ntfs.h:524
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define DBG_INFO
Definition: ffsdrv.h:1034
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1114
ULONG Size
Definition: ntfs.h:96
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by DriverEntry().

◆ RfsdAddEntry()

NTSTATUS RfsdAddEntry ( IN PRFSD_IRP_CONTEXT  IrpContext,
IN PRFSD_VCB  Vcb,
IN PRFSD_FCB  Dcb,
IN ULONG  FileType,
IN ULONG  Inode,
IN PUNICODE_STRING  FileName 
)

◆ RfsdAddMcbEntry()

BOOLEAN RfsdAddMcbEntry ( IN PRFSD_VCB  Vcb,
IN LONGLONG  Lba,
IN LONGLONG  Length 
)

◆ RfsdAddMcbNode()

VOID RfsdAddMcbNode ( PRFSD_VCB  Vcb,
PRFSD_MCB  Parent,
PRFSD_MCB  Child 
)

Definition at line 1023 of file memory.c.

1024 {
1025  PRFSD_MCB TmpMcb = Parent->Child;
1026 
1027  PAGED_CODE();
1028 
1029  if(IsFlagOn(Child->Flags, MCB_IN_TREE)) {
1030  DbgBreak();
1031  RfsdPrint((DBG_ERROR, "RfsdAddMcbNode: Child Mcb is alreay in the tree.\n"));
1032  return;
1033  }
1034 
1035  if (TmpMcb) {
1036  ASSERT(TmpMcb->Parent == Parent);
1037 
1038  while (TmpMcb->Next) {
1039  TmpMcb = TmpMcb->Next;
1040  ASSERT(TmpMcb->Parent == Parent);
1041  }
1042 
1043  TmpMcb->Next = Child;
1044  Child->Parent = Parent;
1045  Child->Next = NULL;
1046  } else {
1047  Parent->Child = Child;
1048  Child->Parent = Parent;
1049  Child->Next = NULL;
1050  }
1051 
1052  InsertTailList(&(Vcb->McbList), &(Child->Link));
1053  SetFlag(Child->Flags, MCB_IN_TREE);
1054 }
PRFSD_MCB Parent
Definition: rfsd.h:684
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:722
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
smooth NULL
Definition: ftsmooth.c:416
PRFSD_MCB Next
Definition: rfsd.h:686
#define Vcb
Definition: cdprocs.h:1425
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define RfsdPrint(arg)
Definition: rfsd.h:1069
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define MCB_IN_TREE
Definition: ffsdrv.h:679
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:722
#define DbgBreak()
Definition: ext2fs.h:46

Referenced by RfsdLookupFileName(), and RfsdSetRenameInfo().

◆ RfsdAllocateAndLoadBlock()

PUCHAR RfsdAllocateAndLoadBlock ( IN PRFSD_VCB  Vcb,
IN ULONG  BlockIndex 
)

Returns the address of an allocated buffer (WHICH THE CALLER WILL BE RESPONSIBLE FOR FREEING!), filled with the contents of the given block number on disk. (This is really just an alternative interface to LoadBlock)

Definition at line 34 of file rfsdblock.c.

37 {
38  // Allocate the return buffer (the caller will be responsible for freeing this!)
39  PUCHAR pReturnBuffer = ExAllocatePoolWithTag(NonPagedPool, Vcb->BlockSize, RFSD_POOL_TAG); // NOTE: for now, I'm switching this to non-paged, because i was getting crashes
40 
41  PAGED_CODE();
42 
43  if (!pReturnBuffer)
44  { DbgBreak(); return NULL; }
45 
46  // Read the block in from disk, or from cache.
47  if (!RfsdLoadBlock(Vcb, BlockIndex, pReturnBuffer))
48  { DbgBreak(); ExFreePool(pReturnBuffer); return NULL; }
49 
50  // Return the result to the caller.
51  return pReturnBuffer;
52 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define RFSD_POOL_TAG
Definition: rfsd.h:99
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
#define Vcb
Definition: cdprocs.h:1425
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DbgBreak()
Definition: ext2fs.h:46
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
BOOLEAN RfsdLoadBlock(IN PRFSD_VCB Vcb, IN ULONG dwBlk, IN PVOID Buffer)

Referenced by _NavigateToLeafNode(), RfsdDirectoryCallback(), RfsdLoadItem(), and RfsdScanDirCallback().

◆ RfsdAllocateCcb()

PRFSD_CCB RfsdAllocateCcb ( VOID  )

Definition at line 617 of file memory.c.

618 {
619  PRFSD_CCB Ccb;
620 
621  PAGED_CODE();
622 
625  TRUE );
626 
627  Ccb = (PRFSD_CCB) (ExAllocateFromNPagedLookasideList( &(RfsdGlobal->RfsdCcbLookasideList)));
628 
632 
633  if (Ccb == NULL) {
635 
636  RtlZeroMemory(Ccb, sizeof(RFSD_CCB));
637 
639  } else {
640  RtlZeroMemory(Ccb, sizeof(RFSD_CCB));
641  }
642 
643  if (!Ccb) {
644  return NULL;
645  }
646 
648  Ccb->Identifier.Size = sizeof(RFSD_CCB);
649 
650  Ccb->CurrentByteOffset = 0;
651 
652  Ccb->DirectorySearchPattern.Length = 0;
653  Ccb->DirectorySearchPattern.MaximumLength = 0;
654  Ccb->DirectorySearchPattern.Buffer = 0;
655 
656  return Ccb;
657 }
struct _RFSD_CCB * PRFSD_CCB
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
ERESOURCE LAResource
Definition: rfsd.h:394
#define RFSD_POOL_TAG
Definition: rfsd.h:99
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
smooth NULL
Definition: ftsmooth.c:416
NPAGED_LOOKASIDE_LIST RfsdCcbLookasideList
Definition: rfsd.h:416
ULONG Flags
Definition: ntfs.h:532
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG Type
Definition: ntfs.h:95
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
Definition: rfsd.h:325
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define CCB_FROM_POOL
Definition: ext2fs.h:1022
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
struct _RFSD_CCB RFSD_CCB
ULONG Size
Definition: ntfs.h:96

Referenced by RfsdCreateFile(), and RfsdCreateVolume().

◆ RfsdAllocateFcb()

PRFSD_FCB RfsdAllocateFcb ( IN PRFSD_VCB  Vcb,
IN PRFSD_MCB  RfsdMcb,
IN PRFSD_INODE  Inode 
)

Definition at line 383 of file memory.c.

386 {
387  PRFSD_FCB Fcb;
388 
389  PAGED_CODE();
390 
393  TRUE );
394 
395  Fcb = (PRFSD_FCB) ExAllocateFromNPagedLookasideList(
397 
401 
402  if (Fcb == NULL) {
404 
405  RtlZeroMemory(Fcb, sizeof(RFSD_FCB));
406 
408  } else {
409  RtlZeroMemory(Fcb, sizeof(RFSD_FCB));
410  }
411 
412  if (!Fcb) {
413  return NULL;
414  }
415 
417  Fcb->Identifier.Size = sizeof(RFSD_FCB);
418 
420  &Fcb->FileLockAnchor,
421  NULL,
422  NULL );
423 
424  Fcb->OpenHandleCount = 0;
425  Fcb->ReferenceCount = 0;
426 
427  Fcb->Vcb = Vcb;
428 
429 #if DBG
430 
431  Fcb->AnsiFileName.MaximumLength = (USHORT)
432  RfsdUnicodeToOEMSize(&(RfsdMcb->ShortName)) + 1;
433 
434  Fcb->AnsiFileName.Buffer = (PUCHAR)
435  ExAllocatePoolWithTag(PagedPool, Fcb->AnsiFileName.MaximumLength, RFSD_POOL_TAG);
436 
437  if (!Fcb->AnsiFileName.Buffer) {
438  goto errorout;
439  }
440 
441  RtlZeroMemory(Fcb->AnsiFileName.Buffer, Fcb->AnsiFileName.MaximumLength);
442 
443  RfsdUnicodeToOEM( &(Fcb->AnsiFileName),
444  &(RfsdMcb->ShortName));
445 
446 #endif
447 
448  RfsdMcb->FileAttr = FILE_ATTRIBUTE_NORMAL;
449 
450  if (S_ISDIR(Inode->i_mode)) {
451  SetFlag(RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY);
452  }
453 
454  if ( IsFlagOn(Vcb->Flags, VCB_READ_ONLY) ||
455  RfsdIsReadOnly(Inode->i_mode)) {
456  SetFlag(RfsdMcb->FileAttr, FILE_ATTRIBUTE_READONLY);
457  }
458 
459  Fcb->Inode = Inode;
460 
461  Fcb->RfsdMcb = RfsdMcb;
462  RfsdMcb->RfsdFcb = Fcb;
463 
465 
466  Fcb->Header.NodeTypeCode = (USHORT) RFSDFCB;
467  Fcb->Header.NodeByteSize = sizeof(RFSD_FCB);
468  Fcb->Header.IsFastIoPossible = FastIoIsNotPossible;
469  Fcb->Header.Resource = &(Fcb->MainResource);
470  Fcb->Header.PagingIoResource = &(Fcb->PagingIoResource);
471 
472  // NOTE: In EXT2, the low part was stored in i_size (a 32-bit value); the high part would be stored in the acl field...
473  // However, on ReiserFS, the i_size is a 64-bit value.
474  Fcb->Header.FileSize.QuadPart = Fcb->Inode->i_size;
475 
476 
477  Fcb->Header.AllocationSize.QuadPart =
478  CEILING_ALIGNED(Fcb->Header.FileSize.QuadPart, (ULONGLONG)Vcb->BlockSize);
479 
480  Fcb->Header.ValidDataLength.QuadPart = (LONGLONG)(0x7fffffffffffffff);
481 
482  Fcb->SectionObject.DataSectionObject = NULL;
483  Fcb->SectionObject.SharedCacheMap = NULL;
484  Fcb->SectionObject.ImageSectionObject = NULL;
485 
488 
489  InsertTailList(&Vcb->FcbList, &Fcb->Next);
490 
491 #if DBG
492 
495  TRUE );
496 
497  RfsdGlobal->FcbAllocated++;
498 
502 #endif
503 
504  return Fcb;
505 
506 #if DBG
507 errorout:
508 #endif
509 
510  if (Fcb) {
511 
512 #if DBG
513  if (Fcb->AnsiFileName.Buffer)
514  ExFreePool(Fcb->AnsiFileName.Buffer);
515 #endif
516 
517  if (FlagOn(Fcb->Flags, FCB_FROM_POOL)) {
518 
519  ExFreePool( Fcb );
520 
521  } else {
522 
525  TRUE );
526 
527  ExFreeToNPagedLookasideList(&(RfsdGlobal->RfsdFcbLookasideList), Fcb);
528 
532  }
533 
534  }
535 
536  return NULL;
537 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define RfsdIsReadOnly(m)
Definition: rfsd.h:295
NTSTATUS RfsdUnicodeToOEM(IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
Definition: misc.c:246
#define TRUE
Definition: types.h:120
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
VOID NTAPI FsRtlInitializeFileLock(IN PFILE_LOCK FileLock, IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL, IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL)
Definition: filelock.c:1261
#define CEILING_ALIGNED(T, A, B)
Definition: ext2fs.h:111
ERESOURCE LAResource
Definition: rfsd.h:394
unsigned char * PUCHAR
Definition: retypes.h:3
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define RFSD_POOL_TAG
Definition: rfsd.h:99
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
Definition: rfsd.h:324
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
ERESOURCE CountResource
Definition: rfsd.h:391
struct _RFSD_FCB RFSD_FCB
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
ULONG OpenHandleCount
Definition: ntfs.h:533
int64_t LONGLONG
Definition: typedefs.h:66
uint64_t ULONGLONG
Definition: typedefs.h:65
#define S_ISDIR(mode)
Definition: various.h:18
#define Vcb
Definition: cdprocs.h:1425
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
ULONG RfsdUnicodeToOEMSize(IN PUNICODE_STRING Unicode)
Definition: misc.c:233
ULONG Flags
Definition: ntfs.h:532
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
ULONG Type
Definition: ntfs.h:95
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
ERESOURCE MainResource
Definition: ntfs.h:524
#define VCB_READ_ONLY
Definition: ext2fs.h:795
#define FCB_FROM_POOL
Definition: ext2fs.h:871
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
unsigned short USHORT
Definition: pedump.c:61
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
NPAGED_LOOKASIDE_LIST RfsdFcbLookasideList
Definition: rfsd.h:415
ERESOURCE PagingIoResource
Definition: ntfs.h:523
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
PVCB Vcb
Definition: cdstruc.h:939
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
_In_ PFCB Fcb
Definition: cdprocs.h:151
ULONG Size
Definition: ntfs.h:96
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by RfsdCreateFcbFromMcb(), and RfsdCreateFile().

◆ RfsdAllocateIrpContext()

PRFSD_IRP_CONTEXT RfsdAllocateIrpContext ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 48 of file memory.c.

50 {
51  PIO_STACK_LOCATION IoStackLocation;
52  PRFSD_IRP_CONTEXT IrpContext;
53 
54  PAGED_CODE();
55 
57  ASSERT(Irp != NULL);
58 
59  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
60 
63  TRUE );
64 
65  IrpContext = (PRFSD_IRP_CONTEXT) (
66  ExAllocateFromNPagedLookasideList(
68 
72 
73  if (IrpContext == NULL) {
74 
76 
77  //
78  // Zero out the irp context and indicate that it is from pool and
79  // not region allocated
80  //
81 
82  RtlZeroMemory(IrpContext, sizeof(RFSD_IRP_CONTEXT));
83 
85 
86  } else {
87 
88  //
89  // Zero out the irp context and indicate that it is from zone and
90  // not pool allocated
91  //
92 
93  RtlZeroMemory(IrpContext, sizeof(RFSD_IRP_CONTEXT) );
94  }
95 
96  if (!IrpContext) {
97  return NULL;
98  }
99 
100  IrpContext->Identifier.Type = RFSDICX;
101  IrpContext->Identifier.Size = sizeof(RFSD_IRP_CONTEXT);
102 
103  IrpContext->Irp = Irp;
104 
105  IrpContext->MajorFunction = IoStackLocation->MajorFunction;
106  IrpContext->MinorFunction = IoStackLocation->MinorFunction;
107 
108  IrpContext->DeviceObject = DeviceObject;
109 
110  IrpContext->FileObject = IoStackLocation->FileObject;
111 
112  if (IrpContext->FileObject != NULL) {
113  IrpContext->RealDevice = IrpContext->FileObject->DeviceObject;
114  } else if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL) {
115  if (IoStackLocation->Parameters.MountVolume.Vpb) {
116  IrpContext->RealDevice =
117  IoStackLocation->Parameters.MountVolume.Vpb->RealDevice;
118  }
119  }
120 
121  if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
122  IrpContext->MajorFunction == IRP_MJ_DEVICE_CONTROL ||
123  IrpContext->MajorFunction == IRP_MJ_SHUTDOWN) {
124  IrpContext->IsSynchronous = TRUE;
125  } else if (IrpContext->MajorFunction == IRP_MJ_CLEANUP ||
126  IrpContext->MajorFunction == IRP_MJ_CLOSE) {
127  IrpContext->IsSynchronous = FALSE;
128  }
129 #if (_WIN32_WINNT >= 0x0500)
130  else if (IrpContext->MajorFunction == IRP_MJ_PNP) {
132  IrpContext->IsSynchronous = TRUE;
133  } else {
135  }
136  }
137 #endif //(_WIN32_WINNT >= 0x0500)
138  else {
140  }
141 
142 #if 0
143  //
144  // Temporary workaround for a bug in close that makes it reference a
145  // fileobject when it is no longer valid.
146  //
147  if (IrpContext->MajorFunction == IRP_MJ_CLOSE) {
148  IrpContext->IsSynchronous = TRUE;
149  }
150 #endif
151 
152  IrpContext->IsTopLevel = (IoGetTopLevelIrp() == Irp);
153 
154  IrpContext->ExceptionInProgress = FALSE;
155 
156  return IrpContext;
157 }
BOOLEAN IsSynchronous
Definition: rfsd.h:780
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
BOOLEAN IsTopLevel
Definition: rfsd.h:783
#define IRP_MJ_SHUTDOWN
UCHAR MinorFunction
Definition: rfsd.h:765
_In_ PIRP Irp
Definition: csq.h:116
ERESOURCE LAResource
Definition: rfsd.h:394
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
NPAGED_LOOKASIDE_LIST RfsdIrpContextLookasideList
Definition: rfsd.h:414
#define RFSD_POOL_TAG
Definition: rfsd.h:99
#define IRP_CONTEXT_FLAG_FROM_POOL
Definition: ext2fs.h:1077
BOOLEAN NTAPI IoIsOperationSynchronous(IN PIRP Irp)
Definition: irp.c:1882
#define PAGED_CODE()
Definition: video.h:57
PFILE_OBJECT FileObject
Definition: rfsd.h:774
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
smooth NULL
Definition: ftsmooth.c:416
RFSD_IDENTIFIER_TYPE Type
Definition: rfsd.h:336
UCHAR MajorFunction
Definition: rfsd.h:764
Definition: rfsd.h:326
#define IRP_MJ_FILE_SYSTEM_CONTROL
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
RFSD_IDENTIFIER Identifier
Definition: rfsd.h:755
PDEVICE_OBJECT DeviceObject
Definition: rfsd.h:768
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
struct _RFSD_IRP_CONTEXT * PRFSD_IRP_CONTEXT
BOOLEAN ExceptionInProgress
Definition: rfsd.h:789
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
ULONG Flags
Definition: rfsd.h:761
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
#define IRP_MJ_CLEANUP
PDEVICE_OBJECT RealDevice
Definition: rfsd.h:771
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
ULONG Size
Definition: rfsd.h:337
struct _RFSD_IRP_CONTEXT RFSD_IRP_CONTEXT
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by RfsdBuildRequest().

◆ RfsdAllocateMcb()

PRFSD_MCB RfsdAllocateMcb ( PRFSD_VCB  ,
PUNICODE_STRING  FileName,
ULONG  FileAttr 
)

Definition at line 694 of file memory.c.

695 {
696  PRFSD_MCB Mcb = NULL;
698  ULONG Extra = 0;
699 
700  PAGED_CODE();
701 
702 #define MCB_NUM_SHIFT 0x04
703 
705  Extra = RfsdGlobal->McbAllocated -
708 
710  "RfsdAllocateMcb: CurrDepth=%xh/%xh/%xh FileName=%S\n",
713  RfsdGlobal->FcbAllocated,
714  FileName->Buffer));
715 
716  List = Vcb->McbList.Flink;
717 
718  while ((List != &(Vcb->McbList)) && (Extra > 0)) {
720  List = List->Flink;
721 
722  if ((!RFSD_IS_ROOT_KEY(Mcb->Key)) && (Mcb->Child == NULL) &&
723  (Mcb->RfsdFcb == NULL) && (!IsMcbUsed(Mcb))) {
724  RfsdPrint((DBG_INFO, "RfsdAllocateMcb: Mcb %S will be freed.\n",
725  Mcb->ShortName.Buffer));
726 
727  if (RfsdDeleteMcbNode(Vcb, Vcb->McbTree, Mcb)) {
728  RfsdFreeMcb(Mcb);
729 
730  Extra--;
731  }
732  }
733  }
734 
737  TRUE );
738 
739  Mcb = (PRFSD_MCB) (ExAllocateFromPagedLookasideList(
741 
745 
746  if (Mcb == NULL) {
748 
749  RtlZeroMemory(Mcb, sizeof(RFSD_MCB));
750 
751  SetFlag(Mcb->Flags, MCB_FROM_POOL);
752  } else {
753  RtlZeroMemory(Mcb, sizeof(RFSD_MCB));
754  }
755 
756  if (!Mcb) {
757  return NULL;
758  }
759 
760  Mcb->Identifier.Type = RFSDMCB;
761  Mcb->Identifier.Size = sizeof(RFSD_MCB);
762 
763  if (FileName && FileName->Length) {
764 
765  Mcb->ShortName.Length = FileName->Length;
766  Mcb->ShortName.MaximumLength = Mcb->ShortName.Length + 2;
767 
768  Mcb->ShortName.Buffer = ExAllocatePoolWithTag(PagedPool, Mcb->ShortName.MaximumLength, RFSD_POOL_TAG);
769 
770  if (!Mcb->ShortName.Buffer)
771  goto errorout;
772 
773  RtlZeroMemory(Mcb->ShortName.Buffer, Mcb->ShortName.MaximumLength);
774  RtlCopyMemory(Mcb->ShortName.Buffer, FileName->Buffer, Mcb->ShortName.Length);
775  }
776 
777  Mcb->FileAttr = FileAttr;
778 
781  TRUE );
782 
784 
788 
789  return Mcb;
790 
791 errorout:
792 
793  if (Mcb) {
794 
795  if (Mcb->ShortName.Buffer)
796  ExFreePool(Mcb->ShortName.Buffer);
797 
798  if (FlagOn(Mcb->Flags, MCB_FROM_POOL)) {
799 
800  ExFreePool( Mcb );
801 
802  } else {
803 
806  TRUE );
807 
808  ExFreeToPagedLookasideList(&(RfsdGlobal->RfsdMcbLookasideList), Mcb);
809 
813  }
814  }
815 
816  return NULL;
817 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define MCB_FROM_POOL
Definition: ext2fs.h:943
USHORT MaxDepth
Definition: rfsd.h:413
ERESOURCE LAResource
Definition: rfsd.h:394
#define RFSD_IS_ROOT_KEY(x)
Definition: rfsd.h:52
#define RFSD_POOL_TAG
Definition: rfsd.h:99
PAGED_LOOKASIDE_LIST RfsdMcbLookasideList
Definition: rfsd.h:417
Definition: rfsd.h:327
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
__drv_mustHoldCriticalRegion VOID RfsdFreeMcb(IN PRFSD_MCB Mcb)
Definition: memory.c:821
ERESOURCE CountResource
Definition: rfsd.h:391
smooth NULL
Definition: ftsmooth.c:416
USHORT McbAllocated
Definition: rfsd.h:420
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define MCB_NUM_SHIFT
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
BOOLEAN RfsdDeleteMcbNode(PRFSD_VCB Vcb, PRFSD_MCB McbTree, PRFSD_MCB RfsdMcb)
Definition: memory.c:1057
#define Vcb
Definition: cdprocs.h:1425
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define RfsdPrint(arg)
Definition: rfsd.h:1069
Definition: typedefs.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
struct _RFSD_MCB * PRFSD_MCB
Definition: rfsd.h:343
#define IsMcbUsed(Mcb)
Definition: ext2fs.h:952
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define DBG_INFO
Definition: ffsdrv.h:1034
struct _RFSD_MCB RFSD_MCB
Definition: rfsd.h:343
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by RfsdInitializeVcb(), and RfsdLookupFileName().

◆ RfsdAllowExtendedDasdIo()

NTSTATUS RfsdAllowExtendedDasdIo ( IN PRFSD_IRP_CONTEXT  IrpContext)

Definition at line 445 of file fsctl.c.

446 {
448  PRFSD_VCB Vcb;
449  PRFSD_CCB Ccb;
450 
451  PAGED_CODE();
452 
453  IrpSp = IoGetCurrentIrpStackLocation(IrpContext->Irp);
454 
455  Vcb = (PRFSD_VCB) IrpSp->FileObject->FsContext;
456  Ccb = (PRFSD_CCB) IrpSp->FileObject->FsContext2;
457 
458  ASSERT(Vcb != NULL);
459 
460  ASSERT((Vcb->Identifier.Type == RFSDVCB) &&
461  (Vcb->Identifier.Size == sizeof(RFSD_VCB)));
462 
463  ASSERT(IsMounted(Vcb));
464 
465  if (Ccb) {
467 
469 
470  return STATUS_SUCCESS;
471  } else {
473  }
474 }
#define IsMounted(Vcb)
Definition: ext2fs.h:803
NTSTATUS RfsdCompleteIrpContext(IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: memory.c:160
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: rfsd.h:323
#define PAGED_CODE()
Definition: video.h:57
#define CCB_ALLOW_EXTENDED_DASD_IO
Definition: ext2fs.h:1028
smooth NULL
Definition: ftsmooth.c:416
struct _RFSD_VCB * PRFSD_VCB
#define Vcb
Definition: cdprocs.h:1425
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Flags
Definition: ntfs.h:532
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by RfsdUserFsRequest().

◆ RfsdBlockMap()

NTSTATUS RfsdBlockMap ( IN PRFSD_IRP_CONTEXT  IrpContext,
IN PRFSD_VCB  Vcb,
IN ULONG  InodeNo,
IN PRFSD_INODE  Inode,
IN ULONG  Index,
IN BOOLEAN  bAlloc,
OUT PULONG  pBlock 
)

◆ RfsdBuildBDL()

NTSTATUS RfsdBuildBDL ( IN PRFSD_IRP_CONTEXT  IrpContext,
IN PRFSD_VCB  Vcb,
IN PRFSD_KEY_IN_MEMORY  InodeNo,
IN PRFSD_INODE  Inode,
IN ULONGLONG  Offset,
IN ULONG  Size,
IN BOOLEAN  bAlloc,
OUT PRFSD_BDL Bdls,
OUT PULONG  Count 
)

Referenced by RfsdWriteInode().

◆ RfsdBuildBDL2()

NTSTATUS RfsdBuildBDL2 ( IN PRFSD_VCB  Vcb,
IN PRFSD_KEY_IN_MEMORY  pKey,
IN PRFSD_INODE  pInode,
OUT PULONG  out_Count,
OUT PRFSD_BDL out_ppBdl 
)

Definition at line 675 of file rfsd.c.

681 {
683  BOOLEAN done = FALSE;
684 
685  RFSD_KEY_IN_MEMORY CurrentTargetKey = *pKey;
686  ULONGLONG CurrentOffset = 0;
687 
688  PRFSD_ITEM_HEAD pItemHeader = NULL; // The temporary storage for retrieving items from disk
689  PUCHAR pItemBuffer = NULL;
690  PUCHAR pBlockBuffer = NULL;
691 
692  ULONG idxCurrentBD = 0;
693  PRFSD_BDL pBdl = NULL; // The block descriptor list, which will be allocated, filled, and assigned to out_Bdl
694 
695  PAGED_CODE();
696 
697  // Allocate the BDL for the maximum number of block descriptors that will be needed (including the tail)
698  // FUTURE: sd_blocks DEFINITELY is not the number of blocks consumed by a file. (at least not the number of 4096-byte blocks)
699  // However, I'm unsure of how to calculate the number of blocks. Perhaps I should consider using a linked list instead?
700  KdPrint(("## Allocating %i BD's\n", pInode->i_size / Vcb->BlockSize + 3));
701  pBdl = ExAllocatePoolWithTag(NonPagedPool, sizeof(RFSD_BDL) * (SIZE_T) (pInode->i_size / Vcb->BlockSize + 3), RFSD_POOL_TAG);
702  if (!pBdl) { Status = STATUS_INSUFFICIENT_RESOURCES; goto errorout; }
703  //RtlZeroMemory(pBdl, sizeof(RFSD_BDL) * (pInode->sd_blocks + 1));
704  RtlZeroMemory(pBdl, sizeof(RFSD_BDL) * (SIZE_T) (pInode->i_size / Vcb->BlockSize + 3));
705 
706 
707  // Build descriptors for all of the indirect items associated with the file
708  while (!done)
709  {
710  // Search for an indirect item, corresponding to CurrentOffset...
711 
712  // Create the key to search for (note that the key always start with offset 1, even though it is for byte 0)
713  CurrentTargetKey.k_offset = CurrentOffset + 1;
714  CurrentTargetKey.k_type = RFSD_KEY_TYPE_v2_INDIRECT;
715 
716  // Perform the search
718  Vcb, &CurrentTargetKey,
719  &(pItemHeader), &(pItemBuffer), &(pBlockBuffer), NULL,
720  &CompareKeys
721  );
722 
723  // If there was no such indirect item...
724  if (Status == STATUS_NO_SUCH_MEMBER) { Status = STATUS_SUCCESS; break; }
725  if (!NT_SUCCESS(Status)) { goto errorout; }
726 
727  // Otherwise, create a block descriptor for each pointer in the indirect item
728  {
729  ULONG countBlockRefs = pItemHeader->ih_item_len / sizeof(ULONG);
730  ULONG idxBlockRef;
731 
732  for (idxBlockRef = 0; idxBlockRef < countBlockRefs; idxBlockRef++)
733  {
734  PULONG BlockRef = (PULONG) ((PUCHAR) pItemBuffer + sizeof(ULONG) * idxBlockRef);
735 
736  // Build a block descriptor for this block reference
737  pBdl[idxCurrentBD].Lba = (LONGLONG) *BlockRef * (LONGLONG) Vcb->BlockSize;
738  pBdl[idxCurrentBD].Length = Vcb->BlockSize;
739  pBdl[idxCurrentBD].Offset = CurrentOffset;
740 
741  // If this is the last reference in the indirect item, subtract the free space from the end
742  // TODO: this may not work, because the ih_free_space_reserved seems to be wrong / not there!
743  if (idxBlockRef == (countBlockRefs - 1))
744  pBdl[idxCurrentBD].Length -= pItemHeader->u.ih_free_space_reserved;
745 
746  // Advance to the next block reference
747  CurrentOffset += Vcb->BlockSize;
748  idxCurrentBD++;
749  }
750 
751  if (countBlockRefs <= 0) { done = TRUE; }
752  }
753 
754  if (pBlockBuffer) { ExFreePool(pBlockBuffer); pBlockBuffer = NULL; }
755  }
756 
757  // Cleanup the last remaining block buffer, from the indirect items
758  if (pBlockBuffer) { ExFreePool(pBlockBuffer); pBlockBuffer = NULL; }
759 
760  // Search for the tail of the file (its optional direct item), corresponding to CurrentOffset...
761  {
762  ULONG BlockNumber = 0;
763 
764  // Create the key to search for
765  CurrentTargetKey.k_offset = CurrentOffset + 1;
766  CurrentTargetKey.k_type = RFSD_KEY_TYPE_v2_DIRECT;
767 
768  // Perform the search
770  Vcb, &CurrentTargetKey,
771  &(pItemHeader), &(pItemBuffer), &(pBlockBuffer), &(BlockNumber),
772  &CompareKeys
773  );
774 
775  if (Status == STATUS_SUCCESS)
776  {
777  // If there was a tail, then build a block descriptor for it
778  pBdl[idxCurrentBD].Lba = (LONGLONG) BlockNumber * (LONGLONG) Vcb->BlockSize + pItemHeader->ih_item_location;
779  pBdl[idxCurrentBD].Length = pItemHeader->ih_item_len;
780  pBdl[idxCurrentBD].Offset = CurrentOffset;
781 
782  // Advance to the next block reference
783  CurrentOffset += pItemHeader->ih_item_len;
784  idxCurrentBD++;
785  }
786  else
787  {
788  if (Status == STATUS_NO_SUCH_MEMBER) { Status = STATUS_SUCCESS; goto errorout; } // If there wasn't a tail, it's fine
789  else { goto errorout; } // But if there was some other problem, let's report it.
790  }
791  }
792 
793  if (pBlockBuffer) { ExFreePool(pBlockBuffer); pBlockBuffer = NULL; }
794 
795  // Search for the second part of the tail of the file (its optional second direct item), corresponding to CurrentOffset...
796  {
797  ULONG BlockNumber = 0;
798 
799  // Create the key to search for
800  CurrentTargetKey.k_offset = CurrentOffset + 1;
801  CurrentTargetKey.k_type = RFSD_KEY_TYPE_v2_DIRECT;
802 
803  // Perform the search
805  Vcb, &CurrentTargetKey,
806  &(pItemHeader), &(pItemBuffer), &(pBlockBuffer), &(BlockNumber),
807  &CompareKeys
808  );
809 
810  if (Status == STATUS_SUCCESS)
811  {
812  // If there was a second part of the tail, then build a block descriptor for it
813  pBdl[idxCurrentBD].Lba = (LONGLONG) BlockNumber * (LONGLONG) Vcb->BlockSize + pItemHeader->ih_item_location;
814  pBdl[idxCurrentBD].Length = pItemHeader->ih_item_len;
815  pBdl[idxCurrentBD].Offset = CurrentOffset;
816 
817  idxCurrentBD++;
818  }
819  else
820  {
821  if (Status == STATUS_NO_SUCH_MEMBER) { Status = STATUS_SUCCESS; } // If there wasn't a second part of the tail, it's fine
822  else { goto errorout; } // But if there was some other problem, let's report it.
823  }
824  }
825 
826 errorout:
827  if (pBlockBuffer) { ExFreePool(pBlockBuffer); pBlockBuffer = NULL; }
828 
829  *out_ppBdl = pBdl;
830  *out_Count = idxCurrentBD;
831  return Status;
832 }
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NO_SUCH_MEMBER
Definition: ntstatus.h:597
ULONG Length
Definition: rfsd.h:833
__u16 ih_free_space_reserved
Definition: reiserfs_fs.h:530
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
#define RFSD_POOL_TAG
Definition: rfsd.h:99
NTSTATUS RfsdLoadItem(IN PRFSD_VCB Vcb, IN PRFSD_KEY_IN_MEMORY pItemKey, OUT PRFSD_ITEM_HEAD *ppMatchingItemHeader, OUT PUCHAR *ppItemBuffer, OUT PUCHAR *ppBlockBuffer, OUT PULONG pBlockNumber, IN RFSD_KEY_COMPARISON(*fpComparisonFunction)(PRFSD_KEY_IN_MEMORY, PRFSD_KEY_IN_MEMORY))
ULONGLONG Offset
Definition: rfsd.h:832
#define PAGED_CODE()
Definition: video.h:57
ULONGLONG Lba
Definition: rfsd.h:831
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
__u16 ih_item_location
Definition: reiserfs_fs.h:536
union item_head::@750 u
int64_t LONGLONG
Definition: typedefs.h:66
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
__u16 ih_item_len
Definition: reiserfs_fs.h:535
uint64_t ULONGLONG
Definition: typedefs.h:65
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned int * PULONG
Definition: retypes.h:1
RFSD_KEY_COMPARISON CompareKeys(IN PRFSD_KEY_IN_MEMORY a, IN PRFSD_KEY_IN_MEMORY b)
Definition: rfsd.c:2856
#define RFSD_KEY_TYPE_v2_DIRECT
Definition: reiserfs.h:284
unsigned int ULONG
Definition: retypes.h:1
#define RFSD_KEY_TYPE_v2_INDIRECT
Definition: reiserfs.h:283
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define KdPrint(x)
Definition: env_spec_w32.h:288
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by RfsdReadInode().

◆ RfsdBuildRequest()

NTSTATUS NTAPI RfsdBuildRequest ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Referenced by DriverEntry().

◆ RfsdCheckBitmapConsistency()

BOOLEAN RfsdCheckBitmapConsistency ( PRFSD_IRP_CONTEXT  IrpContext,
PRFSD_VCB  Vcb 
)

Definition at line 1208 of file memory.c.

1209 {
1210  ULONG i, j, InodeBlocks;
1211 
1212  PAGED_CODE();
1213 #if 0
1214  for (i = 0; i < Vcb->NumOfGroups; i++) {
1215 
1216  RfsdCheckSetBlock(IrpContext, Vcb, Vcb->GroupDesc[i].bg_block_bitmap);
1217  RfsdCheckSetBlock(IrpContext, Vcb, Vcb->GroupDesc[i].bg_inode_bitmap);
1218 
1219 
1220  if (i == Vcb->NumOfGroups - 1) {
1221  InodeBlocks = ((INODES_COUNT % INODES_PER_GROUP) *
1222  sizeof(RFSD_INODE) + Vcb->BlockSize - 1) /
1223  (Vcb->BlockSize);
1224  } else {
1225  InodeBlocks = (INODES_PER_GROUP * sizeof(RFSD_INODE) + Vcb->BlockSize - 1) / (Vcb->BlockSize);
1226  }
1227 
1228  for (j = 0; j < InodeBlocks; j++ )
1229  RfsdCheckSetBlock(IrpContext, Vcb, Vcb->GroupDesc[i].bg_inode_table + j);
1230  }
1231 #endif // 0
1232  return TRUE;
1233 }
#define TRUE
Definition: types.h:120
#define PAGED_CODE()
Definition: video.h:57
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
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 GLint GLint j
Definition: glfuncs.h:250
#define Vcb
Definition: cdprocs.h:1425
unsigned int ULONG
Definition: retypes.h:1
#define INODES_PER_GROUP
Definition: ext2fs.h:99
#define INODES_COUNT
Definition: ext2fs.h:97
BOOLEAN RfsdCheckSetBlock(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Block)
Definition: memory.c:1131
struct stat_data RFSD_INODE
Definition: rfsd.h:33

Referenced by RfsdInitializeVcb().

◆ RfsdCheckDismount()

BOOLEAN RfsdCheckDismount ( IN PRFSD_IRP_CONTEXT  IrpContext,
IN PRFSD_VCB  Vcb,
IN BOOLEAN  bForce 
)

Definition at line 1010 of file fsctl.c.

1014 {
1015  KIRQL Irql;
1016  PVPB Vpb = Vcb->Vpb;
1017  BOOLEAN bDeleted = FALSE;
1018  ULONG UnCleanCount = 0;
1019 
1020  PAGED_CODE();
1021 
1023  &RfsdGlobal->Resource, TRUE );
1024 
1026  &Vcb->MainResource, TRUE );
1027 
1028  if ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
1029  (IrpContext->RealDevice == Vcb->RealDevice)) {
1030  UnCleanCount = 3;
1031  } else {
1032  UnCleanCount = 2;
1033  }
1034 
1036 
1037  if ((Vpb->ReferenceCount == UnCleanCount) || bForce) {
1038 
1039  if ((Vpb->ReferenceCount != UnCleanCount) && bForce) {
1040  KdPrint(("RfsdCheckDismount: force dismount ...\n"));
1041  }
1042 
1043  ClearFlag( Vpb->Flags, VPB_MOUNTED );
1044  ClearFlag( Vpb->Flags, VPB_LOCKED );
1045 
1046 #ifdef _MSC_VER
1047 #pragma prefast( suppress: 28175, "allowed in file system drivers" )
1048 #endif
1049  if ((Vcb->RealDevice != Vpb->RealDevice) &&
1050  (Vcb->RealDevice->Vpb == Vpb)) {
1051  SetFlag( Vcb->RealDevice->Flags, DO_DEVICE_INITIALIZING );
1052  SetFlag( Vpb->Flags, VPB_PERSISTENT );
1053  }
1054 
1055  RfsdRemoveVcb(Vcb);
1056 
1057  ClearFlag(Vpb->Flags, VPB_MOUNTED);
1058  SetFlag(Vcb->Flags, VCB_DISMOUNT_PENDING);
1059 
1060  Vpb->DeviceObject = NULL;
1061 
1062  bDeleted = TRUE;
1063  }
1064 
1066 
1068  &Vcb->MainResource,
1070 
1072  &RfsdGlobal->Resource,
1074 
1075  if (bDeleted) {
1076  KdPrint(("RfsdCheckDismount: now free the vcb ...\n"));
1077  RfsdFreeVcb(Vcb);
1078  }
1079 
1080  return bDeleted;
1081 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
Definition: volume.c:1209
#define VPB_PERSISTENT
Definition: iotypes.h:1766
_Out_ PKIRQL Irql
Definition: csq.h:179
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define VPB_LOCKED
Definition: iotypes.h:1765
VOID RfsdFreeVcb(IN PRFSD_VCB Vcb)
Definition: memory.c:1581
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID RfsdRemoveVcb(PRFSD_VCB Vcb)
Definition: memory.c:1244
#define Vcb
Definition: cdprocs.h:1425
ERESOURCE Resource
Definition: rfsd.h:388
#define VCB_DISMOUNT_PENDING
Definition: ext2fs.h:782
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
Definition: iotypes.h:166
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
#define VPB_MOUNTED
Definition: iotypes.h:1764
#define KdPrint(x)
Definition: env_spec_w32.h:288
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
Definition: volume.c:1220
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664

Referenced by RfsdDismountVolume(), and RfsdInvalidateVolumes().

◆ RfsdCheckSetBlock()

BOOLEAN RfsdCheckSetBlock ( PRFSD_IRP_CONTEXT  IrpContext,
PRFSD_VCB  Vcb,
ULONG  Block 
)

Definition at line 1131 of file memory.c.

1132 {
1133  ULONG Group, dwBlk, Length;
1134 
1135  RTL_BITMAP BlockBitmap;
1136  PVOID BitmapCache;
1137  PBCB BitmapBcb;
1138 
1140 
1141  BOOLEAN bModified = FALSE;
1142 
1143  PAGED_CODE();
1144 #if 0
1146 
1147  dwBlk = (Block - RFSD_FIRST_DATA_BLOCK) % BLOCKS_PER_GROUP;
1148 
1149 
1150  Offset.QuadPart = (LONGLONG) Vcb->BlockSize;
1151  Offset.QuadPart = Offset.QuadPart * Vcb->GroupDesc[Group].bg_block_bitmap;
1152 
1153  if (Group == Vcb->NumOfGroups - 1) {
1155 
1156  /* s_blocks_count is integer multiple of s_blocks_per_group */
1157  if (Length == 0)
1159  } else {
1161  }
1162 
1163  if (dwBlk >= Length)
1164  return FALSE;
1165 
1166  if (!CcPinRead( Vcb->StreamObj,
1167  &Offset,
1168  Vcb->BlockSize,
1169  PIN_WAIT,
1170  &BitmapBcb,
1171  &BitmapCache ) ) {
1172 
1173  RfsdPrint((DBG_ERROR, "RfsdDeleteBlock: PinReading error ...\n"));
1174  return FALSE;
1175  }
1176 
1177  RtlInitializeBitMap( &BlockBitmap,
1178  BitmapCache,
1179  Length );
1180 
1181  if (RtlCheckBit(&BlockBitmap, dwBlk) == 0) {
1182  DbgBreak();
1183  RtlSetBits(&BlockBitmap, dwBlk, 1);
1184  bModified = TRUE;
1185  }
1186 
1187  if (bModified) {
1188 
1189  CcSetDirtyPinnedData(BitmapBcb, NULL );
1190 
1191  RfsdRepinBcb(IrpContext, BitmapBcb);
1192 
1193  RfsdAddMcbEntry(Vcb, Offset.QuadPart, (LONGLONG)Vcb->BlockSize);
1194  }
1195 
1196  {
1197  CcUnpinData(BitmapBcb);
1198  BitmapBcb = NULL;
1199  BitmapCache = NULL;
1200 
1201  RtlZeroMemory(&BlockBitmap, sizeof(RTL_BITMAP));
1202  }
1203 #endif // 0
1204  return (!bModified);
1205 }
#define TRUE
Definition: types.h:120
NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP, PULONG, ULONG)
VOID NTAPI CcSetDirtyPinnedData(IN PVOID BcbVoid, IN OPTIONAL PLARGE_INTEGER Lsn)
Definition: cachesub.c:121
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
VOID RfsdRepinBcb(IN PRFSD_IRP_CONTEXT IrpContext, IN PBCB Bcb)
Definition: memory.c:232
BOOLEAN RfsdAddMcbEntry(IN PRFSD_VCB Vcb, IN LONGLONG Lba, IN LONGLONG Length)
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pinsup.c:955
#define RFSD_FIRST_DATA_BLOCK
Definition: rfsd.h:126
#define PIN_WAIT
#define RtlCheckBit(BMH, BP)
Definition: rtlfuncs.h:3154
#define PAGED_CODE()
Definition: video.h:57
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define TOTAL_BLOCKS
Definition: ext2fs.h:101
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
int64_t LONGLONG
Definition: typedefs.h:66
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pinsup.c:802
#define RfsdPrint(arg)
Definition: rfsd.h:1069
#define DBG_ERROR
Definition: ffsdrv.h:1031
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define DbgBreak()
Definition: ext2fs.h:46
NTSYSAPI void WINAPI RtlSetBits(PRTL_BITMAP, ULONG, ULONG)
#define BLOCKS_PER_GROUP
Definition: ext2fs.h:100

Referenced by RfsdCheckBitmapConsistency().

◆ RfsdCleanup()

NTSTATUS RfsdCleanup ( IN PRFSD_IRP_CONTEXT  IrpContext)

Definition at line 27 of file cleanup.c.