https://git.reactos.org/?p=reactos.git;a=commitdiff;h=632fa1cfbe32dbcc1f97d…
commit 632fa1cfbe32dbcc1f97dc96c9d6374cacf94ac7
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Sun Jul 25 11:37:02 2021 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sat Jul 31 17:23:05 2021 +0200
[NTOS:SE] Handle the reference logon session of the token
When creating or duplicating an access token object, make sure that the logon session is getting referenced by the token must be inserted onto the logon reference member (a.k.a LogonSession) for proper logon session referencing tracking.
Also when a token object is about to be destroyed or that we are taking away a reference session from it, we must ensure that the referenced logon session data gets removed from the token in question.
CORE-17700
---
ntoskrnl/se/token.c | 47 ++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/ntoskrnl/se/token.c b/ntoskrnl/se/token.c
index a7b004ae034..46dbb725a89 100644
--- a/ntoskrnl/se/token.c
+++ b/ntoskrnl/se/token.c
@@ -865,6 +865,15 @@ SepDuplicateToken(
goto Quit;
}
+ /* Insert the referenced logon session into the token */
+ Status = SepRmInsertLogonSessionIntoToken(AccessToken);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Failed to insert the logon session into the token, bail out */
+ DPRINT1("SepRmInsertLogonSessionIntoToken() failed (Status 0x%lx)\n", Status);
+ goto Quit;
+ }
+
/* Assign the data that reside in the TOKEN's variable information area */
AccessToken->VariableLength = VariableLength;
EndMem = (PVOID)&AccessToken->VariablePart;
@@ -1164,10 +1173,23 @@ VOID
NTAPI
SepDeleteToken(PVOID ObjectBody)
{
+ NTSTATUS Status;
PTOKEN AccessToken = (PTOKEN)ObjectBody;
DPRINT("SepDeleteToken()\n");
+ /* Remove the referenced logon session from token */
+ if (AccessToken->LogonSession)
+ {
+ Status = SepRmRemoveLogonSessionFromToken(AccessToken);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Something seriously went wrong */
+ DPRINT1("SepDeleteToken(): Failed to remove the logon session from token (Status: 0x%lx)\n", Status);
+ return;
+ }
+ }
+
/* Dereference the logon session */
if ((AccessToken->TokenFlags & TOKEN_SESSION_NOT_REFERENCED) == 0)
SepRmDereferenceLogonSession(&AccessToken->AuthenticationId);
@@ -1359,6 +1381,15 @@ SepCreateToken(
goto Quit;
}
+ /* Insert the referenced logon session into the token */
+ Status = SepRmInsertLogonSessionIntoToken(AccessToken);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Failed to insert the logon session into the token, bail out */
+ DPRINT1("SepRmInsertLogonSessionIntoToken() failed (Status 0x%lx)\n", Status);
+ goto Quit;
+ }
+
/* Assign the data that reside in the TOKEN's variable information area */
AccessToken->VariableLength = VariableLength;
EndMem = (PVOID)&AccessToken->VariablePart;
@@ -3299,14 +3330,20 @@ NtSetInformationToken(
if (OldTokenFlags == Token->TokenFlags)
SessionReference = ULONG_MAX;
+ /*
+ * Otherwise if the flag was never set but just for this first time then
+ * remove the referenced logon session data from the token and dereference
+ * the logon session when needed.
+ */
+ if (SessionReference == 0)
+ {
+ SepRmRemoveLogonSessionFromToken(Token);
+ SepRmDereferenceLogonSession(&Token->AuthenticationId);
+ }
+
/* Unlock the token */
SepReleaseTokenLock(Token);
}
-
- /* Dereference the logon session if needed */
- if (SessionReference == 0)
- SepRmDereferenceLogonSession(&Token->AuthenticationId);
-
break;
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5e51f8dad27aff23dfde8…
commit 5e51f8dad27aff23dfde80d4abdfb4c961593063
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Sun Jul 25 11:34:45 2021 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sat Jul 31 16:11:03 2021 +0200
[NTOS:SE] Implement logon reference insertion/removal to tokens
---
ntoskrnl/include/internal/se.h | 12 ++++
ntoskrnl/se/srm.c | 152 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 158 insertions(+), 6 deletions(-)
diff --git a/ntoskrnl/include/internal/se.h b/ntoskrnl/include/internal/se.h
index aa01ef58088..98c1b9e1057 100644
--- a/ntoskrnl/include/internal/se.h
+++ b/ntoskrnl/include/internal/se.h
@@ -353,6 +353,18 @@ SepCreateImpersonationTokenDacl(
_Out_ PACL* Dacl
);
+NTSTATUS
+NTAPI
+SepRmInsertLogonSessionIntoToken(
+ _Inout_ PTOKEN Token
+);
+
+NTSTATUS
+NTAPI
+SepRmRemoveLogonSessionFromToken(
+ _Inout_ PTOKEN Token
+);
+
CODE_SEG("INIT")
VOID
NTAPI
diff --git a/ntoskrnl/se/srm.c b/ntoskrnl/se/srm.c
index 23fa3b02120..90809a907e1 100644
--- a/ntoskrnl/se/srm.c
+++ b/ntoskrnl/se/srm.c
@@ -1,11 +1,10 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/se/srm.c
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Security Reference Monitor Server
- *
- * PROGRAMMERS: Timo Kreuzer (timo.kreuzer(a)reactos.org)
- * Pierre Schweitzer (pierre(a)reactos.org)
+ * COPYRIGHT: Copyright Timo Kreuzer <timo.kreuzer(a)reactos.org>
+ * Copyright Pierre Schweitzer <pierre(a)reactos.org>
+ * Copyright 2021 George Bișoc <george.bisoc(a)reactos.org>
*/
/* INCLUDES *******************************************************************/
@@ -315,6 +314,147 @@ SepRmSetAuditEvent(
return STATUS_SUCCESS;
}
+/**
+ * @brief
+ * Inserts a logon session into an access token specified by the
+ * caller.
+ *
+ * @param[in,out] Token
+ * An access token where the logon session is about to be inserted
+ * in.
+ *
+ * @return
+ * STATUS_SUCCESS is returned if the logon session has been inserted into
+ * the token successfully. STATUS_NO_SUCH_LOGON_SESSION is returned when no logon
+ * session has been found with the matching ID of the token and as such
+ * we've failed to add the logon session to the token. STATUS_INSUFFICIENT_RESOURCES
+ * is returned if memory pool allocation for the new session has failed.
+ */
+NTSTATUS
+NTAPI
+SepRmInsertLogonSessionIntoToken(
+ _Inout_ PTOKEN Token)
+{
+ PSEP_LOGON_SESSION_REFERENCES LogonSession;
+ PAGED_CODE();
+
+ /* Ensure that our token is not some plain garbage */
+ ASSERT(Token);
+
+ /* Acquire the database lock */
+ KeAcquireGuardedMutex(&SepRmDbLock);
+
+ for (LogonSession = SepLogonSessions;
+ LogonSession != NULL;
+ LogonSession = LogonSession->Next)
+ {
+ /*
+ * The insertion of a logon session into the token has to be done
+ * only IF the authentication ID of the token matches with the ID
+ * of the logon itself.
+ */
+ if (RtlEqualLuid(&LogonSession->LogonId, &Token->AuthenticationId))
+ {
+ break;
+ }
+ }
+
+ /* If we reach this then we cannot proceed further */
+ if (LogonSession == NULL)
+ {
+ DPRINT1("SepRmInsertLogonSessionIntoToken(): Couldn't insert the logon session into the specific access token!\n");
+ KeReleaseGuardedMutex(&SepRmDbLock);
+ return STATUS_NO_SUCH_LOGON_SESSION;
+ }
+
+ /*
+ * Allocate the session that we are going
+ * to insert it to the token.
+ */
+ Token->LogonSession = ExAllocatePoolWithTag(PagedPool,
+ sizeof(SEP_LOGON_SESSION_REFERENCES),
+ TAG_LOGON_SESSION);
+ if (Token->LogonSession == NULL)
+ {
+ DPRINT1("SepRmInsertLogonSessionIntoToken(): Couldn't allocate new logon session into the memory pool!\n");
+ KeReleaseGuardedMutex(&SepRmDbLock);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /*
+ * Begin copying the logon session references data from the
+ * session whose ID matches with the token authentication ID to
+ * the new session we've allocated blocks of pool memory for it.
+ */
+ Token->LogonSession->Next = LogonSession->Next;
+ Token->LogonSession->LogonId = LogonSession->LogonId;
+ Token->LogonSession->ReferenceCount = LogonSession->ReferenceCount;
+ Token->LogonSession->Flags = LogonSession->Flags;
+ Token->LogonSession->pDeviceMap = LogonSession->pDeviceMap;
+ InsertHeadList(&LogonSession->TokenList, &Token->LogonSession->TokenList);
+
+ /* Release the database lock and we're done */
+ KeReleaseGuardedMutex(&SepRmDbLock);
+ return STATUS_SUCCESS;
+}
+
+/**
+ * @brief
+ * Removes a logon session from an access token.
+ *
+ * @param[in,out] Token
+ * An access token whose logon session is to be removed from it.
+ *
+ * @return
+ * STATUS_SUCCESS is returned if the logon session has been removed from
+ * the token successfully. STATUS_NO_SUCH_LOGON_SESSION is returned when no logon
+ * session has been found with the matching ID of the token and as such
+ * we've failed to remove the logon session from the token.
+ */
+NTSTATUS
+NTAPI
+SepRmRemoveLogonSessionFromToken(
+ _Inout_ PTOKEN Token)
+{
+ PSEP_LOGON_SESSION_REFERENCES LogonSession;
+ PAGED_CODE();
+
+ /* Ensure that our token is not some plain garbage */
+ ASSERT(Token);
+
+ /* Acquire the database lock */
+ KeAcquireGuardedMutex(&SepRmDbLock);
+
+ for (LogonSession = SepLogonSessions;
+ LogonSession != NULL;
+ LogonSession = LogonSession->Next)
+ {
+ /*
+ * Remove the logon session only when the IDs of the token and the
+ * logon match.
+ */
+ if (RtlEqualLuid(&LogonSession->LogonId, &Token->AuthenticationId))
+ {
+ break;
+ }
+ }
+
+ /* They don't match */
+ if (LogonSession == NULL)
+ {
+ DPRINT1("SepRmRemoveLogonSessionFromToken(): Couldn't remove the logon session from the access token!\n");
+ KeReleaseGuardedMutex(&SepRmDbLock);
+ return STATUS_NO_SUCH_LOGON_SESSION;
+ }
+
+ /* Now it's time to delete the logon session from the token */
+ RemoveEntryList(&Token->LogonSession->TokenList);
+ ExFreePoolWithTag(Token->LogonSession, TAG_LOGON_SESSION);
+
+ /* Release the database lock and we're done */
+ KeReleaseGuardedMutex(&SepRmDbLock);
+ return STATUS_SUCCESS;
+}
static
NTSTATUS
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=49cfac17c59fd9d8bfe04…
commit 49cfac17c59fd9d8bfe04c6ec9cbd8c447c53b03
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Fri Jul 23 19:20:10 2021 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Fri Jul 30 17:14:57 2021 +0300
[FFS] Remove the FFS/UFS driver
The upstream driver is not maintained and the file system itself
is in a semi-abandoned state.
Originally imported at 3a3ef631d12d8ac7ee2a95abf8c1c6e4815ac1a5
The driver is written by Lee Jae-Hong, updated by Bo Brantén.
ReactOS porting made by Peter Hater and Pierre Schweitzer.
Follow updates at http://www.acc.umu.se/~bosse/
FS Recognizer code is left to keep the FS support as an
installable driver.
CORE-11040
---
CODEOWNERS | 1 -
base/setup/lib/bootsup.c | 3 +-
base/setup/lib/fsutil.c | 1 -
base/setup/lib/utils/fsrec.c | 3 +-
base/system/autochk/CMakeLists.txt | 2 +-
base/system/autochk/autochk.c | 2 -
boot/bootdata/hivesys.inf | 7 -
dll/win32/CMakeLists.txt | 1 -
dll/win32/uffs/CMakeLists.txt | 13 -
dll/win32/uffs/uffs.c | 22 -
dll/win32/uffs/uffs.rc | 5 -
dll/win32/uffs/uffs.spec | 2 -
drivers/filesystems/CMakeLists.txt | 1 -
drivers/filesystems/ffs/CMakeLists.txt | 51 -
drivers/filesystems/ffs/inc/bootblock.h | 892 ---------
drivers/filesystems/ffs/inc/dinode.h | 177 --
drivers/filesystems/ffs/inc/dir.h | 162 --
drivers/filesystems/ffs/inc/disklabel.h | 555 ------
drivers/filesystems/ffs/inc/ffsdrv.h | 2178 ----------------------
drivers/filesystems/ffs/inc/fs.h | 697 -------
drivers/filesystems/ffs/inc/type.h | 22 -
drivers/filesystems/ffs/src/block.c | 689 -------
drivers/filesystems/ffs/src/cleanup.c | 380 ----
drivers/filesystems/ffs/src/close.c | 342 ----
drivers/filesystems/ffs/src/cmcb.c | 218 ---
drivers/filesystems/ffs/src/create.c | 2055 ---------------------
drivers/filesystems/ffs/src/debug.c | 1780 ------------------
drivers/filesystems/ffs/src/devctl.c | 302 ---
drivers/filesystems/ffs/src/dirctl.c | 1372 --------------
drivers/filesystems/ffs/src/dispatch.c | 252 ---
drivers/filesystems/ffs/src/except.c | 210 ---
drivers/filesystems/ffs/src/fastio.c | 1146 ------------
drivers/filesystems/ffs/src/ffs.c | 3042 -------------------------------
drivers/filesystems/ffs/src/ffsdrv.rc | 112 --
drivers/filesystems/ffs/src/fileinfo.c | 1789 ------------------
drivers/filesystems/ffs/src/flush.c | 312 ----
drivers/filesystems/ffs/src/fsctl.c | 1679 -----------------
drivers/filesystems/ffs/src/init.c | 453 -----
drivers/filesystems/ffs/src/lock.c | 137 --
drivers/filesystems/ffs/src/memory.c | 1979 --------------------
drivers/filesystems/ffs/src/misc.c | 128 --
drivers/filesystems/ffs/src/pnp.c | 463 -----
drivers/filesystems/ffs/src/read.c | 1155 ------------
drivers/filesystems/ffs/src/shutdown.c | 140 --
drivers/filesystems/ffs/src/volinfo.c | 478 -----
drivers/filesystems/ffs/src/write.c | 1588 ----------------
media/doc/3rd Party Files.txt | 6 -
sdk/cmake/baseaddress.cmake | 1 -
sdk/cmake/baseaddress_dwarf.cmake | 1 -
sdk/cmake/baseaddress_msvc.cmake | 1 -
sdk/cmake/baseaddress_msvc_x64.cmake | 1 -
sdk/include/reactos/libs/fslib/ffslib.h | 39 -
sdk/lib/fslib/CMakeLists.txt | 1 -
sdk/lib/fslib/ffslib/CMakeLists.txt | 3 -
sdk/lib/fslib/ffslib/ffslib.c | 49 -
55 files changed, 3 insertions(+), 27097 deletions(-)
diff --git a/CODEOWNERS b/CODEOWNERS
index 736ee9ce6aa..13d3ad435c6 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -267,7 +267,6 @@
/drivers/filesystems/cdfs/ @HeisSpiter
/drivers/filesystems/ext2/ @HeisSpiter
/drivers/filesystems/fastfat_new/ @HeisSpiter
-/drivers/filesystems/ffs/ @HeisSpiter
/drivers/filesystems/nfs/ @HeisSpiter
/media/doc/README.FSD @HeisSpiter
/sdk/lib/fslib/btrfslib/ @HeisSpiter
diff --git a/base/setup/lib/bootsup.c b/base/setup/lib/bootsup.c
index 3aefff04ee4..e8d6c884bff 100644
--- a/base/setup/lib/bootsup.c
+++ b/base/setup/lib/bootsup.c
@@ -1260,8 +1260,7 @@ InstallVBRToPartition(
/*
else if (wcsicmp(FileSystemName, L"EXT2") == 0 ||
wcsicmp(FileSystemName, L"EXT3") == 0 ||
- wcsicmp(FileSystemName, L"EXT4") == 0 ||
- wcsicmp(FileSystemName, L"FFS") == 0)
+ wcsicmp(FileSystemName, L"EXT4") == 0)
{
return STATUS_NOT_SUPPORTED;
}
diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c
index fde965c89cf..8ef241ece05 100644
--- a/base/setup/lib/fsutil.c
+++ b/base/setup/lib/fsutil.c
@@ -142,7 +142,6 @@ static FILE_SYSTEM RegisteredFileSystems[] =
{ L"EXT2" , Ext2Format, Ext2Chkdsk },
{ L"EXT3" , Ext2Format, Ext2Chkdsk },
{ L"EXT4" , Ext2Format, Ext2Chkdsk },
- { L"FFS" , FfsFormat , FfsChkdsk },
#endif
};
diff --git a/base/setup/lib/utils/fsrec.c b/base/setup/lib/utils/fsrec.c
index 6011ef4107f..2b383f0b99b 100644
--- a/base/setup/lib/utils/fsrec.c
+++ b/base/setup/lib/utils/fsrec.c
@@ -392,8 +392,7 @@ FileSystemToMBRPartitionType(
else if (wcsicmp(FileSystem, L"BTRFS") == 0 ||
wcsicmp(FileSystem, L"EXT2") == 0 ||
wcsicmp(FileSystem, L"EXT3") == 0 ||
- wcsicmp(FileSystem, L"EXT4") == 0 ||
- wcsicmp(FileSystem, L"FFS") == 0)
+ wcsicmp(FileSystem, L"EXT4") == 0)
{
return PARTITION_LINUX;
}
diff --git a/base/system/autochk/CMakeLists.txt b/base/system/autochk/CMakeLists.txt
index f7448ee585d..eb73cc411a9 100644
--- a/base/system/autochk/CMakeLists.txt
+++ b/base/system/autochk/CMakeLists.txt
@@ -1,6 +1,6 @@
add_executable(autochk WIN32 autochk.c autochk.rc)
set_module_type(autochk nativecui)
-target_link_libraries(autochk nt vfatlib vfatxlib ntfslib btrfslib ext2lib ffslib cdfslib)
+target_link_libraries(autochk nt vfatlib vfatxlib ntfslib btrfslib ext2lib cdfslib)
add_importlibs(autochk ntdll)
add_cd_file(TARGET autochk DESTINATION reactos/system32 FOR all)
diff --git a/base/system/autochk/autochk.c b/base/system/autochk/autochk.c
index 8f2a7a427bf..8983668064e 100644
--- a/base/system/autochk/autochk.c
+++ b/base/system/autochk/autochk.c
@@ -31,7 +31,6 @@
#include <fslib/ntfslib.h>
#include <fslib/btrfslib.h>
#include <fslib/ext2lib.h>
-#include <fslib/ffslib.h>
#include <fslib/cdfslib.h>
#define NDEBUG
@@ -55,7 +54,6 @@ FILESYSTEM_CHKDSK FileSystems[] =
{ L"EXT2", Ext2Chkdsk },
{ L"EXT3", Ext2Chkdsk },
{ L"EXT4", Ext2Chkdsk },
- { L"FFS", FfsChkdsk },
{ L"CDFS", CdfsChkdsk },
};
diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf
index c041a0b379e..86ef5028507 100644
--- a/boot/bootdata/hivesys.inf
+++ b/boot/bootdata/hivesys.inf
@@ -2197,13 +2197,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\btrfs","ImagePath",0x00020000,"system32\
HKLM,"SYSTEM\CurrentControlSet\Services\btrfs","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\btrfs","Type",0x00010001,0x00000002
-; FFS Filesystem driver
-HKLM,"SYSTEM\CurrentControlSet\Services\ffs","ErrorControl",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\ffs","Group",0x00000000,"Boot File System"
-HKLM,"SYSTEM\CurrentControlSet\Services\ffs","ImagePath",0x00020000,"system32\drivers\ffs.sys"
-HKLM,"SYSTEM\CurrentControlSet\Services\ffs","Start",0x00010001,0x00000003
-HKLM,"SYSTEM\CurrentControlSet\Services\ffs","Type",0x00010001,0x00000002
-
; NFS Filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\nfs41_driver","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\nfs41_driver","Group",0x00000000,"Network"
diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt
index e60d18bed0c..c0238ebeea5 100644
--- a/dll/win32/CMakeLists.txt
+++ b/dll/win32/CMakeLists.txt
@@ -214,7 +214,6 @@ add_subdirectory(ucdfs)
add_subdirectory(uext2)
add_subdirectory(ufat)
add_subdirectory(ufatx)
-add_subdirectory(uffs)
add_subdirectory(untfs)
add_subdirectory(updspapi)
add_subdirectory(url)
diff --git a/dll/win32/uffs/CMakeLists.txt b/dll/win32/uffs/CMakeLists.txt
deleted file mode 100644
index 2bc8f14e2f2..00000000000
--- a/dll/win32/uffs/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-spec2def(uffs.dll uffs.spec)
-
-list(APPEND SOURCE
- uffs.c
- uffs.rc
- ${CMAKE_CURRENT_BINARY_DIR}/uffs.def)
-
-add_library(uffs MODULE ${SOURCE})
-set_module_type(uffs nativedll)
-target_link_libraries(uffs ffslib)
-add_importlibs(uffs ntdll)
-add_cd_file(TARGET uffs DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/uffs/uffs.c b/dll/win32/uffs/uffs.c
deleted file mode 100644
index 96b4409ffc0..00000000000
--- a/dll/win32/uffs/uffs.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: FFS File System Management
- * FILE: dll/win32/uffs/uffs.c
- * PURPOSE: uffs DLL initialisation
- * PROGRAMMERS: Pierre Schweitzer
- */
-
-#include <windef.h>
-
-INT WINAPI
-DllMain(
- IN HINSTANCE hinstDLL,
- IN DWORD dwReason,
- IN LPVOID lpvReserved)
-{
- UNREFERENCED_PARAMETER(hinstDLL);
- UNREFERENCED_PARAMETER(dwReason);
- UNREFERENCED_PARAMETER(lpvReserved);
-
- return TRUE;
-}
diff --git a/dll/win32/uffs/uffs.rc b/dll/win32/uffs/uffs.rc
deleted file mode 100644
index f2ec4ceabe2..00000000000
--- a/dll/win32/uffs/uffs.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-#define REACTOS_VERSION_DLL
-#define REACTOS_STR_FILE_DESCRIPTION "FFS File System Management"
-#define REACTOS_STR_INTERNAL_NAME "uffs"
-#define REACTOS_STR_ORIGINAL_FILENAME "uffs.dll"
-#include <reactos/version.rc>
diff --git a/dll/win32/uffs/uffs.spec b/dll/win32/uffs/uffs.spec
deleted file mode 100644
index f06e34356a9..00000000000
--- a/dll/win32/uffs/uffs.spec
+++ /dev/null
@@ -1,2 +0,0 @@
-@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) FfsChkdsk
-@ stdcall Format(ptr ptr long long long ptr long) FfsFormat
diff --git a/drivers/filesystems/CMakeLists.txt b/drivers/filesystems/CMakeLists.txt
index 74372075bf7..471a7d873f5 100644
--- a/drivers/filesystems/CMakeLists.txt
+++ b/drivers/filesystems/CMakeLists.txt
@@ -4,7 +4,6 @@ add_subdirectory(cdfs)
add_subdirectory(ext2)
#add_subdirectory(fastfat)
add_subdirectory(fastfat_new)
-add_subdirectory(ffs)
add_subdirectory(fs_rec)
add_subdirectory(msfs)
add_subdirectory(mup)
diff --git a/drivers/filesystems/ffs/CMakeLists.txt b/drivers/filesystems/ffs/CMakeLists.txt
deleted file mode 100644
index 9d5670aaa56..00000000000
--- a/drivers/filesystems/ffs/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-include_directories(${REACTOS_SOURCE_DIR}/include/reactos/drivers
- inc)
-
-list(APPEND SOURCE
- src/block.c
- src/cleanup.c
- src/close.c
- src/cmcb.c
- src/create.c
- src/debug.c
- src/devctl.c
- src/dirctl.c
- src/dispatch.c
- src/except.c
- src/fastio.c
- src/ffs.c
- src/fileinfo.c
- src/flush.c
- src/fsctl.c
- src/init.c
- src/lock.c
- src/memory.c
- src/misc.c
- src/pnp.c
- src/read.c
- src/shutdown.c
- src/volinfo.c
- src/write.c
- inc/ffsdrv.h)
-
-add_library(ffs MODULE ${SOURCE} src/ffsdrv.rc)
-
-if(USE_CLANG_CL OR (NOT MSVC))
- target_compile_options(ffs PRIVATE -Wno-pointer-sign -Wno-unused-function)
- target_compile_options(ffs PRIVATE -Wno-unused-variable -Wno-missing-braces)
- if(USE_CLANG_CL)
- target_compile_options(ffs PRIVATE -Wno-empty-body)
- endif()
-endif()
-
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
- target_compile_options(ffs PRIVATE -Wno-unused-but-set-variable)
-endif()
-
-add_definitions(-D__KERNEL__)
-set_module_type(ffs kernelmodedriver)
-target_link_libraries(ffs memcmp ${PSEH_LIB})
-add_importlibs(ffs ntoskrnl hal)
-add_pch(ffs inc/ffsdrv.h SOURCE)
-add_cd_file(TARGET ffs DESTINATION reactos/system32/drivers FOR all)
-
diff --git a/drivers/filesystems/ffs/inc/bootblock.h b/drivers/filesystems/ffs/inc/bootblock.h
deleted file mode 100644
index f49b93fab01..00000000000
--- a/drivers/filesystems/ffs/inc/bootblock.h
+++ /dev/null
@@ -1,892 +0,0 @@
-/* $NetBSD: bootblock.h,v 1.24 2004/03/22 07:11:00 lukem Exp $ */
-
-/*-
- * Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*-
- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
- * Michael L. Finch, Bradley A. Grantham, and
- * Lawrence A. Kesteloot
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Alice Group.
- * 4. The names of the Alice Group or any of its members may not be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1994, 1999 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1994 Rolf Grossmann
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Rolf Grossmann.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SYS_BOOTBLOCK_H
-#define _SYS_BOOTBLOCK_H
-
-#include "type.h"
-
-#if 0 /* XXX ffsdrv */
-#if !defined(__ASSEMBLER__)
-#if defined(_KERNEL) || defined(_STANDALONE)
-#include <sys/stdint.h>
-#else
-#include <stdint.h>
-#endif
-#endif /* !defined(__ASSEMBLER__) */
-#endif
-
-/* ------------------------------------------
- * MBR (Master Boot Record) --
- * definitions for systems that use MBRs
- */
-
-/*
- * Layout of boot records:
- *
- * Byte range Use Description
- * ---------- --- -----------
- *
- * 0 - 2 FMP JMP xxx, NOP
- * 3 - 10 FP OEM Name
- *
- * 11 - 61 FMP FAT12/16 BPB
- * Whilst not strictly necessary for MBR,
- * GRUB reserves this area
- *
- * 11 - 89 P FAT32 BPB
- * (are we ever going to boot off this?)
- *
- *
- * 62 - 217 FMP Boot code
- *
- * 90 - 217 P FAT32 boot code
- *
- * 218 - 223 M Win95b/98/me "drive time"
- * http://www.geocities.com/thestarman3/asm/mbr/95BMEMBR.htm#MYST
- * only changed if all 6 bytes are 0
- *
- * 224 - 436 FMP boot code (continued)
- *
- * 437 - 439 M WinNT/2K/XP MBR "boot language"
- * http://www.geocities.com/thestarman3/asm/mbr/Win2kmbr.htm
- * not needed by us
- *
- * 400 - 439 MP NetBSD: mbr_bootsel
- *
- * 440 - 443 M WinNT/2K/XP Drive Serial Number (NT DSN)
- * http://www.geocities.com/thestarman3/asm/mbr/Win2kmbr.htm
- *
- * 444 - 445 FMP bootcode or unused
- * NetBSD: mbr_bootsel_magic
- *
- * 446 - 509 M partition table
- *
- * 510 - 511 FMP magic number (0xAA55)
- *
- * Use:
- * ----
- * F Floppy boot sector
- * M Master Boot Record
- * P Partition Boot record
- *
- */
-
-/*
- * MBR (Master Boot Record)
- */
-#define MBR_BBSECTOR 0 /* MBR relative sector # */
-#define MBR_BPB_OFFSET 11 /* offsetof(mbr_sector, mbr_bpb) */
-#define MBR_BOOTCODE_OFFSET 90 /* offsetof(mbr_sector, mbr_bootcode) */
-#define MBR_BS_OFFSET 400 /* offsetof(mbr_sector, mbr_bootsel) */
-#define MBR_DSN_OFFSET 440 /* offsetof(mbr_sector, mbr_dsn) */
-#define MBR_BS_MAGIC_OFFSET 444 /* offsetof(mbr_sector, mbr_bootsel_magic) */
-#define MBR_PART_OFFSET 446 /* offsetof(mbr_sector, mbr_part[0]) */
-#define MBR_MAGIC_OFFSET 510 /* offsetof(mbr_sector, mbr_magic) */
-#define MBR_MAGIC 0xaa55 /* MBR magic number */
-#define MBR_BS_MAGIC 0xb5e1 /* mbr_bootsel magic number */
-#define MBR_PART_COUNT 4 /* Number of partitions in MBR */
-#define MBR_BS_PARTNAMESIZE 8 /* Size of name mbr_bootsel nametab */
- /* (excluding trailing NUL) */
-
- /* values for mbr_partition.mbrp_flag */
-#define MBR_PFLAG_ACTIVE 0x80 /* The active partition */
-
- /* values for mbr_partition.mbrp_type */
-#define MBR_PTYPE_FAT12 0x01 /* 12-bit FAT */
-#define MBR_PTYPE_FAT16S 0x04 /* 16-bit FAT, less than 32M */
-#define MBR_PTYPE_EXT 0x05 /* extended partition */
-#define MBR_PTYPE_FAT16B 0x06 /* 16-bit FAT, more than 32M */
-#define MBR_PTYPE_NTFS 0x07 /* OS/2 HPFS, NTFS, QNX2, Adv. UNIX */
-#define MBR_PTYPE_FAT32 0x0b /* 32-bit FAT */
-#define MBR_PTYPE_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */
-#define MBR_PTYPE_FAT16L 0x0e /* 16-bit FAT, LBA-mapped */
-#define MBR_PTYPE_EXT_LBA 0x0f /* extended partition, LBA-mapped */
-#define MBR_PTYPE_ONTRACK 0x54
-#define MBR_PTYPE_LNXSWAP 0x82 /* Linux swap or Solaris */
-#define MBR_PTYPE_LNXEXT2 0x83 /* Linux native */
-#define MBR_PTYPE_EXT_LNX 0x85 /* Linux extended partition */
-#define MBR_PTYPE_NTFSVOL 0x87 /* NTFS volume set or HPFS mirrored */
-#define MBR_PTYPE_PREP 0x41 /* PReP */
-#define MBR_PTYPE_386BSD 0xa5 /* 386BSD partition type */
-#define MBR_PTYPE_APPLEUFS 0xa8 /* Apple UFS */
-#define MBR_PTYPE_NETBSD 0xa9 /* NetBSD partition type */
-#define MBR_PTYPE_OPENBSD 0xa6 /* OpenBSD partition type */
-
-#define MBR_PSECT(s) ((s) & 0x3f)
-#define MBR_PCYL(c, s) ((c) + (((s) & 0xc0) << 2))
-
-#define MBR_IS_EXTENDED(x) ((x) == MBR_PTYPE_EXT || \
- (x) == MBR_PTYPE_EXT_LBA || \
- (x) == MBR_PTYPE_EXT_LNX)
-
- /* values for mbr_bootsel.mbrbs_flags */
-#define MBR_BS_ACTIVE 0x01 /* Bootselector active (or code present) */
-#define MBR_BS_EXTINT13 0x02 /* Set by fdisk if LBA needed (deprecated) */
-#define MBR_BS_READ_LBA 0x04 /* Force LBA reads - even for low numbers */
-#define MBR_BS_EXTLBA 0x08 /* Extended ptn capable (LBA reads) */
-#define MBR_BS_NEWMBR 0x80 /* New bootsel at offset 440 */
-
-#if !defined(__ASSEMBLER__) /* { */
-
-#pragma pack(1)
-
-/*
- * (x86) BIOS Parameter Block for FAT12
- */
-struct mbr_bpbFAT12 {
- uint16_t bpbBytesPerSec; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint16_t bpbResSectors; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint16_t bpbRootDirEnts; /* number of root directory entries */
- uint16_t bpbSectors; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint16_t bpbFATsecs; /* number of sectors per FAT */
- uint16_t bpbSecPerTrack; /* sectors per track */
- uint16_t bpbHeads; /* number of heads */
- uint16_t bpbHiddenSecs; /* # of hidden sectors */
-}; /* __attribute__((__packed__)); */
-
-/*
- * (x86) BIOS Parameter Block for FAT16
- */
-struct mbr_bpbFAT16 {
- uint16_t bpbBytesPerSec; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint16_t bpbResSectors; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint16_t bpbRootDirEnts; /* number of root directory entries */
- uint16_t bpbSectors; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint16_t bpbFATsecs; /* number of sectors per FAT */
- uint16_t bpbSecPerTrack; /* sectors per track */
- uint16_t bpbHeads; /* number of heads */
- uint32_t bpbHiddenSecs; /* # of hidden sectors */
- uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
- uint8_t bsDrvNum; /* Int 0x13 drive number (e.g. 0x80) */
- uint8_t bsReserved1; /* Reserved; set to 0 */
- uint8_t bsBootSig; /* 0x29 if next 3 fields are present */
- uint8_t bsVolID[4]; /* Volume serial number */
- uint8_t bsVolLab[11]; /* Volume label */
- uint8_t bsFileSysType[8];
- /* "FAT12 ", "FAT16 ", "FAT " */
-}; /* __attribute__((__packed__)); */
-
-/*
- * (x86) BIOS Parameter Block for FAT32
- */
-struct mbr_bpbFAT32 {
- uint16_t bpbBytesPerSec; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint16_t bpbResSectors; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint16_t bpbRootDirEnts; /* number of root directory entries */
- uint16_t bpbSectors; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint16_t bpbFATsecs; /* number of sectors per FAT */
- uint16_t bpbSecPerTrack; /* sectors per track */
- uint16_t bpbHeads; /* number of heads */
- uint32_t bpbHiddenSecs; /* # of hidden sectors */
- uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
- uint32_t bpbBigFATsecs; /* like bpbFATsecs for FAT32 */
- uint16_t bpbExtFlags; /* extended flags: */
-#define MBR_FAT32_FATNUM 0x0F /* mask for numbering active FAT */
-#define MBR_FAT32_FATMIRROR 0x80 /* FAT is mirrored (as previously) */
- uint16_t bpbFSVers; /* filesystem version */
-#define MBR_FAT32_FSVERS 0 /* currently only 0 is understood */
- uint32_t bpbRootClust; /* start cluster for root directory */
- uint16_t bpbFSInfo; /* filesystem info structure sector */
- uint16_t bpbBackup; /* backup boot sector */
- uint8_t bsReserved[12]; /* Reserved for future expansion */
- uint8_t bsDrvNum; /* Int 0x13 drive number (e.g. 0x80) */
- uint8_t bsReserved1; /* Reserved; set to 0 */
- uint8_t bsBootSig; /* 0x29 if next 3 fields are present */
- uint8_t bsVolID[4]; /* Volume serial number */
- uint8_t bsVolLab[11]; /* Volume label */
- uint8_t bsFileSysType[8]; /* "FAT32 " */
-}; /* __attribute__((__packed__)); */
-
-/*
- * (x86) MBR boot selector
- */
-struct mbr_bootsel {
- uint8_t mbrbs_defkey;
- uint8_t mbrbs_flags;
- uint16_t mbrbs_timeo;
- uint8_t mbrbs_nametab[MBR_PART_COUNT][MBR_BS_PARTNAMESIZE + 1];
-}; /* __attribute__((__packed__)); */
-
-/*
- * MBR partition
- */
-struct mbr_partition {
- uint8_t mbrp_flag; /* MBR partition flags */
- uint8_t mbrp_shd; /* Starting head */
- uint8_t mbrp_ssect; /* Starting sector */
- uint8_t mbrp_scyl; /* Starting cylinder */
- uint8_t mbrp_type; /* Partition type (see below) */
- uint8_t mbrp_ehd; /* End head */
- uint8_t mbrp_esect; /* End sector */
- uint8_t mbrp_ecyl; /* End cylinder */
- uint32_t mbrp_start; /* Absolute starting sector number */
- uint32_t mbrp_size; /* Partition size in sectors */
-}; /* __attribute__((__packed__)); */
-
-int xlat_mbr_fstype(int); /* in sys/lib/libkern/xlat_mbr_fstype.c */
-
-/*
- * MBR boot sector.
- * This is used by both the MBR (Master Boot Record) in sector 0 of the disk
- * and the PBR (Partition Boot Record) in sector 0 of an MBR partition.
- */
-struct mbr_sector {
- /* Jump instruction to boot code. */
- /* Usually 0xE9nnnn or 0xEBnn90 */
- uint8_t mbr_jmpboot[3];
- /* OEM name and version */
- uint8_t mbr_oemname[8];
- union { /* BIOS Parameter Block */
- struct mbr_bpbFAT12 bpb12;
- struct mbr_bpbFAT16 bpb16;
- struct mbr_bpbFAT32 bpb32;
- } mbr_bpb;
- /* Boot code */
- uint8_t mbr_bootcode[310];
- /* Config for /usr/mdec/mbr_bootsel */
- struct mbr_bootsel mbr_bootsel;
- /* NT Drive Serial Number */
- uint32_t mbr_dsn;
- /* mbr_bootsel magic */
- uint16_t mbr_bootsel_magic;
- /* MBR partition table */
- struct mbr_partition mbr_parts[MBR_PART_COUNT];
- /* MBR magic (0xaa55) */
- uint16_t mbr_magic;
-}; /* __attribute__((__packed__)); */
-
-#endif /* !defined(__ASSEMBLER__) */ /* } */
-
-#pragma pack()
-
-
-/* ------------------------------------------
- * shared --
- * definitions shared by many platforms
- */
-
-#if !defined(__ASSEMBLER__) /* { */
-
- /* Maximum # of blocks in bbi_block_table, each bbi_block_size long */
-#define SHARED_BBINFO_MAXBLOCKS 118 /* so sizeof(shared_bbinfo) == 512 */
-
-struct shared_bbinfo {
- uint8_t bbi_magic[32];
- int32_t bbi_block_size;
- int32_t bbi_block_count;
- int32_t bbi_block_table[SHARED_BBINFO_MAXBLOCKS];
-};
-
-#if 0 /* XXX ffsdrv */
-
-/* ------------------------------------------
- * alpha --
- * Alpha (disk, but also tape) Boot Block.
- *
- * See Section (III) 3.6.1 of the Alpha Architecture Reference Manual.
- */
-
-struct alpha_boot_block {
- uint64_t bb_data[63]; /* data (disklabel, also as below) */
- uint64_t bb_cksum; /* checksum of the boot block,
- * taken as uint64_t's
- */
-};
-#define bb_secsize bb_data[60] /* secondary size (blocks) */
-#define bb_secstart bb_data[61] /* secondary start (blocks) */
-#define bb_flags bb_data[62] /* unknown flags (set to zero) */
-
-#define ALPHA_BOOT_BLOCK_OFFSET 0 /* offset of boot block. */
-#define ALPHA_BOOT_BLOCK_BLOCKSIZE 512 /* block size for sector
- * size/start, and for boot
- * block itself.
- */
-
-#define ALPHA_BOOT_BLOCK_CKSUM(bb,cksum) \
- do { \
- const struct alpha_boot_block *_bb = (bb); \
- uint64_t _cksum; \
- int _i; \
- \
- _cksum = 0; \
- for (_i = 0; \
- _i < (sizeof _bb->bb_data / sizeof _bb->bb_data[0]); \
- _i++) \
- _cksum += _bb->bb_data[_i]; \
- *(cksum) = _cksum; \
- } while (/*CONSTCOND*/ 0)
-
-/* ------------------------------------------
- * apple --
- * Apple computers boot block related information
- */
-
-/*
- * Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
- * pp 12-13. The driver descriptor map always resides on physical block 0.
- */
-struct apple_drvr_descriptor {
- uint32_t descBlock; /* first block of driver */
- uint16_t descSize; /* driver size in blocks */
- uint16_t descType; /* system type */
-};
-
-/*
- * system types; Apple reserves 0-15
- */
-#define APPLE_DRVR_TYPE_MACINTOSH 1
-
-#define APPLE_DRVR_MAP_MAGIC 0x4552
-#define APPLE_DRVR_MAP_MAX_DESCRIPTORS 61
-
-struct apple_drvr_map {
- uint16_t sbSig; /* map signature */
- uint16_t sbBlockSize; /* block size of device */
- uint32_t sbBlkCount; /* number of blocks on device */
- uint16_t sbDevType; /* (used internally by ROM) */
- uint16_t sbDevID; /* (used internally by ROM) */
- uint32_t sbData; /* (used internally by ROM) */
- uint16_t sbDrvrCount; /* number of driver descriptors */
- struct apple_drvr_descriptor sb_dd[APPLE_DRVR_MAP_MAX_DESCRIPTORS];
- uint16_t pad[3];
-} __attribute__((__packed__));
-
-/*
- * Partition map structure from Inside Macintosh: Devices, SCSI Manager
- * pp. 13-14. The partition map always begins on physical block 1.
- *
- * With the exception of block 0, all blocks on the disk must belong to
- * exactly one partition. The partition map itself belongs to a partition
- * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
- * other than available disk space. The partition map is not necessarily
- * the first partition listed.
- */
-#define APPLE_PART_MAP_ENTRY_MAGIC 0x504d
-
-struct apple_part_map_entry {
- uint16_t pmSig; /* partition signature */
- uint16_t pmSigPad; /* (reserved) */
- uint32_t pmMapBlkCnt; /* number of blocks in partition map */
- uint32_t pmPyPartStart; /* first physical block of partition */
- uint32_t pmPartBlkCnt; /* number of blocks in partition */
- uint8_t pmPartName[32]; /* partition name */
- uint8_t pmPartType[32]; /* partition type */
- uint32_t pmLgDataStart; /* first logical block of data area */
- uint32_t pmDataCnt; /* number of blocks in data area */
- uint32_t pmPartStatus; /* partition status information */
- uint32_t pmLgBootStart; /* first logical block of boot code */
- uint32_t pmBootSize; /* size of boot code, in bytes */
- uint32_t pmBootLoad; /* boot code load address */
- uint32_t pmBootLoad2; /* (reserved) */
- uint32_t pmBootEntry; /* boot code entry point */
- uint32_t pmBootEntry2; /* (reserved) */
- uint32_t pmBootCksum; /* boot code checksum */
- int8_t pmProcessor[16]; /* processor type (e.g. "68020") */
- uint8_t pmBootArgs[128]; /* A/UX boot arguments */
- uint8_t pad[248]; /* pad to end of block */
-};
-
-#define APPLE_PART_TYPE_DRIVER "APPLE_DRIVER"
-#define APPLE_PART_TYPE_DRIVER43 "APPLE_DRIVER43"
-#define APPLE_PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA"
-#define APPLE_PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT"
-#define APPLE_PART_TYPE_FWDRIVER "APPLE_FWDRIVER"
-#define APPLE_PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS"
-#define APPLE_PART_TYPE_FREE "APPLE_FREE"
-#define APPLE_PART_TYPE_MAC "APPLE_HFS"
-#define APPLE_PART_TYPE_NETBSD "NETBSD"
-#define APPLE_PART_TYPE_NBSD_PPCBOOT "NETBSD/MACPPC"
-#define APPLE_PART_TYPE_NBSD_68KBOOT "NETBSD/MAC68K"
-#define APPLE_PART_TYPE_PATCHES "APPLE_PATCHES"
-#define APPLE_PART_TYPE_PARTMAP "APPLE_PARTITION_MAP"
-#define APPLE_PART_TYPE_PATCHES "APPLE_PATCHES"
-#define APPLE_PART_TYPE_SCRATCH "APPLE_SCRATCH"
-#define APPLE_PART_TYPE_UNIX "APPLE_UNIX_SVR2"
-
-/*
- * "pmBootArgs" for APPLE_UNIX_SVR2 partition.
- * NetBSD/mac68k only uses Magic, Cluster, Type, and Flags.
- */
-struct apple_blockzeroblock {
- uint32_t bzbMagic;
- uint8_t bzbCluster;
- uint8_t bzbType;
- uint16_t bzbBadBlockInode;
- uint16_t bzbFlags;
- uint16_t bzbReserved;
- uint32_t bzbCreationTime;
- uint32_t bzbMountTime;
- uint32_t bzbUMountTime;
-};
-
-#define APPLE_BZB_MAGIC 0xABADBABE
-#define APPLE_BZB_TYPEFS 1
-#define APPLE_BZB_TYPESWAP 3
-#define APPLE_BZB_ROOTFS 0x8000
-#define APPLE_BZB_USRFS 0x4000
-
-/* ------------------------------------------
- * hp300
- *
- */
-
-/* volume header for "LIF" format volumes */
-
-struct hp300_lifvol {
- int16_t vol_id;
- char vol_label[6];
- int32_t vol_addr;
- int16_t vol_oct;
- int16_t vol_dummy;
- int32_t vol_dirsize;
- int16_t vol_version;
- int16_t vol_zero;
- int32_t vol_huh1;
- int32_t vol_huh2;
- int32_t vol_length;
-};
-
-/* LIF directory entry format */
-
-struct hp300_lifdir {
- char dir_name[10];
- int16_t dir_type;
- int32_t dir_addr;
- int32_t dir_length;
- char dir_toc[6];
- int16_t dir_flag;
- int32_t dir_exec;
-};
-
-/* load header for boot rom */
-struct hp300_load {
- int32_t address;
- int32_t count;
-};
-
-#define HP300_VOL_ID -32768
-#define HP300_VOL_OCT 4096
-#define HP300_DIR_TYPE -5822
-#define HP300_DIR_FLAG 0x8001 /* dont ask me! */
-#define HP300_SECTSIZE 256
-
-#endif
-
-/* ------------------------------------------
- * x86
- *
- */
-
-/*
- * Parameters for NetBSD /boot written to start of pbr code by installboot
- */
-
-struct x86_boot_params {
- uint32_t bp_length; /* length of patchable data */
- uint32_t bp_flags;
- uint32_t bp_timeout; /* boot timeout in seconds */
- uint32_t bp_consdev;
- uint32_t bp_conspeed;
- uint8_t bp_password[16]; /* md5 hash of password */
- char bp_keymap[16]; /* keyboard traslation map */
-};
-
-#endif /* !defined(__ASSEMBLER__) */ /* } */
-
-#define X86_BOOT_MAGIC(n) ('x' << 24 | 0x86b << 12 | 'm' << 4 | (n))
-#define X86_BOOT_MAGIC_1 X86_BOOT_MAGIC(1) /* pbr.S */
-#define X86_BOOT_MAGIC_2 X86_BOOT_MAGIC(2) /* bootxx.S */
-#define X86_BOOT_MAGIC_PXE X86_BOOT_MAGIC(3) /* start_pxe.S */
-
- /* values for bp_flags */
-#define X86_BP_FLAGS_RESET_VIDEO 1
-#define X86_BP_FLAGS_PASSWORD 2
-
- /* values for bp_consdev */
-#define X86_BP_CONSDEV_PC 0
-#define X86_BP_CONSDEV_COM0 1
-#define X86_BP_CONSDEV_COM1 2
-#define X86_BP_CONSDEV_COM2 3
-#define X86_BP_CONSDEV_COM3 4
-#define X86_BP_CONSDEV_COM0KBD 5
-#define X86_BP_CONSDEV_COM1KBD 6
-#define X86_BP_CONSDEV_COM2KBD 7
-#define X86_BP_CONSDEV_COM3KBD 8
-
-#if !defined(__ASSEMBLER__) /* { */
-
-#if 0 /* XXX ffsdrv */
-/* ------------------------------------------
- * macppc
- */
-
-#define MACPPC_BOOT_BLOCK_OFFSET 2048
-#define MACPPC_BOOT_BLOCK_BLOCKSIZE 512
-#define MACPPC_BOOT_BLOCK_MAX_SIZE 2048 /* XXX: could be up to 6144 */
- /* Magic string -- 32 bytes long (including the NUL) */
-#define MACPPC_BBINFO_MAGIC "NetBSD/macppc bootxx 20020515"
-
-/* ------------------------------------------
- * news68k, newsmips
- */
-
-#define NEWS_BOOT_BLOCK_LABELOFFSET 64 /* XXX from <machine/disklabel.h> */
-#define NEWS_BOOT_BLOCK_OFFSET 0
-#define NEWS_BOOT_BLOCK_BLOCKSIZE 512
-#define NEWS_BOOT_BLOCK_MAX_SIZE (512 * 16)
-
- /* Magic string -- 32 bytes long (including the NUL) */
-#define NEWS68K_BBINFO_MAGIC "NetBSD/news68k bootxx 20020518"
-#define NEWSMIPS_BBINFO_MAGIC "NetBSD/newsmips bootxx 20020518"
-
-/* ------------------------------------------
- * next68k
- */
-
-#define NEXT68K_LABEL_MAXPARTITIONS 8 /* number of partitions in next68k_disklabel */
-#define NEXT68K_LABEL_CPULBLLEN 24
-#define NEXT68K_LABEL_MAXDNMLEN 24
-#define NEXT68K_LABEL_MAXTYPLEN 24
-#define NEXT68K_LABEL_MAXBFLEN 24
-#define NEXT68K_LABEL_MAXHNLEN 32
-#define NEXT68K_LABEL_MAXMPTLEN 16
-#define NEXT68K_LABEL_MAXFSTLEN 8
-#define NEXT68K_LABEL_NBAD 1670 /* sized to make label ~= 8KB */
-
-struct next68k_partition {
- int32_t cp_offset; /* starting sector */
- int32_t cp_size; /* number of sectors in partition */
- int16_t cp_bsize; /* block size in bytes */
- int16_t cp_fsize; /* filesystem basic fragment size */
- char cp_opt; /* optimization type: 's'pace/'t'ime */
- char cp_pad1;
- int16_t cp_cpg; /* filesystem cylinders per group */
- int16_t cp_density; /* bytes per inode density */
- int8_t cp_minfree; /* minfree (%) */
- int8_t cp_newfs; /* run newfs during init */
- char cp_mountpt[NEXT68K_LABEL_MAXMPTLEN];
- /* default/standard mount point */
- int8_t cp_automnt; /* auto-mount when inserted */
- char cp_type[NEXT68K_LABEL_MAXFSTLEN]; /* file system type name */
- char cp_pad2;
-} __attribute__ ((packed));
-
-/* The disklabel the way it is on the disk */
-struct next68k_disklabel {
- int32_t cd_version; /* label version */
- int32_t cd_label_blkno; /* block # of this label */
- int32_t cd_size; /* size of media area (sectors) */
- char cd_label[NEXT68K_LABEL_CPULBLLEN]; /* disk name (label) */
- uint32_t cd_flags; /* flags */
- uint32_t cd_tag; /* volume tag */
- char cd_name[NEXT68K_LABEL_MAXDNMLEN]; /* drive (hardware) name */
- char cd_type[NEXT68K_LABEL_MAXTYPLEN]; /* drive type */
- int32_t cd_secsize; /* # of bytes per sector */
- int32_t cd_ntracks; /* # of tracks per cylinder */
- int32_t cd_nsectors; /* # of data sectors per track */
- int32_t cd_ncylinders; /* # of data cylinders per unit */
- int32_t cd_rpm; /* rotational speed */
- int16_t cd_front; /* # of sectors in "front porch" */
- int16_t cd_back; /* # of sectors in "back porch" */
- int16_t cd_ngroups; /* # of alt groups */
- int16_t cd_ag_size; /* alt group size (sectors) */
- int16_t cd_ag_alts; /* alternate sectors / alt group */
- int16_t cd_ag_off; /* sector offset to first alternate */
- int32_t cd_boot_blkno[2]; /* boot program locations */
- char cd_kernel[NEXT68K_LABEL_MAXBFLEN]; /* default kernel name */
- char cd_hostname[NEXT68K_LABEL_MAXHNLEN];
- /* host name (usu. where disk was labeled) */
- char cd_rootpartition; /* root partition letter e.g. 'a' */
- char cd_rwpartition; /* r/w partition letter e.g. 'b' */
- struct next68k_partition cd_partitions[NEXT68K_LABEL_MAXPARTITIONS];
-
- union {
- uint16_t CD_v3_checksum; /* label version 3 checksum */
- int32_t CD_bad[NEXT68K_LABEL_NBAD];
- /* block number that is bad */
- } cd_un;
- uint16_t cd_checksum; /* label version 1 or 2 checksum */
-} __attribute__ ((packed));
-
-#define NEXT68K_LABEL_cd_checksum cd_checksum
-#define NEXT68K_LABEL_cd_v3_checksum cd_un.CD_v3_checksum
-#define NEXT68K_LABEL_cd_bad cd_un.CD_bad
-
-#define NEXT68K_LABEL_SECTOR 0 /* sector containing label */
-#define NEXT68K_LABEL_OFFSET 0 /* offset of label in sector */
-#define NEXT68K_LABEL_SIZE 8192 /* size of label */
-#define NEXT68K_LABEL_CD_V1 0x4e655854 /* version #1: "NeXT" */
-#define NEXT68K_LABEL_CD_V2 0x646c5632 /* version #2: "dlV2" */
-#define NEXT68K_LABEL_CD_V3 0x646c5633 /* version #3: "dlV3" */
-#define NEXT68K_LABEL_DEFAULTFRONTPORCH (160 * 2)
-#define NEXT68K_LABEL_DEFAULTBOOT0_1 (32 * 2)
-#define NEXT68K_LABEL_DEFAULTBOOT0_2 (96 * 2)
-
-/* ------------------------------------------
- * pmax --
- * PMAX (DECstation / MIPS) boot block information
- */
-
-/*
- * If mode is 0, there is just one sequence of blocks and one Dec_BootMap
- * is used. If mode is 1, there are multiple sequences of blocks
- * and multiple Dec_BootMaps are used, the last with numBlocks = 0.
- */
-struct pmax_boot_map {
- int32_t num_blocks; /* Number of blocks to read. */
- int32_t start_block; /* Starting block on disk. */
-};
-
-/*
- * This is the structure of a disk or tape boot block. The boot_map
- * can either be a single boot count and start block (contiguous mode)
- * or a list of up to 61 (to fill a 512 byte sector) block count and
- * start block pairs. Under NetBSD, contiguous mode is always used.
- */
-struct pmax_boot_block {
- uint8_t pad[8];
- int32_t magic; /* PMAX_BOOT_MAGIC */
- int32_t mode; /* Mode for boot info. */
- uint32_t load_addr; /* Address to start loading. */
- uint32_t exec_addr; /* Address to start execing. */
- struct pmax_boot_map map[61]; /* boot program section(s). */
-} __attribute__((__packed__));
-
-#define PMAX_BOOT_MAGIC 0x0002757a
-#define PMAX_BOOTMODE_CONTIGUOUS 0
-#define PMAX_BOOTMODE_SCATTERED 1
-
-#define PMAX_BOOT_BLOCK_OFFSET 0
-#define PMAX_BOOT_BLOCK_BLOCKSIZE 512
-
-
-/* ------------------------------------------
- * sparc
- */
-
-#define SPARC_BOOT_BLOCK_OFFSET 512
-#define SPARC_BOOT_BLOCK_BLOCKSIZE 512
-#define SPARC_BOOT_BLOCK_MAX_SIZE (512 * 15)
- /* Magic string -- 32 bytes long (including the NUL) */
-#define SPARC_BBINFO_MAGIC "NetBSD/sparc bootxx 20020515"
-
-
-/* ------------------------------------------
- * sparc64
- */
-
-#define SPARC64_BOOT_BLOCK_OFFSET 512
-#define SPARC64_BOOT_BLOCK_BLOCKSIZE 512
-#define SPARC64_BOOT_BLOCK_MAX_SIZE (512 * 15)
-
-
-/* ------------------------------------------
- * sun68k (sun2, sun3)
- */
-
-#define SUN68K_BOOT_BLOCK_OFFSET 512
-#define SUN68K_BOOT_BLOCK_BLOCKSIZE 512
-#define SUN68K_BOOT_BLOCK_MAX_SIZE (512 * 15)
- /* Magic string -- 32 bytes long (including the NUL) */
-#define SUN68K_BBINFO_MAGIC "NetBSD/sun68k bootxx 20020515"
-
-
-/* ------------------------------------------
- * vax --
- * VAX boot block information
- */
-
-struct vax_boot_block {
-/* Note that these don't overlap any of the pmax boot block */
- uint8_t pad0[2];
- uint8_t bb_id_offset; /* offset in words to id (magic1)*/
- uint8_t bb_mbone; /* must be one */
- uint16_t bb_lbn_hi; /* lbn (hi word) of bootstrap */
- uint16_t bb_lbn_low; /* lbn (low word) of bootstrap */
- uint8_t pad1[332];
-
- /* The rest of these fields are identification area and describe
- * the secondary block for uVAX VMB.
- */
- uint8_t bb_magic1; /* magic number */
- uint8_t bb_mbz1; /* must be zero */
- uint8_t bb_pad1; /* any value */
- uint8_t bb_sum1; /* ~(magic1 + mbz1 + pad1) */
-
- uint8_t bb_mbz2; /* must be zero */
- uint8_t bb_volinfo; /* volinfo */
- uint8_t bb_pad2a; /* any value */
- uint8_t bb_pad2b; /* any value */
-
- uint32_t bb_size; /* size in blocks of bootstrap */
- uint32_t bb_load; /* load offset to bootstrap */
- uint32_t bb_entry; /* byte offset in bootstrap */
- uint32_t bb_sum3; /* sum of previous 3 fields */
-
- /* The rest is unused.
- */
- uint8_t pad2[148];
-} __attribute__((__packed__));
-
-#define VAX_BOOT_MAGIC1 0x18 /* size of BB info? */
-#define VAX_BOOT_VOLINFO_NONE 0x00 /* no special info */
-#define VAX_BOOT_VOLINFO_SS 0x01 /* single sided */
-#define VAX_BOOT_VOLINFO_DS 0x81 /* double sided */
-
-#define VAX_BOOT_SIZE 15 /* 15 blocks */
-#define VAX_BOOT_LOAD 0 /* no load offset */
-#define VAX_BOOT_ENTRY 0x200 /* one block in */
-
-#define VAX_BOOT_BLOCK_OFFSET 0
-#define VAX_BOOT_BLOCK_BLOCKSIZE 512
-
-
-/* ------------------------------------------
- * x68k
- */
-
-#define X68K_BOOT_BLOCK_OFFSET 0
-#define X68K_BOOT_BLOCK_BLOCKSIZE 512
-#define X68K_BOOT_BLOCK_MAX_SIZE (512 * 16)
- /* Magic string -- 32 bytes long (including the NUL) */
-#define X68K_BBINFO_MAGIC "NetBSD/x68k bootxx 20020601"
-
-#endif /* !defined(__ASSEMBLER__) */ /* } */
-
-#endif
-
-#endif /* !_SYS_BOOTBLOCK_H */
diff --git a/drivers/filesystems/ffs/inc/dinode.h b/drivers/filesystems/ffs/inc/dinode.h
deleted file mode 100644
index 3b87eb5b485..00000000000
--- a/drivers/filesystems/ffs/inc/dinode.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $NetBSD: dinode.h,v 1.18 2003/08/07 16:34:42 agc Exp $ */
-
-/*
- * Copyright (c) 2002 Networks Associates Technology, Inc.
- * All rights reserved.
- *
- * This software was developed for the FreeBSD Project by Marshall
- * Kirk McKusick and Network Associates Laboratories, the Security
- * Research Division of Network Associates, Inc. under DARPA/SPAWAR
- * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
- * research program
- *
- * Copyright (c) 1982, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dinode.h 8.9 (Berkeley) 3/29/95
- */
-
-#ifndef _UFS_UFS_DINODE_H_
-#define _UFS_UFS_DINODE_H_
-
-#include "type.h"
-
-/*
- * The root inode is the root of the file system. Inode 0 can't be used for
- * normal purposes and historically bad blocks were linked to inode 1, thus
- * the root inode is 2. (Inode 1 is no longer used for this purpose, however
- * numerous dump tapes make this assumption, so we are stuck with it).
- */
-#define ROOTINO ((ino_t)2)
-
-/*
- * The Whiteout inode# is a dummy non-zero inode number which will
- * never be allocated to a real file. It is used as a place holder
- * in the directory entry which has been tagged as a DT_W entry.
- * See the comments about ROOTINO above.
- */
-#define WINO ((ino_t)1)
-
-/*
- * A dinode contains all the meta-data associated with a UFS file.
- * This structure defines the on-disk format of a dinode. Since
- * this structure describes an on-disk structure, all its fields
- * are defined by types with precise widths.
- */
-
-#define NXADDR 2
-#define NDADDR 12 /* Direct addresses in inode. */
-#define NIADDR 3 /* Indirect addresses in inode. */
-
-struct ufs1_dinode {
- u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
- int16_t di_nlink; /* 2: File link count. */
- union {
- u_int16_t oldids[2]; /* 4: Ffs: old user and group ids. */
- u_int32_t inumber; /* 4: Lfs: inode number. */
- } di_u;
- u_int64_t di_size; /* 8: File byte count. */
- int32_t di_atime; /* 16: Last access time. */
- int32_t di_atimensec; /* 20: Last access time. */
- int32_t di_mtime; /* 24: Last modified time. */
- int32_t di_mtimensec; /* 28: Last modified time. */
- int32_t di_ctime; /* 32: Last inode change time. */
- int32_t di_ctimensec; /* 36: Last inode change time. */
- int32_t di_db[NDADDR]; /* 40: Direct disk blocks. */
- int32_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */
- u_int32_t di_flags; /* 100: Status flags (chflags). */
- u_int32_t di_blocks; /* 104: Blocks actually held. */
- int32_t di_gen; /* 108: Generation number. */
- u_int32_t di_uid; /* 112: File owner. */
- u_int32_t di_gid; /* 116: File group. */
- int32_t di_spare[2]; /* 120: Reserved; currently unused */
-};
-
-struct ufs2_dinode {
- u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
- int16_t di_nlink; /* 2: File link count. */
- u_int32_t di_uid; /* 4: File owner. */
- u_int32_t di_gid; /* 8: File group. */
- u_int32_t di_blksize; /* 12: Inode blocksize. */
- u_int64_t di_size; /* 16: File byte count. */
- u_int64_t di_blocks; /* 24: Bytes actually held. */
- int64_t di_atime; /* 32: Last access time. */
- int64_t di_mtime; /* 40: Last modified time. */
- int64_t di_ctime; /* 48: Last inode change time. */
- int64_t di_birthtime; /* 56: Inode creation time. */
- int32_t di_mtimensec; /* 64: Last modified time. */
- int32_t di_atimensec; /* 68: Last access time. */
- int32_t di_ctimensec; /* 72: Last inode change time. */
- int32_t di_birthnsec; /* 76: Inode creation time. */
- int32_t di_gen; /* 80: Generation number. */
- u_int32_t di_kernflags; /* 84: Kernel flags. */
- u_int32_t di_flags; /* 88: Status flags (chflags). */
- int32_t di_extsize; /* 92: External attributes block. */
- int64_t di_extb[NXADDR];/* 96: External attributes block. */
- int64_t di_db[NDADDR]; /* 112: Direct disk blocks. */
- int64_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */
- int64_t di_spare[3]; /* 232: Reserved; currently unused */
-};
-
-/*
- * The di_db fields may be overlaid with other information for
- * file types that do not have associated disk storage. Block
- * and character devices overlay the first data block with their
- * dev_t value. Short symbolic links place their path in the
- * di_db area.
- */
-#define di_inumber di_u.inumber
-#define di_ogid di_u.oldids[1]
-#define di_ouid di_u.oldids[0]
-#define di_rdev di_db[0]
-#define MAXSYMLINKLEN_UFS1 ((NDADDR + NIADDR) * sizeof(int32_t))
-#define MAXSYMLINKLEN_UFS2 ((NDADDR + NIADDR) * sizeof(int64_t))
-
-#define MAXSYMLINKLEN(ip) \
- ((ip)->i_ump->um_fstype == UFS1) ? \
- MAXSYMLINKLEN_UFS1 : MAXSYMLINKLEN_UFS2
-
-/* NeXT used to keep short symlinks in the inode even when using
- * FS_42INODEFMT. In that case fs->fs_maxsymlinklen is probably -1,
- * but short symlinks were stored in inodes shorter than this:
- */
-#define APPLEUFS_MAXSYMLINKLEN 60
-
-/* File permissions. */
-#define IEXEC 0000100 /* Executable. */
-#define IWRITE 0000200 /* Writable. */
-#define IREAD 0000400 /* Readable. */
-#define ISVTX 0001000 /* Sticky bit. */
-#define ISGID 0002000 /* Set-gid. */
-#define ISUID 0004000 /* Set-uid. */
-
-/* File types. */
-#define IFMT 0170000 /* Mask of file type. */
-#define IFIFO 0010000 /* Named pipe (fifo). */
-#define IFCHR 0020000 /* Character device. */
-#define IFDIR 0040000 /* Directory file. */
-#define IFBLK 0060000 /* Block device. */
-#define IFREG 0100000 /* Regular file. */
-#define IFLNK 0120000 /* Symbolic link. */
-#define IFSOCK 0140000 /* UNIX domain socket. */
-#define IFWHT 0160000 /* Whiteout. */
-
-/* Size of the on-disk inode. */
-#define DINODE1_SIZE (sizeof(struct ufs1_dinode)) /* 128 */
-#define DINODE2_SIZE (sizeof(struct ufs2_dinode))
-
-#endif /* !_UFS_UFS_DINODE_H_ */
diff --git a/drivers/filesystems/ffs/inc/dir.h b/drivers/filesystems/ffs/inc/dir.h
deleted file mode 100644
index 53b5034cfbe..00000000000
--- a/drivers/filesystems/ffs/inc/dir.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $NetBSD: dir.h,v 1.17 2003/08/07 16:34:42 agc Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dir.h 8.5 (Berkeley) 4/27/95
- */
-
-#ifndef _UFS_UFS_DIR_H_
-#define _UFS_UFS_DIR_H_
-
-#include "type.h"
-
-/*
- * Theoretically, directories can be more than 2Gb in length, however, in
- * practice this seems unlikely. So, we define the type doff_t as a 32-bit
- * quantity to keep down the cost of doing lookup on a 32-bit machine.
- */
-#define doff_t int32_t
-#define MAXDIRSIZE (0x7fffffff)
-
-/*
- * A directory consists of some number of blocks of DIRBLKSIZ
- * bytes, where DIRBLKSIZ is chosen such that it can be transferred
- * to disk in a single atomic operation (e.g. 512 bytes on most machines).
- *
- * Each DIRBLKSIZ byte block contains some number of directory entry
- * structures, which are of variable length. Each directory entry has
- * a struct direct at the front of it, containing its inode number,
- * the length of the entry, and the length of the name contained in
- * the entry. These are followed by the name padded to a 4 byte boundary.
- * All names are guaranteed null terminated.
- * The maximum length of a name in a directory is MAXNAMLEN.
- *
- * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent
- * a directory entry. Free space in a directory is represented by
- * entries which have dp->d_reclen > DIRSIZ(fmt, dp). All DIRBLKSIZ bytes
- * in a directory block are claimed by the directory entries. This
- * usually results in the last entry in a directory having a large
- * dp->d_reclen. When entries are deleted from a directory, the
- * space is returned to the previous entry in the same directory
- * block by increasing its dp->d_reclen. If the first entry of
- * a directory block is free, then its dp->d_ino is set to 0.
- * Entries other than the first in a directory do not normally have
- * dp->d_ino set to 0.
- */
-#undef DIRBLKSIZ
-#define DIRBLKSIZ DEV_BSIZE
-#undef MAXNAMLEN
-#define MAXNAMLEN 255
-#define APPLEUFS_DIRBLKSIZ 1024
-
-struct direct {
- u_int32_t d_ino; /* inode number of entry */
- u_int16_t d_reclen; /* length of this record */
- u_int8_t d_type; /* file type, see below */
- u_int8_t d_namlen; /* length of string in d_name */
- char d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */
-};
-
-/*
- * File types
- */
-#define DT_UNKNOWN 0
-#define DT_FIFO 1
-#define DT_CHR 2
-#define DT_DIR 4
-#define DT_BLK 6
-#define DT_REG 8
-#define DT_LNK 10
-#define DT_SOCK 12
-#define DT_WHT 14
-
-/*
- * Convert between stat structure types and directory types.
- */
-#define IFTODT(mode) (((mode) & 0170000) >> 12)
-#define DTTOIF(dirtype) ((dirtype) << 12)
-
-/*
- * The DIRSIZ macro gives the minimum record length which will hold
- * the directory entry. This requires the amount of space in struct direct
- * without the d_name field, plus enough space for the name with a terminating
- * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
- */
-#define DIRECTSIZ(namlen) \
- ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
-
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-#define DIRSIZ(oldfmt, dp, needswap) \
- (((oldfmt) && !(needswap)) ? \
- DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
-#else
-#define DIRSIZ(oldfmt, dp, needswap) \
- (((oldfmt) && (needswap)) ? \
- DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
-#endif
-
-#define OLDDIRFMT 1
-#define NEWDIRFMT 0
-
-/*
- * Template for manipulating directories. Should use struct direct's,
- * but the name field is MAXNAMLEN - 1, and this just won't do.
- */
-struct dirtemplate {
- u_int32_t dot_ino;
- int16_t dot_reclen;
- u_int8_t dot_type;
- u_int8_t dot_namlen;
- char dot_name[4]; /* must be multiple of 4 */
- u_int32_t dotdot_ino;
- int16_t dotdot_reclen;
- u_int8_t dotdot_type;
- u_int8_t dotdot_namlen;
- char dotdot_name[4]; /* ditto */
-};
-
-/*
- * This is the old format of directories, sanz type element.
- */
-struct odirtemplate {
- u_int32_t dot_ino;
- int16_t dot_reclen;
- u_int16_t dot_namlen;
- char dot_name[4]; /* must be multiple of 4 */
- u_int32_t dotdot_ino;
- int16_t dotdot_reclen;
- u_int16_t dotdot_namlen;
- char dotdot_name[4]; /* ditto */
-};
-#endif /* !_UFS_UFS_DIR_H_ */
diff --git a/drivers/filesystems/ffs/inc/disklabel.h b/drivers/filesystems/ffs/inc/disklabel.h
deleted file mode 100644
index f7d7a376e86..00000000000
--- a/drivers/filesystems/ffs/inc/disklabel.h
+++ /dev/null
@@ -1,555 +0,0 @@
-/* $NetBSD: disklabel.h,v 1.88 2003/11/14 12:07:42 lukem Exp $ */
-
-/*
- * Copyright (c) 1987, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
- */
-
-#ifndef _SYS_DISKLABEL_H_
-#define _SYS_DISKLABEL_H_
-
-#include "type.h"
-
-/*
- * We need <machine/types.h> for __HAVE_OLD_DISKLABEL
- */
-#if 0 /* XXX ffsdrv */
-#ifndef _LOCORE
-#include <sys/types.h>
-#endif
-#endif
-
-/* sys/arch/i386/include/type.h XXX ffsdrv */
-#define __HAVE_OLD_DISKLABEL
-
-/*
- * Each disk has a label which includes information about the hardware
- * disk geometry, filesystem partitions, and drive specific information.
- * The location of the label, as well as the number of partitions the
- * label can describe and the number of the "whole disk" (raw)
- * paritition are machine dependent.
- */
-#if 0 /* XXX ffsdrv */
-#include <machine/disklabel.h>
-#endif
-
-/* arch/i386/include/disklabel.h */
-#define LABELSECTOR 1 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-#define OLDMAXPARTITIONS 8 /* number of partitions before 1.6 */
-#define RAW_PART 3 /* raw partition: XX?d (XXX) */
-
-/*
- * We use the highest bit of the minor number for the partition number.
- * This maintains backward compatibility with device nodes created before
- * MAXPARTITIONS was increased.
- */
-#define __I386_MAXDISKS ((1 << 20) / MAXPARTITIONS)
-#define DISKUNIT(dev) ((minor(dev) / OLDMAXPARTITIONS) % __I386_MAXDISKS)
-#define DISKPART(dev) ((minor(dev) % OLDMAXPARTITIONS) + \
- ((minor(dev) / (__I386_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
-#define DISKMINOR(unit, part) \
- (((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
- ((part) / OLDMAXPARTITIONS) * (__I386_MAXDISKS * OLDMAXPARTITIONS))
-
-/* Pull in MBR partition definitions. */
-#include "bootblock.h"
-
-/* end of arch/i386/include/disklabel.h */
-
-
-/*
- * The absolute maximum number of disk partitions allowed.
- * This is the maximum value of MAXPARTITIONS for which 'struct disklabel'
- * is <= DEV_BSIZE bytes long. If MAXPARTITIONS is greater than this, beware.
- */
-#define MAXMAXPARTITIONS 22
-#if MAXPARTITIONS > MAXMAXPARTITIONS
-#warning beware: MAXPARTITIONS bigger than MAXMAXPARTITIONS
-#endif
-
-/*
- * Ports can switch their MAXPARTITIONS once, as follows:
- *
- * - define OLDMAXPARTITIONS in <machine/disklabel.h> as the old number
- * - define MAXPARTITIONS as the new number
- * - define DISKUNIT, DISKPART and DISKMINOR macros in <machine/disklabel.h>
- * as appropriate for the port (see the i386 one for an example).
- * - define __HAVE_OLD_DISKLABEL in <machine/types.h>
- */
-
-#if defined(_KERNEL) && defined(__HAVE_OLD_DISKLABEL) && \
- (MAXPARTITIONS < OLDMAXPARTITIONS)
-#error "can only grow disklabel size"
-#endif
-
-
-/*
- * Translate between device numbers and major/disk unit/disk partition.
- */
-#ifndef __HAVE_OLD_DISKLABEL
-#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)
-#define DISKPART(dev) (minor(dev) % MAXPARTITIONS)
-#define DISKMINOR(unit, part) \
- (((unit) * MAXPARTITIONS) + (part))
-#endif
-#define MAKEDISKDEV(maj, unit, part) \
- (makedev((maj), DISKMINOR((unit), (part))))
-
-#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */
-
-#ifndef _LOCORE
-struct disklabel {
- u_int32_t d_magic; /* the magic number */
- u_int16_t d_type; /* drive type */
- u_int16_t d_subtype; /* controller/d_type specific */
- char d_typename[16]; /* type name, e.g. "eagle" */
-
- /*
- * d_packname contains the pack identifier and is returned when
- * the disklabel is read off the disk or in-core copy.
- * d_boot0 and d_boot1 are the (optional) names of the
- * primary (block 0) and secondary (block 1-15) bootstraps
- * as found in /usr/mdec. These are returned when using
- * getdiskbyname(3) to retrieve the values from /etc/disktab.
- */
- union {
- char un_d_packname[16]; /* pack identifier */
- struct {
- char *un_d_boot0; /* primary bootstrap name */
- char *un_d_boot1; /* secondary bootstrap name */
- } un_b;
- } d_un;
-#define d_packname d_un.un_d_packname
-#define d_boot0 d_un.un_b.un_d_boot0
-#define d_boot1 d_un.un_b.un_d_boot1
-
- /* disk geometry: */
- u_int32_t d_secsize; /* # of bytes per sector */
- u_int32_t d_nsectors; /* # of data sectors per track */
- u_int32_t d_ntracks; /* # of tracks per cylinder */
- u_int32_t d_ncylinders; /* # of data cylinders per unit */
- u_int32_t d_secpercyl; /* # of data sectors per cylinder */
- u_int32_t d_secperunit; /* # of data sectors per unit */
-
- /*
- * Spares (bad sector replacements) below are not counted in
- * d_nsectors or d_secpercyl. Spare sectors are assumed to
- * be physical sectors which occupy space at the end of each
- * track and/or cylinder.
- */
- u_int16_t d_sparespertrack; /* # of spare sectors per track */
- u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */
- /*
- * Alternative cylinders include maintenance, replacement,
- * configuration description areas, etc.
- */
- u_int32_t d_acylinders; /* # of alt. cylinders per unit */
-
- /* hardware characteristics: */
- /*
- * d_interleave, d_trackskew and d_cylskew describe perturbations
- * in the media format used to compensate for a slow controller.
- * Interleave is physical sector interleave, set up by the
- * formatter or controller when formatting. When interleaving is
- * in use, logically adjacent sectors are not physically
- * contiguous, but instead are separated by some number of
- * sectors. It is specified as the ratio of physical sectors
- * traversed per logical sector. Thus an interleave of 1:1
- * implies contiguous layout, while 2:1 implies that logical
- * sector 0 is separated by one sector from logical sector 1.
- * d_trackskew is the offset of sector 0 on track N relative to
- * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
- * is the offset of sector 0 on cylinder N relative to sector 0
- * on cylinder N-1.
- */
- u_int16_t d_rpm; /* rotational speed */
- u_int16_t d_interleave; /* hardware sector interleave */
- u_int16_t d_trackskew; /* sector 0 skew, per track */
- u_int16_t d_cylskew; /* sector 0 skew, per cylinder */
- u_int32_t d_headswitch; /* head switch time, usec */
- u_int32_t d_trkseek; /* track-to-track seek, usec */
- u_int32_t d_flags; /* generic flags */
-#define NDDATA 5
- u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
- u_int32_t d_spare[NSPARE]; /* reserved for future use */
- u_int32_t d_magic2; /* the magic number (again) */
- u_int16_t d_checksum; /* xor of data incl. partitions */
-
- /* filesystem and partition information: */
- u_int16_t d_npartitions; /* number of partitions in following */
- u_int32_t d_bbsize; /* size of boot area at sn0, bytes */
- u_int32_t d_sbsize; /* max size of fs superblock, bytes */
- struct partition { /* the partition table */
- u_int32_t p_size; /* number of sectors in partition */
- u_int32_t p_offset; /* starting sector */
- union {
- u_int32_t fsize; /* FFS, ADOS:
- filesystem basic fragment size */
- u_int32_t cdsession; /* ISO9660: session offset */
- } __partition_u2;
-#define p_fsize __partition_u2.fsize
-#define p_cdsession __partition_u2.cdsession
- u_int8_t p_fstype; /* filesystem type, see below */
- u_int8_t p_frag; /* filesystem fragments per block */
- union {
- u_int16_t cpg; /* UFS: FS cylinders per group */
- u_int16_t sgs; /* LFS: FS segment shift */
- } __partition_u1;
-#define p_cpg __partition_u1.cpg
-#define p_sgs __partition_u1.sgs
- } d_partitions[MAXPARTITIONS]; /* actually may be more */
-};
-
-#ifdef __HAVE_OLD_DISKLABEL
-/*
- * Same as above, but with OLDMAXPARTITIONS partitions. For use in
- * the old DIOC* ioctl calls.
- */
-struct olddisklabel {
- u_int32_t d_magic;
- u_int16_t d_type;
- u_int16_t d_subtype;
- char d_typename[16];
- union {
- char un_d_packname[16];
- struct {
- char *un_d_boot0;
- char *un_d_boot1;
- } un_b;
- } d_un;
- u_int32_t d_secsize;
- u_int32_t d_nsectors;
- u_int32_t d_ntracks;
- u_int32_t d_ncylinders;
- u_int32_t d_secpercyl;
- u_int32_t d_secperunit;
- u_int16_t d_sparespertrack;
- u_int16_t d_sparespercyl;
- u_int32_t d_acylinders;
- u_int16_t d_rpm;
- u_int16_t d_interleave;
- u_int16_t d_trackskew;
- u_int16_t d_cylskew;
- u_int32_t d_headswitch;
- u_int32_t d_trkseek;
- u_int32_t d_flags;
- u_int32_t d_drivedata[NDDATA];
- u_int32_t d_spare[NSPARE];
- u_int32_t d_magic2;
- u_int16_t d_checksum;
- u_int16_t d_npartitions;
- u_int32_t d_bbsize;
- u_int32_t d_sbsize;
- struct opartition {
- u_int32_t p_size;
- u_int32_t p_offset;
- union {
- u_int32_t fsize;
- u_int32_t cdsession;
- } __partition_u2;
- u_int8_t p_fstype;
- u_int8_t p_frag;
- union {
- u_int16_t cpg;
- u_int16_t sgs;
- } __partition_u1;
- } d_partitions[OLDMAXPARTITIONS];
-};
-#endif /* __HAVE_OLD_DISKLABEL */
-#else /* _LOCORE */
- /*
- * offsets for asm boot files.
- */
- .set d_secsize,40
- .set d_nsectors,44
- .set d_ntracks,48
- .set d_ncylinders,52
- .set d_secpercyl,56
- .set d_secperunit,60
- .set d_end_,276 /* size of disk label */
-#endif /* _LOCORE */
-
-/* d_type values: */
-#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
-#define DTYPE_MSCP 2 /* MSCP */
-#define DTYPE_DEC 3 /* other DEC (rk, rl) */
-#define DTYPE_SCSI 4 /* SCSI */
-#define DTYPE_ESDI 5 /* ESDI interface */
-#define DTYPE_ST506 6 /* ST506 etc. */
-#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
-#define DTYPE_HPFL 8 /* HP Fiber-link */
-#define DTYPE_FLOPPY 10 /* floppy */
-#define DTYPE_CCD 11 /* concatenated disk device */
-#define DTYPE_VND 12 /* vnode pseudo-disk */
-#define DTYPE_ATAPI 13 /* ATAPI */
-#define DTYPE_RAID 14 /* RAIDframe */
-#define DTYPE_LD 15 /* logical disk */
-#define DTYPE_JFS2 16 /* IBM JFS2 */
-#define DTYPE_CGD 17 /* cryptographic pseudo-disk */
-#define DTYPE_VINUM 18 /* vinum volume */
-
-#ifdef DKTYPENAMES
-static const char *const dktypenames[] = {
- "unknown",
- "SMD",
- "MSCP",
- "old DEC",
- "SCSI",
- "ESDI",
- "ST506",
- "HP-IB",
- "HP-FL",
- "type 9",
- "floppy",
- "ccd",
- "vnd",
- "ATAPI",
- "RAID",
- "ld",
- "jfs",
- "cgd",
- "vinum",
- NULL
-};
-#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
-#endif
-
-/*
- * Filesystem type and version.
- * Used to interpret other filesystem-specific
- * per-partition information.
- *
- * These are used only for COMPAT_09 support.
- */
-#define FS_UNUSED 0 /* unused */
-#define FS_SWAP 1 /* swap */
-#define FS_V6 2 /* Sixth Edition */
-#define FS_V7 3 /* Seventh Edition */
-#define FS_SYSV 4 /* System V */
-#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
-#define FS_V8 6 /* Eighth Edition, 4K blocks */
-#define FS_BSDFFS 7 /* 4.2BSD fast file system */
-#define FS_MSDOS 8 /* MSDOS file system */
-#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */
-#define FS_OTHER 10 /* in use, but unknown/unsupported */
-#define FS_HPFS 11 /* OS/2 high-performance file system */
-#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
-#define FS_BOOT 13 /* partition contains bootstrap */
-#define FS_ADOS 14 /* AmigaDOS fast file system */
-#define FS_HFS 15 /* Macintosh HFS */
-#define FS_FILECORE 16 /* Acorn Filecore Filing System */
-#define FS_EX2FS 17 /* Linux Extended 2 file system */
-#define FS_NTFS 18 /* Windows/NT file system */
-#define FS_RAID 19 /* RAIDframe component */
-#define FS_CCD 20 /* concatenated disk component */
-#define FS_JFS2 21 /* IBM JFS2 */
-#define FS_APPLEUFS 22 /* Apple UFS */
-/* XXX this is not the same as FreeBSD. How to solve? */
-#define FS_VINUM 23 /* Vinum */
-
-/* Adjust the FSMAXTYPES def below if you add something after APPLEUFS */
-
-#ifdef FSTYPENAMES
-static const char *const fstypenames[] = {
- "unused",
- "swap",
- "Version 6",
- "Version 7",
- "System V",
- "4.1BSD",
- "Eighth Edition",
- "4.2BSD",
- "MSDOS",
- "4.4LFS",
- "unknown",
- "HPFS",
- "ISO9660",
- "boot",
- "ADOS",
- "HFS",
- "FILECORE",
- "Linux Ext2",
- "NTFS",
- "RAID",
- "ccd",
- "jfs",
- "Apple UFS",
- "vinum",
- NULL
-};
-#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
-#else
-#define FSMAXTYPES (FS_VINUM + 1)
-#endif
-
-#ifdef FSCKNAMES
-/* These are the names MOUNT_XXX from <sys/mount.h> */
-static const char *const fscknames[] = {
- NULL, /* unused */
- NULL, /* swap */
- NULL, /* Version 6 */
- NULL, /* Version 7 */
- NULL, /* System V */
- NULL, /* 4.1BSD */
- NULL, /* Eighth edition */
- "ffs", /* 4.2BSD */
- "msdos", /* MSDOS */
- "lfs", /* 4.4LFS */
- NULL, /* unknown */
- NULL, /* HPFS */
- NULL, /* ISO9660 */
- NULL, /* boot */
- NULL, /* ADOS */
- NULL, /* HFS */
- NULL, /* FILECORE */
- "ext2fs", /* Linux Ext2 */
- NULL, /* Windows/NT */
- NULL, /* RAID Component */
- NULL, /* concatenated disk component */
- NULL, /* IBM JFS2 */
- "ffs", /* Apple UFS */
- NULL /* NULL */
-};
-#define FSMAXNAMES (sizeof(fscknames) / sizeof(fscknames[0]) - 1)
-
-#endif
-
-#ifdef MOUNTNAMES
-/* These are the names MOUNT_XXX from <sys/mount.h> */
-static const char *const mountnames[] = {
- NULL, /* unused */
- NULL, /* swap */
- NULL, /* Version 6 */
- NULL, /* Version 7 */
- NULL, /* System V */
- NULL, /* 4.1BSD */
- NULL, /* Eighth edition */
- "ffs", /* 4.2BSD */
- "msdos", /* MSDOS */
- "lfs", /* 4.4LFS */
- NULL, /* unknown */
- NULL, /* HPFS */
- "cd9660", /* ISO9660 */
- NULL, /* boot */
- "ados", /* ADOS */
- NULL, /* HFS */
- "filecore", /* FILECORE */
- "ext2fs", /* Linux Ext2 */
- "ntfs", /* Windows/NT */
- NULL, /* RAID Component */
- NULL, /* concatenated disk component */
- NULL, /* IBM JFS2 */
- "ffs", /* Apple UFS */
- NULL /* NULL */
-};
-#define FSMAXMOUNTNAMES (sizeof(mountnames) / sizeof(mountnames[0]) - 1)
-
-#endif
-
-/*
- * flags shared by various drives:
- */
-#define D_REMOVABLE 0x01 /* removable media */
-#define D_ECC 0x02 /* supports ECC */
-#define D_BADSECT 0x04 /* supports bad sector forw. */
-#define D_RAMDISK 0x08 /* disk emulator */
-#define D_CHAIN 0x10 /* can do back-back transfers */
-
-/*
- * Drive data for SMD.
- */
-#define d_smdflags d_drivedata[0]
-#define D_SSE 0x1 /* supports skip sectoring */
-#define d_mindist d_drivedata[1]
-#define d_maxdist d_drivedata[2]
-#define d_sdist d_drivedata[3]
-
-/*
- * Drive data for ST506.
- */
-#define d_precompcyl d_drivedata[0]
-#define d_gap3 d_drivedata[1] /* used only when formatting */
-
-/*
- * Drive data for SCSI.
- */
-#define d_blind d_drivedata[0]
-
-#ifndef _LOCORE
-/*
- * Structure used to perform a format or other raw operation,
- * returning data and/or register values. Register identification
- * and format are device- and driver-dependent. Currently unused.
- */
-struct format_op {
- char *df_buf;
- int df_count; /* value-result */
- daddr_t df_startblk;
- int df_reg[8]; /* result */
-};
-
-/*
- * Structure used internally to retrieve information about a partition
- * on a disk.
- */
-struct partinfo {
- struct disklabel *disklab;
- struct partition *part;
-};
-
-#ifdef _KERNEL
-
-struct disk;
-
-void diskerr __P((const struct buf *, const char *, const char *, int,
- int, const struct disklabel *));
-u_int dkcksum __P((struct disklabel *));
-int setdisklabel __P((struct disklabel *, struct disklabel *, u_long,
- struct cpu_disklabel *));
-const char *readdisklabel __P((dev_t, void (*)(struct buf *),
- struct disklabel *, struct cpu_disklabel *));
-int writedisklabel __P((dev_t, void (*)(struct buf *), struct disklabel *,
- struct cpu_disklabel *));
-int bounds_check_with_label __P((struct disk *, struct buf *, int));
-int bounds_check_with_mediasize __P((struct buf *, int, u_int64_t));
-#endif
-#endif /* _LOCORE */
-
-#if !defined(_KERNEL) && !defined(_LOCORE)
-
-#if 0 /* XXX ffsdrv */
-#include <sys/cdefs.h>
-#endif
-
-#endif
-
-#endif /* !_SYS_DISKLABEL_H_ */
diff --git a/drivers/filesystems/ffs/inc/ffsdrv.h b/drivers/filesystems/ffs/inc/ffsdrv.h
deleted file mode 100644
index c30f8566e8b..00000000000
--- a/drivers/filesystems/ffs/inc/ffsdrv.h
+++ /dev/null
@@ -1,2178 +0,0 @@
-/*
- * FFS File System Driver for Windows
- *
- * ffsdrv.h
- *
- * 2004.5.6 ~
- *
- * Lee Jae-Hong, http://www.pyrasis.com
- *
- */
-
-#ifndef _FFS_HEADER_
-#define _FFS_HEADER_
-
-/* include files */
-#ifdef __REACTOS__
-#include <ntifs.h>
-#include <ntddk.h>
-#include <ntdddisk.h>
-#include <pseh/pseh2.h>
-#endif
-#include "fs.h"
-#include "dinode.h"
-#include "dir.h"
-#include "disklabel.h"
-#ifndef __REACTOS__
-#include <ntdddisk.h>
-#endif
-
-#ifndef _PREFAST_
-#ifdef _MSC_VER
-#pragma warning(disable:4068)
-#endif
-#define __drv_mustHoldCriticalRegion
-#endif // !_PREFAST_
-
-#pragma pack(1)
-
-/* debug */
-#if DBG
- #define FFSBreakPoint() /*__asm int 3*/ //DbgBreakPoint()
-#else
- #define FFSBreakPoint()
-#endif
-
-/* Structs & Consts */
-
-#define FFSDRV_VERSION "0.5.2"
-
-/*
- * ffsdrv build options
- */
-
-/* To build read-only driver */
-
-#define FFS_READ_ONLY TRUE
-
-
-/* To support driver dynamics unload */
-
-#define FFS_UNLOAD TRUE
-
-/*
- * Constants
- */
-
-#define FFS_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 SUPER_BLOCK_OFFSET (0x2000)
-#define SUPER_BLOCK_SIZE SBLOCKSIZE
-
-#define READ_AHEAD_GRANULARITY (0x10000)
-
-#define SUPER_BLOCK (Vcb->ffs_super_block)
-#define FS_VERSION (Vcb->FSVersion)
-
-#define BLOCK_SIZE (Vcb->BlockSize)
-#define BLOCK_BITS FFSLog2(Vcb->BlockSize)
-
-#define INODES_COUNT (Vcb->ffs_super_block->s_inodes_count)
-
-#define INODES_PER_GROUP (SUPER_BLOCK->fs_ipg)
-#define BLOCKS_PER_GROUP (SUPER_BLOCK->fs_fpg)
-#define TOTAL_BLOCKS (SUPER_BLOCK->fs_size)
-
-
-
-/* File System Releated */
-
-#define DRIVER_NAME "FFS"
-#ifndef __REACTOS__
-#define DEVICE_NAME L"\\FileSystem\\FFS"
-#else
-#define DEVICE_NAME L"\\FFS"
-#endif
-
-/* Registry */
-
-#define PARAMETERS_KEY L"\\Parameters"
-
-#define WRITING_SUPPORT L"WritingSupport"
-#define CHECKING_BITMAP L"CheckingBitmap"
-#define PARTITION_NUMBER L"PartitionNumber"
-
-/* To support select BSD partition and ffsdrv unload routine */
-#define DOS_DEVICE_NAME L"\\DosDevices\\ffs"
-
-/*
- * Private IOCTL to make the driver ready to unload
- */
-#if FFS_UNLOAD
-#define IOCTL_PREPARE_TO_UNLOAD \
-CTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_NEITHER, FILE_WRITE_ACCESS)
-#endif // FFS_UNLOAD
-
-/*
- * Private IOCTL to select BSD partition.
- */
-#define IOCTL_SELECT_BSD_PARTITION \
-CTL_CODE(FILE_DEVICE_UNKNOWN, 2049, METHOD_BUFFERED, FILE_WRITE_ACCESS)
-
-
-#ifndef SetFlag
-#define SetFlag(x,f) ((x) |= (f))
-#endif
-
-#ifndef ClearFlag
-#define ClearFlag(x,f) ((x) &= ~(f))
-#endif
-
-#define IsFlagOn(a,b) ((BOOLEAN)(FlagOn(a,b) == b))
-
-#define FFSRaiseStatus(IRPCONTEXT,STATUS) { \
- (IRPCONTEXT)->ExceptionCode = (STATUS); \
- ExRaiseStatus( (STATUS) ); \
-}
-
-#define FFSNormalizeAndRaiseStatus(IRPCONTEXT,STATUS) { \
- /* (IRPCONTEXT)->ExceptionStatus = (STATUS); */ \
- if ((STATUS) == STATUS_VERIFY_REQUIRED) { ExRaiseStatus((STATUS)); } \
- ExRaiseStatus(FsRtlNormalizeNtstatus((STATUS),STATUS_UNEXPECTED_IO_ERROR)); \
-}
-
-/*
- * Define IsEndofFile for read and write operations
- */
-
-#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
-#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
-
-#define IsEndOfFile(Pos) ((Pos.LowPart == FILE_WRITE_TO_END_OF_FILE) && \
- (Pos.HighPart == FILE_USE_FILE_POINTER_POSITION ))
-
-#define IsDirectory(Fcb) IsFlagOn(Fcb->FFSMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)
-
-/*
- * Bug Check Codes Definitions
- */
-
-#define FFS_FILE_SYSTEM (FILE_SYSTEM)
-
-#define FFS_BUGCHK_BLOCK (0x00010000)
-#define FFS_BUGCHK_CLEANUP (0x00020000)
-#define FFS_BUGCHK_CLOSE (0x00030000)
-#define FFS_BUGCHK_CMCB (0x00040000)
-#define FFS_BUGCHK_CREATE (0x00050000)
-#define FFS_BUGCHK_DEBUG (0x00060000)
-#define FFS_BUGCHK_DEVCTL (0x00070000)
-#define FFS_BUGCHK_DIRCTL (0x00080000)
-#define FFS_BUGCHK_DISPATCH (0x00090000)
-#define FFS_BUGCHK_EXCEPT (0x000A0000)
-#define FFS_BUGCHK_FFS (0x000B0000)
-#define FFS_BUGCHK_FASTIO (0x000C0000)
-#define FFS_BUGCHK_FILEINFO (0x000D0000)
-#define FFS_BUGCHK_FLUSH (0x000E0000)
-#define FFS_BUGCHK_FSCTL (0x000F0000)
-#define FFS_BUGCHK_INIT (0x00100000)
-#define FFS_BUGCHK_LOCK (0x0011000)
-#define FFS_BUGCHK_MEMORY (0x0012000)
-#define FFS_BUGCHK_MISC (0x0013000)
-#define FFS_BUGCHK_READ (0x00140000)
-#define FFS_BUGCHK_SHUTDOWN (0x00150000)
-#define FFS_BUGCHK_VOLINFO (0x00160000)
-#define FFS_BUGCHK_WRITE (0x00170000)
-
-#define FFS_BUGCHK_LAST (0x00170000)
-
-#define FFSBugCheck(A,B,C,D) { KeBugCheckEx(FFS_FILE_SYSTEM, A | __LINE__, B, C, D ); }
-
-
-/* FFS file system definions */
-
-/*
- * Structure of a directory entry
- */
-#define FFS_NAME_LEN 255
-
-#define FFS_ROOT_INO 2 /* Root inode */
-
-
-/*
- * FFS_DIR_PAD defines the directory entries boundaries
- *
- * NOTE: It must be a multiple of 4
- */
-#define FFS_DIR_PAD 4
-#define FFS_DIR_ROUND (FFS_DIR_PAD - 1)
-#define FFS_DIR_REC_LEN(name_len) (((name_len) + 8 + FFS_DIR_ROUND) & \
- ~FFS_DIR_ROUND)
-
-
-/* sys/sys/stat.h */
-
-#define S_ISDIR(m) ((m & _S_IFMT) == _S_IFDIR) /* directory */
-#define S_ISCHR(m) ((m & _S_IFMT) == _S_IFCHR) /* char special */
-#define S_ISBLK(m) ((m & _S_IFMT) == _S_IFBLK) /* block special */
-#define S_ISREG(m) ((m & _S_IFMT) == _S_IFREG) /* regular file */
-#define S_ISFIFO(m) ((m & _S_IFMT) == _S_IFIFO) /* fifo */
-#define S_ISLNK(m) ((m & _S_IFMT) == _S_IFLNK) /* symbolic link */
-#define S_ISSOCK(m) ((m & _S_IFMT) == _S_IFSOCK) /* socket */
-#define S_ISWHT(m) ((m & _S_IFMT) == _S_IFWHT) /* whiteout */
-
-
-#define S_IPERMISSION_MASK 0x1FF /* */
-
-#define S_IRWXU 0000700 /* RWX mask for owner */
-#define S_IRUSR 0000400 /* R for owner */
-#define S_IWUSR 0000200 /* W for owner */
-#define S_IXUSR 0000100 /* X for owner */
-
-#define S_IRWXG 0000070 /* RWX mask for group */
-#define S_IRGRP 0000040 /* R for group */
-#define S_IWGRP 0000020 /* W for group */
-#define S_IXGRP 0000010 /* X for group */
-
-#define S_IRWXO 0000007 /* RWX mask for other */
-#define S_IROTH 0000004 /* R for other */
-#define S_IWOTH 0000002 /* W for other */
-#define S_IXOTH 0000001 /* X for other */
-
-#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 FFSSetReadable(m) (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))
-#define FFSSetWritable(m) (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))
-
-#define FFSSetReadOnly(m) (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))
-#define FFSIsReadOnly(m) (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))
-
-#define FFS_FIRST_DATA_BLOCK (Vcb->ffs_super_block->fs_dblkno)
-
-typedef struct fs FFS_SUPER_BLOCK, *PFFS_SUPER_BLOCK;
-
-typedef struct disklabel DISKLABEL, *PDISKLABEL;
-
-typedef struct ufs1_dinode FFSv1_INODE, *PFFSv1_INODE;
-typedef struct ufs2_dinode FFSv2_INODE, *PFFSv2_INODE;
-
-typedef struct direct FFS_DIR_ENTRY, *PFFS_DIR_ENTRY;
-
-
-/*
- * ffsdrv Driver Definitions
- */
-
-/*
- * FFS_IDENTIFIER_TYPE
- *
- * Identifiers used to mark the structures
- */
-
-typedef enum _FFS_IDENTIFIER_TYPE {
- FFSFGD = ':DGF',
- FFSVCB = ':BCV',
- FFSFCB = ':BCF',
- FFSCCB = ':BCC',
- FFSICX = ':XCI',
- FFSDRV = ':VRD',
- FFSMCB = ':BCM'
-} FFS_IDENTIFIER_TYPE;
-
-/*
- * FFS_IDENTIFIER
- *
- * Header used to mark the structures
- */
-typedef struct _FFS_IDENTIFIER {
- FFS_IDENTIFIER_TYPE Type;
- ULONG Size;
-} FFS_IDENTIFIER, *PFFS_IDENTIFIER;
-
-
-#define NodeType(Ptr) (*((FFS_IDENTIFIER_TYPE *)(Ptr)))
-
-typedef struct _FFS_MCB FFS_MCB, *PFFS_MCB;
-
-
-typedef PVOID PBCB;
-
-/*
- * REPINNED_BCBS List
- */
-
-#define FFS_REPINNED_BCBS_ARRAY_SIZE (8)
-
-typedef struct _FFS_REPINNED_BCBS {
-
- //
- // A pointer to the next structure contains additional repinned bcbs
- //
-
- struct _FFS_REPINNED_BCBS *Next;
-
- //
- // A fixed size array of pinned bcbs. Whenever a new bcb is added to
- // the repinned bcb structure it is added to this array. If the
- // array is already full then another repinned bcb structure is allocated
- // and pointed to with Next.
- //
-
- PBCB Bcb[ FFS_REPINNED_BCBS_ARRAY_SIZE ];
-
-} FFS_REPINNED_BCBS, *PFFS_REPINNED_BCBS;
-
-
-/*
- * FFS_BSD_PARTITION
- */
-typedef struct _FFS_BSD_PARTITION
-{
- ULONG Number;
-} FFS_BSD_PARTITION, *PFFS_BSD_PARTITION;
-
-
-/*
- * FFS_GLOBAL_DATA
- *
- * Data that is not specific to a mounted volume
- */
-typedef struct _FFS_GLOBAL {
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-
- // Syncronization primitive for this structure
- ERESOURCE Resource;
-
- // Syncronization primitive for Counting
- ERESOURCE CountResource;
-
- // Syncronization primitive for LookAside Lists
- ERESOURCE LAResource;
-
- // Table of pointers to the fast I/O entry points
- FAST_IO_DISPATCH FastIoDispatch;
-
- // Table of pointers to the Cache Manager callbacks
- CACHE_MANAGER_CALLBACKS CacheManagerCallbacks;
- CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks;
-
- // Pointer to the driver object
- PDRIVER_OBJECT DriverObject;
-
- // Pointer to the main device object
- PDEVICE_OBJECT DeviceObject;
-
- // List of mounted volumes
- LIST_ENTRY VcbList;
-
- // Look Aside table of IRP_CONTEXT, FCB, MCB, CCB
- USHORT MaxDepth;
- NPAGED_LOOKASIDE_LIST FFSIrpContextLookasideList;
- NPAGED_LOOKASIDE_LIST FFSFcbLookasideList;
- NPAGED_LOOKASIDE_LIST FFSCcbLookasideList;
- PAGED_LOOKASIDE_LIST FFSMcbLookasideList;
-
- // Mcb Count ...
- USHORT McbAllocated;
-
-#if DBG
- // Fcb Count
- USHORT FcbAllocated;
-
- // IRP_MJ_CLOSE : FCB
- USHORT IRPCloseCount;
-#endif
-
- // Global flags for the driver
- ULONG Flags;
-
- ULONG PartitionNumber;
-
-} FFS_GLOBAL, *PFFS_GLOBAL;
-
-/*
- * Flags for FFS_GLOBAL_DATA
- */
-#define FFS_UNLOAD_PENDING 0x00000001
-#define FFS_SUPPORT_WRITING 0x00000002
-#define FFS_CHECKING_BITMAP 0x00000008
-
-/*
- * Driver Extension define
- */
-typedef struct {
- FFS_GLOBAL FFSGlobal;
-} FFS_EXT, *PFFS_EXT;
-
-
-typedef struct _FFS_FCBVCB {
-
- // FCB header required by NT
- FSRTL_COMMON_FCB_HEADER CommonFCBHeader;
- SECTION_OBJECT_POINTERS SectionObject;
- ERESOURCE MainResource;
- ERESOURCE PagingIoResource;
- // end FCB header required by NT
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-} FFS_FCBVCB, *PFFS_FCBVCB;
-
-/*
- * FFS_VCB Volume Control Block
- *
- * Data that represents a mounted logical volume
- * It is allocated as the device extension of the volume device object
- */
-typedef struct _FFS_VCB {
-
- // FCB header required by NT
- // The VCB is also used as an FCB for file objects
- // that represents the volume itself
- FSRTL_COMMON_FCB_HEADER Header;
- SECTION_OBJECT_POINTERS SectionObject;
- ERESOURCE MainResource;
- ERESOURCE PagingIoResource;
- // end FCB header required by NT
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-
- LIST_ENTRY Next;
-
- // Share Access for the file object
- SHARE_ACCESS ShareAccess;
-
- // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
- // for files on this volume.
- ULONG OpenFileHandleCount;
-
- // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
- // for both files on this volume and open instances of the
- // volume itself.
- ULONG ReferenceCount;
- ULONG OpenHandleCount;
-
- //
- // Disk change count
- //
-
- ULONG ChangeCount;
-
- // Pointer to the VPB in the target device object
- PVPB Vpb;
-
- // The FileObject of Volume used to lock the volume
- PFILE_OBJECT LockFile;
-
- // List of FCBs for open files on this volume
- LIST_ENTRY FcbList;
-
- // List of IRPs pending on directory change notify requests
- LIST_ENTRY NotifyList;
-
- // Pointer to syncronization primitive for this list
- PNOTIFY_SYNC NotifySync;
-
- // This volumes device object
- PDEVICE_OBJECT DeviceObject;
-
- // The physical device object (the disk)
- PDEVICE_OBJECT TargetDeviceObject;
-
- // The physical device object (the disk)
- PDEVICE_OBJECT RealDevice;
-
- // Information about the physical device object
- DISK_GEOMETRY DiskGeometry;
- PARTITION_INFORMATION PartitionInformation;
-
- // File System Super Block
- PFFS_SUPER_BLOCK ffs_super_block;
-
- // File System version
- ULONG FSVersion;
-
- // Number of Group Decsciptions
- ULONG ffs_groups;
- /*
- // Bitmap Block per group
- PRTL_BITMAP BlockBitMaps;
- PRTL_BITMAP InodeBitMaps;
- */
- // Block / Cluster size
- ULONG BlockSize;
-
- // Sector size in bits
- ULONG SectorBits;
-
- ULONG dwData[FFS_BLOCK_TYPES];
- ULONG dwMeta[FFS_BLOCK_TYPES];
-
- // Flags for the volume
- ULONG Flags;
-
- // Streaming File Object
- PFILE_OBJECT StreamObj;
-
- // Resource Lock for Mcb
- ERESOURCE McbResource;
-
- // Dirty Mcbs of modifications for volume stream
- LARGE_MCB DirtyMcbs;
-
- // Entry of Mcb Tree (Root Node)
- PFFS_MCB McbTree;
- LIST_ENTRY McbList;
-
- ULONGLONG FSOffset[MAXPARTITIONS];
-
- ULONG RootPartition;
-
- ULONG PartitionNumber;
-
-} FFS_VCB, *PFFS_VCB;
-
-/*
- * Flags for FFS_VCB
- */
-#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))
-
-
-/*
- * FFS_FCB File Control Block
- *
- * Data that represents an open file
- * There is a single instance of the FCB for every open file
- */
-typedef struct _FFS_FCB {
-
- // FCB header required by NT
- FSRTL_COMMON_FCB_HEADER Header;
- SECTION_OBJECT_POINTERS SectionObject;
- ERESOURCE MainResource;
- ERESOURCE PagingIoResource;
- // end FCB header required by NT
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-
- // List of FCBs for this volume
- LIST_ENTRY Next;
-
- // Share Access for the file object
- SHARE_ACCESS ShareAccess;
-
- // List of byte-range locks for this file
- FILE_LOCK FileLockAnchor;
-
- // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
- ULONG OpenHandleCount;
-
- // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
- ULONG ReferenceCount;
-
- // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
- // But only for Files with FO_NO_INTERMEDIATE_BUFFERING flag
- ULONG NonCachedOpenCount;
-
- // Flags for the FCB
- ULONG Flags;
-
- // Pointer to the inode
- PFFSv1_INODE dinode1;
- PFFSv2_INODE dinode2;
-
- // Hint block for next allocation
- ULONG BlkHint;
-
- // Vcb
-
- PFFS_VCB Vcb;
-
- // Mcb Node ...
- PFFS_MCB FFSMcb;
-
- // Full Path Name
- UNICODE_STRING LongName;
-
-#if DBG
- // The Ansi Filename for debugging
- OEM_STRING AnsiFileName;
-#endif
-
-
-} FFS_FCB, *PFFS_FCB;
-
-
-//
-// Flags for FFS_FCB
-//
-#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
-
-// Mcb Node
-
-struct _FFS_MCB {
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-
- // Flags
- ULONG Flags;
-
- // Link List Info
-
- PFFS_MCB Parent; // Parent
- PFFS_MCB Child; // Children
- PFFS_MCB Next; // Brothers
-
- // Mcb Node Info
-
- // -> Fcb
- PFFS_FCB FFSFcb;
-
- // Short name
- UNICODE_STRING ShortName;
-
- // Inode number
- ULONG Inode;
-
- // Dir entry offset in parent
- ULONG DeOffset;
-
- // File attribute
- ULONG FileAttr;
-
- // List Link to Vcb->McbList
- LIST_ENTRY Link;
-};
-
-/*
- * Flags for MCB
- */
-#define MCB_FROM_POOL 0x00000001
-#define MCB_IN_TREE 0x00000002
-#define MCB_IN_USE 0x00000004
-
-#define IsMcbUsed(Mcb) IsFlagOn(Mcb->Flags, MCB_IN_USE)
-
-
-/*
- * FFS_CCB Context Control Block
- *
- * Data that represents one instance of an open file
- * There is one instance of the CCB for every instance of an open file
- */
-typedef struct _FFS_CCB {
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-
- // Flags
- ULONG Flags;
-
- // State that may need to be maintained
- ULONG CurrentByteOffset;
- UNICODE_STRING DirectorySearchPattern;
-
-} FFS_CCB, *PFFS_CCB;
-
-/*
- * Flags for CCB
- */
-
-#define CCB_FROM_POOL 0x00000001
-
-#define CCB_ALLOW_EXTENDED_DASD_IO 0x80000000
-
-
-/*
- * FFS_IRP_CONTEXT
- *
- * Used to pass information about a request between the drivers functions
- */
-typedef struct _FFS_IRP_CONTEXT {
-
- // Identifier for this structure
- FFS_IDENTIFIER Identifier;
-
- // Pointer to the IRP this request describes
- PIRP Irp;
-
- // Flags
- ULONG Flags;
-
- // The major and minor function code for the request
- UCHAR MajorFunction;
- UCHAR MinorFunction;
-
- // The device object
- PDEVICE_OBJECT DeviceObject;
-
- // The real device object
- PDEVICE_OBJECT RealDevice;
-
- // The file object
- PFILE_OBJECT FileObject;
-
- PFFS_FCB Fcb;
- PFFS_CCB Ccb;
-
- // If the request is synchronous (we are allowed to block)
- BOOLEAN IsSynchronous;
-
- // If the request is top level
- BOOLEAN IsTopLevel;
-
- // Used if the request needs to be queued for later processing
- WORK_QUEUE_ITEM WorkQueueItem;
-
- // If an exception is currently in progress
- BOOLEAN ExceptionInProgress;
-
- // The exception code when an exception is in progress
- NTSTATUS ExceptionCode;
-
- // Repinned BCBs List
- FFS_REPINNED_BCBS Repinned;
-
-} FFS_IRP_CONTEXT, *PFFS_IRP_CONTEXT;
-
-
-#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)
-
-
-/*
- * FFS_ALLOC_HEADER
- *
- * In the checked version of the driver this header is put in the beginning of
- * every memory allocation
- */
-typedef struct _FFS_ALLOC_HEADER {
- FFS_IDENTIFIER Identifier;
-} FFS_ALLOC_HEADER, *PFFS_ALLOC_HEADER;
-
-typedef struct _FCB_LIST_ENTRY {
- PFFS_FCB Fcb;
- LIST_ENTRY Next;
-} FCB_LIST_ENTRY, *PFCB_LIST_ENTRY;
-
-
-/* Block Description List */
-typedef struct _FFS_BDL {
- LONGLONG Lba;
- ULONG Offset;
- ULONG Length;
- PIRP Irp;
-} FFS_BDL, *PFFS_BDL;
-
-#pragma pack()
-
-
-/*
- * The following macro is used to determine if an FSD thread can block
- * for I/O or wait for a resource. It returns TRUE if the thread can
- * block and FALSE otherwise. This attribute can then be used to call
- * the FSD & FSP common work routine with the proper wait value.
- */
-
-#define CanFFSWait(IRP) IoIsOperationSynchronous(Irp)
-
-#define FFS_POOL_TAG 'dsfF'
-
-//
-// Block.c
-//
-
-NTSTATUS
-FFSLockUserBuffer(
- IN PIRP Irp,
- IN ULONG Length,
- IN LOCK_OPERATION Operation);
-PVOID
-FFSGetUserBuffer(
- IN PIRP Irp);
-
-NTSTATUS
-FFSReadWriteBlocks(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_BDL FFSBDL,
- IN ULONG Length,
- IN ULONG Count,
- IN BOOLEAN bVerify);
-
-NTSTATUS
-FFSReadSync(
- IN PFFS_VCB Vcb,
- IN ULONGLONG Offset,
- IN ULONG Length,
- OUT PVOID Buffer,
- IN BOOLEAN bVerify);
-
-NTSTATUS
-FFSReadDisk(
- IN PFFS_VCB Vcb,
- IN ULONGLONG Offset,
- IN ULONG Size,
- IN PVOID Buffer,
- IN BOOLEAN bVerify);
-
-NTSTATUS
-FFSDiskIoControl(
- IN PDEVICE_OBJECT DeviceOjbect,
- IN ULONG IoctlCode,
- IN PVOID InputBuffer,
- IN ULONG InputBufferSize,
- IN OUT PVOID OutputBuffer,
- IN OUT PULONG OutputBufferSize);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSMediaEjectControl(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN BOOLEAN bPrevent);
-
-NTSTATUS
-FFSDiskShutDown(
- PFFS_VCB Vcb);
-
-
-//
-// Cleanup.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSCleanup(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Close.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSClose(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-VOID
-FFSQueueCloseRequest(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-#ifdef _PREFAST_
-IO_WORKITEM_ROUTINE FFSDeQueueCloseRequest;
-#endif // _PREFAST_
-
-VOID NTAPI
-FFSDeQueueCloseRequest(
- IN PVOID Context);
-
-
-//
-// Cmcb.c
-//
-
-__drv_mustHoldCriticalRegion
-BOOLEAN NTAPI
-FFSAcquireForLazyWrite(
- IN PVOID Context,
- IN BOOLEAN Wait);
-
-__drv_mustHoldCriticalRegion
-VOID NTAPI
-FFSReleaseFromLazyWrite(
- IN PVOID Context);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN NTAPI
-FFSAcquireForReadAhead(
- IN PVOID Context,
- IN BOOLEAN Wait);
-
-BOOLEAN NTAPI
-FFSNoOpAcquire(
- IN PVOID Fcb,
- IN BOOLEAN Wait);
-
-VOID NTAPI
-FFSNoOpRelease(
- IN PVOID Fcb);
-
-__drv_mustHoldCriticalRegion
-VOID NTAPI
-FFSReleaseFromReadAhead(
- IN PVOID Context);
-
-
-//
-// Create.c
-//
-
-PFFS_FCB
-FFSSearchFcbList(
- IN PFFS_VCB Vcb,
- IN ULONG inode);
-
-NTSTATUS
-FFSv1ScanDir(
- IN PFFS_VCB Vcb,
- IN PFFS_MCB ParentMcb,
- IN PUNICODE_STRING FileName,
- IN OUT PULONG Index,
- IN PFFSv1_INODE dinode1,
- IN PFFS_DIR_ENTRY ffs_dir);
-
-NTSTATUS
-FFSv2ScanDir(
- IN PFFS_VCB Vcb,
- IN PFFS_MCB ParentMcb,
- IN PUNICODE_STRING FileName,
- IN OUT PULONG Index,
- IN PFFSv2_INODE dinode2,
- IN PFFS_DIR_ENTRY ffs_dir);
-
-NTSTATUS
-FFSv1LookupFileName(
- IN PFFS_VCB Vcb,
- IN PUNICODE_STRING FullFileName,
- IN PFFS_MCB ParentMcb,
- OUT PFFS_MCB* FFSMcb,
- IN OUT PFFSv1_INODE dinode1);
-
-
-NTSTATUS
-FFSv2LookupFileName(
- IN PFFS_VCB Vcb,
- IN PUNICODE_STRING FullFileName,
- IN PFFS_MCB ParentMcb,
- OUT PFFS_MCB* FFSMcb,
- IN OUT PFFSv2_INODE dinode2);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSCreateFile(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSCreateVolume(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSCreate(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSCreateInode(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB ParentFcb,
- ULONG Type,
- ULONG FileAttr,
- PUNICODE_STRING FileName);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSSupersedeOrOverWriteFile(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Fcb,
- IN ULONG Disposition);
-
-
-//
-// Debug.c
-//
-
-#define DBG_VITAL 0
-#define DBG_ERROR 1
-#define DBG_USER 2
-#define DBG_TRACE 3
-#define DBG_INFO 4
-#define DBG_FUNC 5
-
-#if DBG
-#define FFSPrint(arg) FFSPrintf arg
-#define FFSPrintNoIndent(arg) FFSNIPrintf arg
-
-#define FFSCompleteRequest(Irp, bPrint, PriorityBoost) \
- FFSDbgPrintComplete(Irp, bPrint); \
- IoCompleteRequest(Irp, PriorityBoost)
-
-#else
-
-#define FFSPrint(arg)
-
-#define FFSCompleteRequest(Irp, bPrint, PriorityBoost) \
- IoCompleteRequest(Irp, PriorityBoost)
-
-#endif // DBG
-
-VOID
-__cdecl
-FFSPrintf(
- LONG DebugPrintLevel,
- PCHAR DebugMessage,
- ...);
-
-VOID
-__cdecl
-FFSNIPrintf(
- LONG DebugPrintLevel,
- PCHAR DebugMessage,
- ...);
-
-extern ULONG ProcessNameOffset;
-
-#define FFSGetCurrentProcessName() ( \
- (PCHAR) PsGetCurrentProcess() + ProcessNameOffset \
-)
-
-ULONG
-FFSGetProcessNameOffset(
- VOID);
-
-VOID
-FFSDbgPrintCall(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp);
-
-VOID
-FFSDbgPrintComplete(
- IN PIRP Irp,
- IN BOOLEAN bPrint);
-
-PCHAR
-FFSNtStatusToString(
- IN NTSTATUS Status);
-
-
-//
-// Devctl.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSDeviceControlNormal(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPrepareToUnload(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSDeviceControl(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Dirctl.c
-//
-
-ULONG
-FFSGetInfoLength(
- IN FILE_INFORMATION_CLASS FileInformationClass);
-
-ULONG
-FFSProcessDirEntry(
- IN PFFS_VCB Vcb,
- IN FILE_INFORMATION_CLASS FileInformationClass,
- IN ULONG in,
- IN PVOID Buffer,
- IN ULONG UsedLength,
- IN ULONG Length,
- IN ULONG FileIndex,
- IN PUNICODE_STRING pName,
- IN BOOLEAN Single);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSQueryDirectory(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSNotifyChangeDirectory(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-VOID
-FFSNotifyReportChange(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Fcb,
- IN ULONG Filter,
- IN ULONG Action);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSDirectoryControl(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-BOOLEAN
-FFSIsDirectoryEmpty(
- PFFS_VCB Vcb,
- PFFS_FCB Dcb);
-
-
-//
-// Dispatch.c
-//
-
-NTSTATUS
-FFSQueueRequest(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-#ifdef _PREFAST_
-IO_WORKITEM_ROUTINE FFSDeQueueRequest;
-#endif // _PREFAST_
-
-VOID NTAPI
-FFSDeQueueRequest(
- IN PVOID Context);
-
-NTSTATUS
-FFSDispatchRequest(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-#ifdef _PREFAST_
-__drv_dispatchType(IRP_MJ_CREATE)
-__drv_dispatchType(IRP_MJ_CLOSE)
-__drv_dispatchType(IRP_MJ_READ)
-__drv_dispatchType(IRP_MJ_WRITE)
-__drv_dispatchType(IRP_MJ_QUERY_INFORMATION)
-__drv_dispatchType(IRP_MJ_SET_INFORMATION)
-__drv_dispatchType(IRP_MJ_FLUSH_BUFFERS)
-__drv_dispatchType(IRP_MJ_QUERY_VOLUME_INFORMATION)
-__drv_dispatchType(IRP_MJ_SET_VOLUME_INFORMATION)
-__drv_dispatchType(IRP_MJ_DIRECTORY_CONTROL)
-__drv_dispatchType(IRP_MJ_FILE_SYSTEM_CONTROL)
-__drv_dispatchType(IRP_MJ_DEVICE_CONTROL)
-__drv_dispatchType(IRP_MJ_SHUTDOWN)
-__drv_dispatchType(IRP_MJ_LOCK_CONTROL)
-__drv_dispatchType(IRP_MJ_CLEANUP)
-__drv_dispatchType(IRP_MJ_PNP)
-DRIVER_DISPATCH FFSBuildRequest;
-#endif // _PREFAST_
-
-NTSTATUS NTAPI
-FFSBuildRequest(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp);
-
-
-//
-// Except.c
-//
-
-NTSTATUS
-FFSExceptionFilter(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PEXCEPTION_POINTERS ExceptionPointer);
-
-NTSTATUS
-FFSExceptionHandler(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// ffs.c
-//
-
-PFFS_SUPER_BLOCK
-FFSLoadSuper(
- IN PFFS_VCB Vcb,
- IN BOOLEAN bVerify,
- IN ULONGLONG SuperBlockOffset);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSSaveSuper(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb);
-
-BOOLEAN
-FFSLoadGroup(
- IN PFFS_VCB Vcb);
-
-BOOLEAN
-FFSSaveGroup(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb);
-
-BOOLEAN
-FFSv1GetInodeLba(
- IN PFFS_VCB Vcb,
- IN ULONG inode,
- OUT PLONGLONG offset);
-
-BOOLEAN
-FFSv2GetInodeLba(
- IN PFFS_VCB Vcb,
- IN ULONG inode,
- OUT PLONGLONG offset);
-
-BOOLEAN
-FFSv1LoadInode(
- IN PFFS_VCB Vcb,
- IN ULONG inode,
- IN PFFSv1_INODE dinode1);
-
-BOOLEAN
-FFSv2LoadInode(
- IN PFFS_VCB Vcb,
- IN ULONG inode,
- IN PFFSv2_INODE dinode2);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSv1SaveInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN ULONG Inode,
- IN PFFSv1_INODE dinode1);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSv2SaveInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN ULONG Inode,
- IN PFFSv2_INODE dinode2);
-
-BOOLEAN
-FFSv1LoadBlock(
- IN PFFS_VCB Vcb,
- IN ULONG dwBlk,
- IN PVOID Buffer);
-
-BOOLEAN
-FFSv2LoadBlock(
- IN PFFS_VCB Vcb,
- IN ULONGLONG dwBlk,
- IN PVOID Buffer);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSSaveBlock(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN ULONG dwBlk,
- IN PVOID Buf);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSSaveBuffer(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN LONGLONG Offset,
- IN ULONG Size,
- IN PVOID Buf);
-
-ULONG
-FFSv1GetBlock(
- IN PFFS_VCB Vcb,
- IN ULONG dwContent,
- IN ULONG Index,
- IN int layer);
-
-ULONGLONG
-FFSv2GetBlock(
- IN PFFS_VCB Vcb,
- IN ULONGLONG dwContent,
- IN ULONG Index,
- IN int layer);
-
-ULONG
-FFSv1BlockMap(
- IN PFFS_VCB Vcb,
- IN PFFSv1_INODE dinode1,
- IN ULONG Index);
-
-ULONGLONG
-FFSv2BlockMap(
- IN PFFS_VCB Vcb,
- IN PFFSv2_INODE dinode2,
- IN ULONG Index);
-
-ULONG
-FFSv1BuildBDL(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFSv1_INODE dinode1,
- IN ULONGLONG Offset,
- IN ULONG Size,
- OUT PFFS_BDL *ffs_bdl);
-
-ULONG
-FFSv2BuildBDL(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFSv2_INODE dinode2,
- IN ULONGLONG Offset,
- IN ULONG Size,
- OUT PFFS_BDL *ffs_bdl);
-
-BOOLEAN
-FFSNewBlock(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- ULONG GroupHint,
- ULONG BlockHint,
- PULONG dwRet);
-
-BOOLEAN
-FFSFreeBlock(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- ULONG Block);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSExpandBlock(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb,
- ULONG dwContent,
- ULONG Index,
- ULONG layer,
- BOOLEAN bNew,
- ULONG *dwRet);
-
-BOOLEAN
-FFSExpandInode(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb,
- ULONG *dwRet);
-
-NTSTATUS
-FFSNewInode(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- ULONG GroupHint,
- ULONG Type,
- PULONG Inode);
-
-BOOLEAN
-FFSFreeInode(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- ULONG Inode,
- ULONG Type);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSAddEntry(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Dcb,
- IN ULONG FileType,
- IN ULONG Inode,
- IN PUNICODE_STRING FileName);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSRemoveEntry(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Dcb,
- IN ULONG FileType,
- IN ULONG Inode);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSSetParentEntry(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Dcb,
- IN ULONG OldParent,
- IN ULONG NewParent);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSTruncateBlock(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Fcb,
- IN ULONG dwContent,
- IN ULONG Index,
- IN ULONG layer,
- OUT BOOLEAN *bFreed);
-
-BOOLEAN
-FFSTruncateInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_FCB Fcb);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSAddMcbEntry(
- IN PFFS_VCB Vcb,
- IN LONGLONG Lba,
- IN LONGLONG Length);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSRemoveMcbEntry(
- IN PFFS_VCB Vcb,
- IN LONGLONG Lba,
- IN LONGLONG Length);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSLookupMcbEntry(
- IN PFFS_VCB Vcb,
- IN LONGLONG Lba,
- OUT PLONGLONG pLba,
- OUT PLONGLONG pLength,
- OUT PLONGLONG RunStart,
- OUT PLONGLONG RunLength,
- OUT PULONG Index);
-
-ULONG
-FFSDataBlocks(
- PFFS_VCB Vcb,
- ULONG TotalBlocks);
-
-ULONG
-FFSTotalBlocks(
- PFFS_VCB Vcb,
- ULONG DataBlocks);
-
-
-//
-// Fastio.c
-//
-
-#ifdef _PREFAST_
-FAST_IO_CHECK_IF_POSSIBLE FFSFastIoCheckIfPossible;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoCheckIfPossible(
- 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);
-
-#ifdef _PREFAST_
-FAST_IO_READ FFSFastIoRead;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoRead(
- 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);
-
-#ifdef _PREFAST_
-FAST_IO_WRITE FFSFastIoWrite;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoWrite(
- 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);
-
-#ifdef _PREFAST_
-FAST_IO_QUERY_BASIC_INFO FFSFastIoQueryBasicInfo;
-#endif // _PREFAST_
-
-__drv_mustHoldCriticalRegion
-BOOLEAN NTAPI
-FFSFastIoQueryBasicInfo(
- IN PFILE_OBJECT FileObject,
- IN BOOLEAN Wait,
- OUT PFILE_BASIC_INFORMATION Buffer,
- OUT PIO_STATUS_BLOCK IoStatus,
- IN PDEVICE_OBJECT DeviceObject);
-
-#ifdef _PREFAST_
-FAST_IO_QUERY_STANDARD_INFO FFSFastIoQueryStandardInfo;
-#endif // _PREFAST_
-
-__drv_mustHoldCriticalRegion
-BOOLEAN NTAPI
-FFSFastIoQueryStandardInfo(
- IN PFILE_OBJECT FileObject,
- IN BOOLEAN Wait,
- OUT PFILE_STANDARD_INFORMATION Buffer,
- OUT PIO_STATUS_BLOCK IoStatus,
- IN PDEVICE_OBJECT DeviceObject);
-
-#ifdef _PREFAST_
-FAST_IO_LOCK FFSFastIoLock;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoLock(
- 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);
-
-#ifdef _PREFAST_
-FAST_IO_UNLOCK_SINGLE FFSFastIoUnlockSingle;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoUnlockSingle(
- 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);
-
-#ifdef _PREFAST_
-FAST_IO_UNLOCK_ALL FFSFastIoUnlockAll;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoUnlockAll(
- IN PFILE_OBJECT FileObject,
- IN PEPROCESS Process,
- OUT PIO_STATUS_BLOCK IoStatus,
- IN PDEVICE_OBJECT DeviceObject);
-
-#ifdef _PREFAST_
-FAST_IO_UNLOCK_ALL_BY_KEY FFSFastIoUnlockAllByKey;
-#endif // _PREFAST_
-
-BOOLEAN NTAPI
-FFSFastIoUnlockAllByKey(
- IN PFILE_OBJECT FileObject,
-#ifndef __REACTOS__
- IN PEPROCESS Process,
-#else
- IN PVOID Process,
-#endif
- IN ULONG Key,
- OUT PIO_STATUS_BLOCK IoStatus,
- IN PDEVICE_OBJECT DeviceObject);
-
-#ifdef _PREFAST_
-FAST_IO_QUERY_NETWORK_OPEN_INFO FFSFastIoQueryNetworkOpenInfo;
-#endif // _PREFAST_
-
-__drv_mustHoldCriticalRegion
-BOOLEAN NTAPI
-FFSFastIoQueryNetworkOpenInfo(
- IN PFILE_OBJECT FileObject,
- IN BOOLEAN Wait,
- OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
- OUT PIO_STATUS_BLOCK IoStatus,
- IN PDEVICE_OBJECT DeviceObject);
-
-//
-// FileInfo.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSQueryInformation(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSSetInformation(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-BOOLEAN
-FFSExpandFile(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb,
- PLARGE_INTEGER AllocationSize);
-
-BOOLEAN
-FFSTruncateFile(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb,
- PLARGE_INTEGER AllocationSize);
-
-NTSTATUS
-FFSSetDispositionInfo(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb,
- BOOLEAN bDelete);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSSetRenameInfo(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSDeleteFile(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- PFFS_FCB Fcb);
-
-
-//
-// Flush.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSFlushFiles(
- IN PFFS_VCB Vcb,
- BOOLEAN bShutDown);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSFlushVolume(
- IN PFFS_VCB Vcb,
- BOOLEAN bShutDown);
-
-NTSTATUS
-FFSFlushFile(
- IN PFFS_FCB Fcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSFlush(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Fsctl.c
-//
-
-VOID
-FFSSetVpbFlag(
- IN PVPB Vpb,
- IN USHORT Flag);
-
-VOID
-FFSClearVpbFlag(
- IN PVPB Vpb,
- IN USHORT Flag);
-
-NTSTATUS
-FFSGetPartition(
- IN PDEVICE_OBJECT DeviceObject,
- OUT ULONGLONG *StartOffset);
-
-NTSTATUS
-FFSLoadDiskLabel(
- PDEVICE_OBJECT DeviceObject,
- IN PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-BOOLEAN
-FFSCheckDismount(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN BOOLEAN bForce);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPurgeVolume(
- IN PFFS_VCB Vcb,
- IN BOOLEAN FlushBeforePurge);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPurgeFile(
- IN PFFS_FCB Fcb,
- IN BOOLEAN FlushBeforePurge);
-
-BOOLEAN
-FFSIsHandleCountZero(
- IN PFFS_VCB Vcb);
-
-NTSTATUS
-FFSLockVcb(
- IN PFFS_VCB Vcb,
- IN PFILE_OBJECT FileObject);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSLockVolume(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-NTSTATUS
-FFSUnlockVcb(
- IN PFFS_VCB Vcb,
- IN PFILE_OBJECT FileObject);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSUnlockVolume(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSAllowExtendedDasdIo(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSUserFsRequest(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSMountVolume(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSVerifyVolume(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSIsVolumeMounted(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSDismountVolume(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSSelectBSDPartition(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSFileSystemControl(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Init.c
-//
-
-BOOLEAN
-FFSQueryParameters(
- IN PUNICODE_STRING RegistryPath);
-
-#ifdef _PREFAST_
-DRIVER_INITIALIZE DriverEntry;
-#endif // _PREFAST_
-
-#ifdef _PREFAST_
-DRIVER_UNLOAD DriverUnload;
-#endif // _PREFAST_
-
-VOID NTAPI
-DriverUnload(
- IN PDRIVER_OBJECT DriverObject);
-
-
-//
-// Lock.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSLockControl(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Memory.c
-//
-
-__drv_mustHoldCriticalRegion
-PFFS_IRP_CONTEXT
-FFSAllocateIrpContext(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSFreeIrpContext(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-PFFS_FCB
-FFSv1AllocateFcb(
- IN PFFS_VCB Vcb,
- IN PFFS_MCB FFSMcb,
- IN PFFSv1_INODE dinode1);
-
-__drv_mustHoldCriticalRegion
-PFFS_FCB
-FFSv2AllocateFcb(
- IN PFFS_VCB Vcb,
- IN PFFS_MCB FFSMcb,
- IN PFFSv2_INODE dinode2);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSFreeFcb(
- IN PFFS_FCB Fcb);
-
-__drv_mustHoldCriticalRegion
-PFFS_CCB
-FFSAllocateCcb(
- VOID);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSFreeMcb(
- IN PFFS_MCB Mcb);
-
-__drv_mustHoldCriticalRegion
-PFFS_FCB
-FFSCreateFcbFromMcb(
- PFFS_VCB Vcb,
- PFFS_MCB Mcb);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSFreeCcb(
- IN PFFS_CCB Ccb);
-
-PFFS_MCB
-FFSAllocateMcb(
- PFFS_VCB Vcb,
- PUNICODE_STRING FileName,
- ULONG FileAttr);
-
-PFFS_MCB
-FFSSearchMcbTree(
- PFFS_VCB Vcb,
- PFFS_MCB FFSMcb,
- ULONG Inode);
-
-PFFS_MCB
-FFSSearchMcb(
- PFFS_VCB Vcb,
- PFFS_MCB Parent,
- PUNICODE_STRING FileName);
-
-BOOLEAN
-FFSGetFullFileName(
- PFFS_MCB Mcb,
- PUNICODE_STRING FileName);
-
-VOID
-FFSRefreshMcb(
- PFFS_VCB Vcb, PFFS_MCB Mcb);
-
-VOID
-FFSAddMcbNode(
- PFFS_VCB Vcb,
- PFFS_MCB Parent,
- PFFS_MCB Child);
-
-BOOLEAN
-FFSDeleteMcbNode(
- PFFS_VCB Vcb,
- PFFS_MCB McbTree,
- PFFS_MCB FFSMcb);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSFreeMcbTree(
- PFFS_MCB McbTree);
-
-BOOLEAN
-FFSCheckSetBlock(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb,
- ULONG Block);
-
-BOOLEAN
-FFSCheckBitmapConsistency(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb);
-
-VOID
-FFSInsertVcb(
- PFFS_VCB Vcb);
-
-VOID
-FFSRemoveVcb(
- PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSInitializeVcb(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFS_SUPER_BLOCK FFSSb,
- IN PDEVICE_OBJECT TargetDevice,
- IN PDEVICE_OBJECT VolumeDevice,
- IN PVPB Vpb);
-
-__drv_mustHoldCriticalRegion
-VOID
-FFSFreeVcb(
- IN PFFS_VCB Vcb);
-
-VOID
-FFSRepinBcb(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PBCB Bcb);
-
-VOID
-FFSUnpinRepinnedBcbs(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSCompleteIrpContext(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN NTSTATUS Status);
-
-VOID
-FFSSyncUninitializeCacheMap(
- IN PFILE_OBJECT FileObject);
-
-
-//
-// Misc.c
-//
-
-ULONG
-FFSLog2(
- ULONG Value);
-
-LARGE_INTEGER
-FFSSysTime(
- IN ULONG i_time);
-
-ULONG
-FFSInodeTime(
- IN LARGE_INTEGER SysTime);
-
-NTSTATUS
-FFSOEMToUnicode(
- IN OUT PUNICODE_STRING Unicode,
- IN POEM_STRING Oem);
-
-NTSTATUS
-FFSUnicodeToOEM(
- IN OUT POEM_STRING Oem,
- IN PUNICODE_STRING Unicode);
-
-
-//
-// Pnp.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPnp(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPnpQueryRemove(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPnpRemove(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPnpCancelRemove(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSPnpSurpriseRemove(
- PFFS_IRP_CONTEXT IrpContext,
- PFFS_VCB Vcb);
-
-
-//
-// Read.c
-//
-
-BOOLEAN
-FFSCopyRead(
- IN PFILE_OBJECT FileObject,
- IN PLARGE_INTEGER FileOffset,
- IN ULONG Length,
- IN BOOLEAN Wait,
- OUT PVOID Buffer,
- OUT PIO_STATUS_BLOCK IoStatus);
-
-NTSTATUS
-FFSv1ReadInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFSv1_INODE dinode1,
- IN ULONGLONG offset,
- IN PVOID Buffer,
- IN ULONG size,
- OUT PULONG dwRet);
-
-NTSTATUS
-FFSv2ReadInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFSv2_INODE dinode2,
- IN ULONGLONG offset,
- IN PVOID Buffer,
- IN ULONG size,
- OUT PULONG dwRet);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSRead(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Shutdown.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSShutDown(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Volinfo.c
-//
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSQueryVolumeInformation(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSSetVolumeInformation(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-
-//
-// Write.c
-//
-
-NTSTATUS
-FFSv1WriteInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFSv1_INODE dinode1,
- IN ULONGLONG offset,
- IN PVOID Buffer,
- IN ULONG size,
- IN BOOLEAN bWriteToDisk,
- OUT PULONG dwRet);
-
-NTSTATUS
-FFSv2WriteInode(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFFSv2_INODE dinode2,
- IN ULONGLONG offset,
- IN PVOID Buffer,
- IN ULONG size,
- IN BOOLEAN bWriteToDisk,
- OUT PULONG dwRet);
-
-VOID
-FFSStartFloppyFlushDpc(
- PFFS_VCB Vcb,
- PFFS_FCB Fcb,
- PFILE_OBJECT FileObject);
-
-BOOLEAN
-FFSZeroHoles(
- IN PFFS_IRP_CONTEXT IrpContext,
- IN PFFS_VCB Vcb,
- IN PFILE_OBJECT FileObject,
- IN LONGLONG Offset,
- IN LONGLONG Count);
-
-__drv_mustHoldCriticalRegion
-NTSTATUS
-FFSWrite(
- IN PFFS_IRP_CONTEXT IrpContext);
-
-NTSTATUS
-DeviceControl(
- IN PDEVICE_OBJECT pDeviceObject,
- IN PIRP pIrp);
-
-#endif /* _FFS_HEADER_ */
diff --git a/drivers/filesystems/ffs/inc/fs.h b/drivers/filesystems/ffs/inc/fs.h
deleted file mode 100644
index 40afed40258..00000000000
--- a/drivers/filesystems/ffs/inc/fs.h
+++ /dev/null
@@ -1,697 +0,0 @@
-/* $NetBSD: fs.h,v 1.43 2004/03/21 18:48:24 dsl Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fs.h 8.13 (Berkeley) 3/21/95
- */
-
-#ifndef _UFS_FFS_FS_H_
-#define _UFS_FFS_FS_H_
-
-#include "type.h"
-
-/*
- * Each disk drive contains some number of file systems.
- * A file system consists of a number of cylinder groups.
- * Each cylinder group has inodes and data.
- *
- * A file system is described by its super-block, which in turn
- * describes the cylinder groups. The super-block is critical
- * data and is replicated in each cylinder group to protect against
- * catastrophic loss. This is done at `newfs' time and the critical
- * super-block data does not change, so the copies need not be
- * referenced further unless disaster strikes.
- *
- * For file system fs, the offsets of the various blocks of interest
- * are given in the super block as:
- * [fs->fs_sblkno] Super-block
- * [fs->fs_cblkno] Cylinder group block
- * [fs->fs_iblkno] Inode blocks
- * [fs->fs_dblkno] Data blocks
- * The beginning of cylinder group cg in fs, is given by
- * the ``cgbase(fs, cg)'' macro.
- *
- * Depending on the architecture and the media, the superblock may
- * reside in any one of four places. For tiny media where every block
- * counts, it is placed at the very front of the partition. Historically,
- * UFS1 placed it 8K from the front to leave room for the disk label and
- * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
- * room for the disk label and a bigger bootstrap, and for really piggy
- * systems we check at 256K from the front if the first three fail. In
- * all cases the size of the superblock will be SBLOCKSIZE. All values are
- * given in byte-offset form, so they do not imply a sector size. The
- * SBLOCKSEARCH specifies the order in which the locations should be searched.
- *
- * Unfortunately the UFS2/FFSv2 change was done without adequate consideration
- * of backward compatibility. In particular 'newfs' for a FFSv2 partition
- * must overwrite any old FFSv1 superblock at 8k, and preferrably as many
- * of the alternates as it can find - otherwise attempting to mount on a
- * system that only supports FFSv1 is likely to succeed!.
- * For a small FFSv1 filesystem, an old FFSv2 superblock can be left on
- * the disk, and a system that tries to find an FFSv2 filesystem in preference
- * to and FFSv1 one (as NetBSD does) can mount the old FFSv2 filesystem.
- * As a added bonus, the 'first alternate' superblock of a FFSv1 filesystem
- * with 64k blocks is at 64k - just where the code looks first when playing
- * 'hunt the superblock'.
- *
- * The ffsv2 superblock layout (which might contain an ffsv1 filesystem)
- * can be detected by checking for sb->fs_old_flags & FS_FLAGS_UPDATED.
- * This is the default suberblock type for NetBSD since ffsv2 support was added.
- */
-#define BBSIZE 8192
-#define BBOFF ((off_t)(0))
-#define BBLOCK ((daddr_t)(0))
-
-#define SBLOCK_FLOPPY 0
-#define SBLOCK_UFS1 8192
-#define SBLOCK_UFS2 65536
-#define SBLOCK_PIGGY 262144
-#define SBLOCKSIZE 8192
-/*
- * NB: Do not, under any circumstances, look for an ffsv1 filesystem at
- * SBLOCK_UFS2. Doing so will find the wrong superblock for filesystems
- * with a 64k block size.
- */
-#define SBLOCKSEARCH \
- { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
-
-/*
- * Max number of fragments per block. This value is NOT tweakable.
- */
-#define MAXFRAG 8
-
-
-
-/*
- * Addresses stored in inodes are capable of addressing fragments
- * of `blocks'. File system blocks of at most size MAXBSIZE can
- * be optionally broken into 2, 4, or 8 pieces, each of which is
- * addressable; these pieces may be DEV_BSIZE, or some multiple of
- * a DEV_BSIZE unit.
- *
- * Large files consist of exclusively large data blocks. To avoid
- * undue wasted disk space, the last data block of a small file may be
- * allocated as only as many fragments of a large block as are
- * necessary. The file system format retains only a single pointer
- * to such a fragment, which is a piece of a single large block that
- * has been divided. The size of such a fragment is determinable from
- * information in the inode, using the ``blksize(fs, ip, lbn)'' macro.
- *
- * The file system records space availability at the fragment level;
- * to determine block availability, aligned fragments are examined.
- */
-
-/*
- * MINBSIZE is the smallest allowable block size.
- * In order to insure that it is possible to create files of size
- * 2^32 with only two levels of indirection, MINBSIZE is set to 4096.
- * MINBSIZE must be big enough to hold a cylinder group block,
- * thus changes to (struct cg) must keep its size within MINBSIZE.
- * Note that super blocks are always of size SBSIZE,
- * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE.
- */
-#define MINBSIZE 4096
-
-/*
- * The path name on which the file system is mounted is maintained
- * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
- * the super block for this name.
- */
-#define MAXMNTLEN 468
-
-/*
- * The volume name for this filesystem is maintained in fs_volname.
- * MAXVOLLEN defines the length of the buffer allocated.
- * This space used to be part of of fs_fsmnt.
- */
-#define MAXVOLLEN 32
-
-/*
- * There is a 128-byte region in the superblock reserved for in-core
- * pointers to summary information. Originally this included an array
- * of pointers to blocks of struct csum; now there are just four
- * pointers and the remaining space is padded with fs_ocsp[].
- * NOCSPTRS determines the size of this padding. One pointer (fs_csp)
- * is taken away to point to a contiguous array of struct csum for
- * all cylinder groups; a second (fs_maxcluster) points to an array
- * of cluster sizes that is computed as cylinder groups are inspected;
- * the third (fs_contigdirs) points to an array that tracks the
- * creation of new directories; and the fourth (fs_active) is used
- * by snapshots.
- */
-#define NOCSPTRS ((128 / sizeof(void *)) - 4)
-
-/*
- * A summary of contiguous blocks of various sizes is maintained
- * in each cylinder group. Normally this is set by the initial
- * value of fs_maxcontig. To conserve space, a maximum summary size
- * is set by FS_MAXCONTIG.
- */
-#define FS_MAXCONTIG 16
-
-/*
- * Unused value currently, FreeBSD compat.
- */
-#define FSMAXSNAP 20
-
-/*
- * MINFREE gives the minimum acceptable percentage of file system
- * blocks which may be free. If the freelist drops below this level
- * only the superuser may continue to allocate blocks. This may
- * be set to 0 if no reserve of free blocks is deemed necessary,
- * however throughput drops by fifty percent if the file system
- * is run at between 95% and 100% full; thus the minimum default
- * value of fs_minfree is 5%. However, to get good clustering
- * performance, 10% is a better choice. hence we use 10% as our
- * default value. With 10% free space, fragmentation is not a
- * problem, so we choose to optimize for time.
- */
-#define MINFREE 5
-#define DEFAULTOPT FS_OPTTIME
-
-/*
- * Grigoriy Orlov <gluk(a)ptci.ru> has done some extensive work to fine
- * tune the layout preferences for directories within a filesystem.
- * His algorithm can be tuned by adjusting the following parameters
- * which tell the system the average file size and the average number
- * of files per directory. These defaults are well selected for typical
- * filesystems, but may need to be tuned for odd cases like filesystems
- * being used for squid caches or news spools.
- */
-#define AVFILESIZ 16384 /* expected average file size */
-#define AFPDIR 64 /* expected number of files per directory */
-
-/*
- * Per cylinder group information; summarized in blocks allocated
- * from first cylinder group data blocks. These blocks have to be
- * read in from fs_csaddr (size fs_cssize) in addition to the
- * super block.
- */
-struct csum {
- int32_t cs_ndir; /* number of directories */
- int32_t cs_nbfree; /* number of free blocks */
- int32_t cs_nifree; /* number of free inodes */
- int32_t cs_nffree; /* number of free frags */
-};
-
-struct csum_total {
- int64_t cs_ndir; /* number of directories */
- int64_t cs_nbfree; /* number of free blocks */
- int64_t cs_nifree; /* number of free inodes */
- int64_t cs_nffree; /* number of free frags */
- int64_t cs_spare[4]; /* future expansion */
-};
-
-
-/*
- * Super block for an FFS file system in memory.
- */
-struct fs {
- int32_t fs_firstfield; /* historic file system linked list, */
- int32_t fs_unused_1; /* used for incore super blocks */
- int32_t fs_sblkno; /* addr of super-block in filesys */
- int32_t fs_cblkno; /* offset of cyl-block in filesys */
- int32_t fs_iblkno; /* offset of inode-blocks in filesys */
- int32_t fs_dblkno; /* offset of first data after cg */
- int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */
- int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */
- int32_t fs_old_time; /* last time written */
- int32_t fs_old_size; /* number of blocks in fs */
- int32_t fs_old_dsize; /* number of data blocks in fs */
- int32_t fs_ncg; /* number of cylinder groups */
- int32_t fs_bsize; /* size of basic blocks in fs */
- int32_t fs_fsize; /* size of frag blocks in fs */
- int32_t fs_frag; /* number of frags in a block in fs */
-/* these are configuration parameters */
- int32_t fs_minfree; /* minimum percentage of free blocks */
- int32_t fs_old_rotdelay; /* num of ms for optimal next block */
- int32_t fs_old_rps; /* disk revolutions per second */
-/* these fields can be computed from the others */
- int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */
- int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */
- int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */
- int32_t fs_fshift; /* ``numfrags'' calc number of frags */
-/* these are configuration parameters */
- int32_t fs_maxcontig; /* max number of contiguous blks */
- int32_t fs_maxbpg; /* max number of blks per cyl group */
-/* these fields can be computed from the others */
- int32_t fs_fragshift; /* block to frag shift */
- int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
- int32_t fs_sbsize; /* actual size of super block */
- int32_t fs_spare1[2]; /* old fs_csmask */
- /* old fs_csshift */
- int32_t fs_nindir; /* value of NINDIR */
- int32_t fs_inopb; /* value of INOPB */
- int32_t fs_old_nspf; /* value of NSPF */
-/* yet another configuration parameter */
- int32_t fs_optim; /* optimization preference, see below */
-/* these fields are derived from the hardware */
- int32_t fs_old_npsect; /* # sectors/track including spares */
- int32_t fs_old_interleave; /* hardware sector interleave */
- int32_t fs_old_trackskew; /* sector 0 skew, per track */
-/* fs_id takes the space of the unused fs_headswitch and fs_trkseek fields */
- int32_t fs_id[2]; /* unique file system id */
-/* sizes determined by number of cylinder groups and their sizes */
- int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */
- int32_t fs_cssize; /* size of cyl grp summary area */
- int32_t fs_cgsize; /* cylinder group size */
-/* these fields are derived from the hardware */
- int32_t fs_spare2; /* old fs_ntrak */
- int32_t fs_old_nsect; /* sectors per track */
- int32_t fs_old_spc; /* sectors per cylinder */
- int32_t fs_old_ncyl; /* cylinders in file system */
- int32_t fs_old_cpg; /* cylinders per group */
- int32_t fs_ipg; /* inodes per group */
- int32_t fs_fpg; /* blocks per group * fs_frag */
-/* this data must be re-computed after crashes */
- struct csum fs_old_cstotal; /* cylinder summary information */
-/* these fields are cleared at mount time */
- int8_t fs_fmod; /* super block modified flag */
- int8_t fs_clean; /* file system is clean flag */
- int8_t fs_ronly; /* mounted read-only flag */
- uint8_t fs_old_flags; /* see FS_ flags below */
- u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
- u_char fs_volname[MAXVOLLEN]; /* volume name */
- uint64_t fs_swuid; /* system-wide uid */
- int32_t fs_pad;
-/* these fields retain the current block allocation info */
- int32_t fs_cgrotor; /* last cg searched (UNUSED) */
- void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
- u_int8_t *fs_contigdirs; /* # of contiguously allocated dirs */
- struct csum *fs_csp; /* cg summary info buffer for fs_cs */
- int32_t *fs_maxcluster; /* max cluster in each cyl group */
- u_int *fs_active; /* used by snapshots to track fs */
- int32_t fs_old_cpc; /* cyl per cycle in postbl */
-/* this area is otherwise allocated unless fs_old_flags & FS_FLAGS_UPDATED */
- int32_t fs_maxbsize; /* maximum blocking factor permitted */
- int64_t fs_sparecon64[17]; /* old rotation block list head */
- int64_t fs_sblockloc; /* byte offset of standard superblock */
- struct csum_total fs_cstotal; /* cylinder summary information */
- int64_t fs_time; /* last time written */
- int64_t fs_size; /* number of blocks in fs */
- int64_t fs_dsize; /* number of data blocks in fs */
- int64_t fs_csaddr; /* blk addr of cyl grp summary area */
- int64_t fs_pendingblocks; /* blocks in process of being freed */
- int32_t fs_pendinginodes; /* inodes in process of being freed */
- int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
-/* back to stuff that has been around a while */
- int32_t fs_avgfilesize; /* expected average file size */
- int32_t fs_avgfpdir; /* expected # of files per directory */
- int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */
- int32_t fs_sparecon32[26]; /* reserved for future constants */
- uint32_t fs_flags; /* see FS_ flags below */
-/* back to stuff that has been around a while (again) */
- int32_t fs_contigsumsize; /* size of cluster summary array */
- int32_t fs_maxsymlinklen; /* max length of an internal symlink */
- int32_t fs_old_inodefmt; /* format of on-disk inodes */
- u_int64_t fs_maxfilesize; /* maximum representable file size */
- int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */
- int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */
- int32_t fs_state; /* validate fs_clean field (UNUSED) */
- int32_t fs_old_postblformat; /* format of positional layout tables */
- int32_t fs_old_nrpos; /* number of rotational positions */
- int32_t fs_spare5[2]; /* old fs_postbloff */
- /* old fs_rotbloff */
- int32_t fs_magic; /* magic number */
-};
-
-#define fs_old_postbloff fs_spare5[0]
-#define fs_old_rotbloff fs_spare5[1]
-#define fs_old_postbl_start fs_maxbsize
-#define fs_old_headswitch fs_id[0]
-#define fs_old_trkseek fs_id[1]
-#define fs_old_csmask fs_spare1[0]
-#define fs_old_csshift fs_spare1[1]
-
-#define FS_42POSTBLFMT -1 /* 4.2BSD rotational table format */
-#define FS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */
-
-#define old_fs_postbl(fs_, cylno, opostblsave) \
- ((((fs_)->fs_old_postblformat == FS_42POSTBLFMT) || \
- ((fs_)->fs_old_postbloff == offsetof(struct fs, fs_old_postbl_start))) \
- ? ((int16_t *)(opostblsave) + (cylno) * (fs_)->fs_old_nrpos) \
- : ((int16_t *)((uint8_t *)(fs_) + \
- (fs_)->fs_old_postbloff) + (cylno) * (fs_)->fs_old_nrpos))
-#define old_fs_rotbl(fs) \
- (((fs)->fs_old_postblformat == FS_42POSTBLFMT) \
- ? ((uint8_t *)(&(fs)->fs_magic+1)) \
- : ((uint8_t *)((uint8_t *)(fs) + (fs)->fs_old_rotbloff)))
-
-/*
- * File system identification
- */
-#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast file system magic number */
-#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast file system magic number */
-#define FS_UFS1_MAGIC_SWAPPED 0x54190100
-#define FS_UFS2_MAGIC_SWAPPED 0x19015419
-#define FS_OKAY 0x7c269d38 /* superblock checksum */
-#define FS_42INODEFMT -1 /* 4.2BSD inode format */
-#define FS_44INODEFMT 2 /* 4.4BSD inode format */
-
-/*
- * File system clean flags
- */
-#define FS_ISCLEAN 0x01
-#define FS_WASCLEAN 0x02
-
-/*
- * Preference for optimization.
- */
-#define FS_OPTTIME 0 /* minimize allocation time */
-#define FS_OPTSPACE 1 /* minimize disk fragmentation */
-
-/*
- * File system flags
- */
-#define FS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
-#define FS_DOSOFTDEP 0x02 /* file system using soft dependencies */
-#define FS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
-#define FS_INDEXDIRS 0x08 /* kernel supports indexed directories */
-#define FS_ACLS 0x10 /* file system has ACLs enabled */
-#define FS_MULTILABEL 0x20 /* file system is MAC multi-label */
-#define FS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
-
-/*
- * File system internal flags, also in fs_flags.
- * (Pick highest number to avoid conflicts with others)
- */
-#define FS_SWAPPED 0x80000000 /* file system is endian swapped */
-#define FS_INTERNAL 0x80000000 /* mask for internal flags */
-
-/*
- * The size of a cylinder group is calculated by CGSIZE. The maximum size
- * is limited by the fact that cylinder groups are at most one block.
- * Its size is derived from the size of the maps maintained in the
- * cylinder group and the (struct cg) size.
- */
-#define CGSIZE_IF(fs, ipg, fpg) \
- /* base cg */ (sizeof(struct cg) + sizeof(int32_t) + \
- /* old btotoff */ (fs)->fs_old_cpg * sizeof(int32_t) + \
- /* old boff */ (fs)->fs_old_cpg * sizeof(u_int16_t) + \
- /* inode map */ howmany((ipg), NBBY) + \
- /* block map */ howmany((fpg), NBBY) +\
- /* if present */ ((fs)->fs_contigsumsize <= 0 ? 0 : \
- /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) + \
- /* cluster map */ howmany(fragstoblks(fs, (fpg)), NBBY)))
-
-#define CGSIZE(fs) CGSIZE_IF((fs), (fs)->fs_ipg, (fs)->fs_fpg)
-
-/*
- * The minimal number of cylinder groups that should be created.
- */
-#define MINCYLGRPS 4
-
-
-/*
- * Convert cylinder group to base address of its global summary info.
- */
-#define fs_cs(fs, indx) fs_csp[indx]
-
-/*
- * Cylinder group block for a file system.
- */
-#define CG_MAGIC 0x090255
-struct cg {
- int32_t cg_firstfield; /* historic cyl groups linked list */
- int32_t cg_magic; /* magic number */
- int32_t cg_old_time; /* time last written */
- int32_t cg_cgx; /* we are the cgx'th cylinder group */
- int16_t cg_old_ncyl; /* number of cyl's this cg */
- int16_t cg_old_niblk; /* number of inode blocks this cg */
- int32_t cg_ndblk; /* number of data blocks this cg */
- struct csum cg_cs; /* cylinder summary information */
- int32_t cg_rotor; /* position of last used block */
- int32_t cg_frotor; /* position of last used frag */
- int32_t cg_irotor; /* position of last used inode */
- int32_t cg_frsum[MAXFRAG]; /* counts of available frags */
- int32_t cg_old_btotoff; /* (int32) block totals per cylinder */
- int32_t cg_old_boff; /* (u_int16) free block positions */
- int32_t cg_iusedoff; /* (u_int8) used inode map */
- int32_t cg_freeoff; /* (u_int8) free block map */
- int32_t cg_nextfreeoff; /* (u_int8) next available space */
- int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */
- int32_t cg_clusteroff; /* (u_int8) free cluster map */
- int32_t cg_nclusterblks; /* number of clusters this cg */
- int32_t cg_niblk; /* number of inode blocks this cg */
- int32_t cg_initediblk; /* last initialized inode */
- int32_t cg_sparecon32[3]; /* reserved for future use */
- int64_t cg_time; /* time last written */
- int64_t cg_sparecon64[3]; /* reserved for future use */
- u_int8_t cg_space[1]; /* space for cylinder group maps */
-/* actually longer */
-};
-
-/*
- * The following structure is defined
- * for compatibility with old file systems.
- */
-struct ocg {
- int32_t cg_firstfield; /* historic linked list of cyl groups */
- int32_t cg_unused_1; /* used for incore cyl groups */
- int32_t cg_time; /* time last written */
- int32_t cg_cgx; /* we are the cgx'th cylinder group */
- int16_t cg_ncyl; /* number of cyl's this cg */
- int16_t cg_niblk; /* number of inode blocks this cg */
- int32_t cg_ndblk; /* number of data blocks this cg */
- struct csum cg_cs; /* cylinder summary information */
- int32_t cg_rotor; /* position of last used block */
- int32_t cg_frotor; /* position of last used frag */
- int32_t cg_irotor; /* position of last used inode */
- int32_t cg_frsum[8]; /* counts of available frags */
- int32_t cg_btot[32]; /* block totals per cylinder */
- int16_t cg_b[32][8]; /* positions of free blocks */
- u_int8_t cg_iused[256]; /* used inode map */
- int32_t cg_magic; /* magic number */
- u_int8_t cg_free[1]; /* free block map */
-/* actually longer */
-};
-
-
-/*
- * Macros for access to cylinder group array structures.
- */
-#define old_cg_blktot_old(cgp, ns) \
- (((struct ocg *)(cgp))->cg_btot)
-#define old_cg_blks_old(fs, cgp, cylno, ns) \
- (((struct ocg *)(cgp))->cg_b[cylno])
-
-#define old_cg_blktot_new(cgp, ns) \
- ((int32_t *)((u_int8_t *)(cgp) + \
- ufs_rw32((cgp)->cg_old_btotoff, (ns))))
-#define old_cg_blks_new(fs, cgp, cylno, ns) \
- ((int16_t *)((u_int8_t *)(cgp) + \
- ufs_rw32((cgp)->cg_old_boff, (ns))) + (cylno) * (fs)->fs_old_nrpos)
-
-#define old_cg_blktot(cgp, ns) \
- ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
- old_cg_blktot_old(cgp, ns) : old_cg_blktot_new(cgp, ns))
-#define old_cg_blks(fs, cgp, cylno, ns) \
- ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
- old_cg_blks_old(fs, cgp, cylno, ns) : old_cg_blks_new(fs, cgp, cylno, ns))
-
-#define cg_inosused_new(cgp, ns) \
- ((u_int8_t *)((u_int8_t *)(cgp) + \
- ufs_rw32((cgp)->cg_iusedoff, (ns))))
-#define cg_blksfree_new(cgp, ns) \
- ((u_int8_t *)((u_int8_t *)(cgp) + \
- ufs_rw32((cgp)->cg_freeoff, (ns))))
-#define cg_chkmagic_new(cgp, ns) \
- (ufs_rw32((cgp)->cg_magic, (ns)) == CG_MAGIC)
-
-#define cg_inosused_old(cgp, ns) \
- (((struct ocg *)(cgp))->cg_iused)
-#define cg_blksfree_old(cgp, ns) \
- (((struct ocg *)(cgp))->cg_free)
-#define cg_chkmagic_old(cgp, ns) \
- (ufs_rw32(((struct ocg *)(cgp))->cg_magic, (ns)) == CG_MAGIC)
-
-#define cg_inosused(cgp, ns) \
- ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
- cg_inosused_old(cgp, ns) : cg_inosused_new(cgp, ns))
-#define cg_blksfree(cgp, ns) \
- ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
- cg_blksfree_old(cgp, ns) : cg_blksfree_new(cgp, ns))
-#define cg_chkmagic(cgp, ns) \
- (cg_chkmagic_new(cgp, ns) || cg_chkmagic_old(cgp, ns))
-
-#define cg_clustersfree(cgp, ns) \
- ((u_int8_t *)((u_int8_t *)(cgp) + \
- ufs_rw32((cgp)->cg_clusteroff, (ns))))
-#define cg_clustersum(cgp, ns) \
- ((int32_t *)((u_int8_t *)(cgp) + \
- ufs_rw32((cgp)->cg_clustersumoff, (ns))))
-
-
-/*
- * Turn file system block numbers into disk block addresses.
- * This maps file system blocks to device size blocks.
- */
-#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb)
-#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
-
-/*
- * Cylinder group macros to locate things in cylinder groups.
- * They calc file system addresses of cylinder group data structures.
- */
-#define cgbase(fs, c) (((daddr_t)(fs)->fs_fpg) * (c))
-#define cgstart_ufs1(fs, c) \
- (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))
-#define cgstart_ufs2(fs, c) cgbase((fs), (c))
-#define cgstart(fs, c) ((fs)->fs_magic == FS_UFS2_MAGIC \
- ? cgstart_ufs2((fs), (c)) : cgstart_ufs1((fs), (c)))
-#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
-#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
-#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
-#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
-
-/*
- * Macros for handling inode numbers:
- * inode number to file system block offset.
- * inode number to cylinder group number.
- * inode number to file system block address.
- */
-#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg)
-#define ino_to_fsba(fs, x) \
- ((daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \
- (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
-#define ino_to_fsbo(fs, x) ((x) % INOPB(fs))
-
-/*
- * Give cylinder group number for a file system block.
- * Give cylinder group block number for a file system block.
- */
-#define dtog(fs, d) ((d) / (fs)->fs_fpg)
-#define dtogd(fs, d) ((d) % (fs)->fs_fpg)
-
-/*
- * Extract the bits for a block from a map.
- * Compute the cylinder and rotational position of a cyl block addr.
- */
-#define blkmap(fs, map, loc) \
- (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
-#define old_cbtocylno(fs, bno) \
- (fsbtodb(fs, bno) / (fs)->fs_old_spc)
-#define old_cbtorpos(fs, bno) \
- ((fs)->fs_old_nrpos <= 1 ? 0 : \
- (fsbtodb(fs, bno) % (fs)->fs_old_spc / (fs)->fs_old_nsect * (fs)->fs_old_trackskew + \
- fsbtodb(fs, bno) % (fs)->fs_old_spc % (fs)->fs_old_nsect * (fs)->fs_old_interleave) % \
- (fs)->fs_old_nsect * (fs)->fs_old_nrpos / (fs)->fs_old_npsect)
-
-/*
- * The following macros optimize certain frequently calculated
- * quantities by using shifts and masks in place of divisions
- * modulos and multiplications.
- */
-#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
- ((loc) & (fs)->fs_qbmask)
-#define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \
- ((loc) & (fs)->fs_qfmask)
-#define lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \
- (((off_t)(frag)) << (fs)->fs_fshift)
-#define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \
- (((off_t)(blk)) << (fs)->fs_bshift)
-#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
- ((loc) >> (fs)->fs_bshift)
-#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
- ((loc) >> (fs)->fs_fshift)
-#define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
- (((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)
-#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
- (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
-#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
- ((frags) >> (fs)->fs_fragshift)
-#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
- ((blks) << (fs)->fs_fragshift)
-#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \
- ((fsb) & ((fs)->fs_frag - 1))
-#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \
- ((fsb) &~ ((fs)->fs_frag - 1))
-
-/*
- * Determine the number of available frags given a
- * percentage to hold in reserve.
- */
-#define freespace(fs, percentreserved) \
- (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
- (fs)->fs_cstotal.cs_nffree - \
- (((off_t)((fs)->fs_dsize)) * (percentreserved) / 100))
-
-/*
- * Determining the size of a file block in the file system.
- */
-#define blksize(fs, ip, lbn) \
- (((lbn) >= NDADDR || (ip)->i_size >= lblktosize(fs, (lbn) + 1)) \
- ? (fs)->fs_bsize \
- : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
-
-#define sblksize(fs, size, lbn) \
- (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
- ? (fs)->fs_bsize \
- : (fragroundup(fs, blkoff(fs, (size)))))
-
-
-/*
- * Number of inodes in a secondary storage block/fragment.
- */
-#define INOPB(fs) ((fs)->fs_inopb)
-#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift)
-
-/*
- * Number of indirects in a file system block.
- */
-#define NINDIR(fs) ((fs)->fs_nindir)
-
-/*
- * Apple UFS Label:
- * We check for this to decide to use APPLEUFS_DIRBLKSIZ
- */
... 22589 lines suppressed ...
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2e2190df57adf5bfbd47d…
commit 2e2190df57adf5bfbd47d99ee88b01579eecd940
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Fri Jul 23 21:12:31 2021 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Fri Jul 30 17:14:53 2021 +0300
[REISERFS] Remove the ReiserFS driver
The upstream driver is not maintained and the file system itself
is in a semi-abandoned state.
Originally imported at e308102f4ab47c3c6a9107c743cbf3ec2c38f690
The driver is written by Mark W Piper, updated by Bo Brantén.
ReactOS porting made by Peter Hater and Pierre Schweitzer.
Follow updates at http://www.acc.umu.se/~bosse/
FS Recognizer code is left to keep the FS support as an
installable driver.
CORE-11005
---
CODEOWNERS | 1 -
base/setup/lib/bootsup.c | 3 +-
base/setup/lib/fsutil.c | 1 -
base/setup/lib/utils/fsrec.c | 3 +-
base/system/autochk/CMakeLists.txt | 2 +-
base/system/autochk/autochk.c | 2 -
boot/bootdata/hivesys.inf | 9 -
dll/win32/CMakeLists.txt | 1 -
dll/win32/ureiserfs/CMakeLists.txt | 13 -
dll/win32/ureiserfs/ureiserfs.c | 22 -
dll/win32/ureiserfs/ureiserfs.rc | 5 -
dll/win32/ureiserfs/ureiserfs.spec | 2 -
drivers/filesystems/CMakeLists.txt | 1 -
drivers/filesystems/reiserfs/CMakeLists.txt | 103 -
.../filesystems/reiserfs/inc/linux/bit_spinlock.h | 95 -
drivers/filesystems/reiserfs/inc/linux/bitops.h | 342 -
drivers/filesystems/reiserfs/inc/linux/config.h | 0
drivers/filesystems/reiserfs/inc/linux/errno.h | 140 -
drivers/filesystems/reiserfs/inc/linux/fs.h | 4 -
drivers/filesystems/reiserfs/inc/linux/jbd.h | 1106 --
.../filesystems/reiserfs/inc/linux/journal-head.h | 92 -
drivers/filesystems/reiserfs/inc/linux/kernel.h | 0
drivers/filesystems/reiserfs/inc/linux/list.h | 255 -
drivers/filesystems/reiserfs/inc/linux/log2.h | 208 -
drivers/filesystems/reiserfs/inc/linux/module.h | 99 -
drivers/filesystems/reiserfs/inc/linux/nls.h | 0
.../filesystems/reiserfs/inc/linux/reiserfs_acl.h | 89 -
.../filesystems/reiserfs/inc/linux/reiserfs_fs.h | 2214 ---
.../filesystems/reiserfs/inc/linux/reiserfs_fs_i.h | 64 -
.../reiserfs/inc/linux/reiserfs_fs_sb.h | 535 -
.../reiserfs/inc/linux/reiserfs_xattr.h | 132 -
drivers/filesystems/reiserfs/inc/linux/slab.h | 0
drivers/filesystems/reiserfs/inc/linux/spinlock.h | 0
drivers/filesystems/reiserfs/inc/linux/stddef.h | 13 -
drivers/filesystems/reiserfs/inc/linux/string.h | 0
drivers/filesystems/reiserfs/inc/linux/types.h | 72 -
drivers/filesystems/reiserfs/inc/linux/version.h | 0
drivers/filesystems/reiserfs/inc/reiserfs.h | 531 -
drivers/filesystems/reiserfs/inc/rfsd.h | 2105 ---
drivers/filesystems/reiserfs/src/blockio.c | 667 -
drivers/filesystems/reiserfs/src/cleanup.c | 341 -
drivers/filesystems/reiserfs/src/close.c | 324 -
drivers/filesystems/reiserfs/src/cmcb.c | 198 -
drivers/filesystems/reiserfs/src/create.c | 1527 --
drivers/filesystems/reiserfs/src/debug.c | 1757 ---
drivers/filesystems/reiserfs/src/devctl.c | 269 -
drivers/filesystems/reiserfs/src/dirctl.c | 1107 --
drivers/filesystems/reiserfs/src/dispatch.c | 242 -
drivers/filesystems/reiserfs/src/except.c | 188 -
drivers/filesystems/reiserfs/src/fastio.c | 1009 --
drivers/filesystems/reiserfs/src/fileinfo.c | 1529 --
drivers/filesystems/reiserfs/src/flush.c | 289 -
drivers/filesystems/reiserfs/src/fsctl.c | 1266 --
drivers/filesystems/reiserfs/src/init.c | 460 -
drivers/filesystems/reiserfs/src/lockctl.c | 128 -
drivers/filesystems/reiserfs/src/memory.c | 1675 ---
drivers/filesystems/reiserfs/src/misc.c | 281 -
drivers/filesystems/reiserfs/src/nls.c | 277 -
drivers/filesystems/reiserfs/src/nls/nls_base.c | 506 -
drivers/filesystems/reiserfs/src/nls/nls_big5.c | 62 -
drivers/filesystems/reiserfs/src/nls/nls_cp1251.c | 318 -
drivers/filesystems/reiserfs/src/nls/nls_cp1255.c | 399 -
drivers/filesystems/reiserfs/src/nls/nls_cp437.c | 404 -
drivers/filesystems/reiserfs/src/nls/nls_cp737.c | 367 -
drivers/filesystems/reiserfs/src/nls/nls_cp775.c | 336 -
drivers/filesystems/reiserfs/src/nls/nls_cp850.c | 332 -
drivers/filesystems/reiserfs/src/nls/nls_cp852.c | 354 -
drivers/filesystems/reiserfs/src/nls/nls_cp855.c | 316 -
drivers/filesystems/reiserfs/src/nls/nls_cp857.c | 318 -
drivers/filesystems/reiserfs/src/nls/nls_cp860.c | 381 -
drivers/filesystems/reiserfs/src/nls/nls_cp861.c | 404 -
drivers/filesystems/reiserfs/src/nls/nls_cp862.c | 438 -
drivers/filesystems/reiserfs/src/nls/nls_cp863.c | 398 -
drivers/filesystems/reiserfs/src/nls/nls_cp864.c | 424 -
drivers/filesystems/reiserfs/src/nls/nls_cp865.c | 404 -
drivers/filesystems/reiserfs/src/nls/nls_cp866.c | 322 -
drivers/filesystems/reiserfs/src/nls/nls_cp869.c | 332 -
drivers/filesystems/reiserfs/src/nls/nls_cp874.c | 290 -
drivers/filesystems/reiserfs/src/nls/nls_cp932.c | 7924 -----------
drivers/filesystems/reiserfs/src/nls/nls_cp936.c | 11044 ---------------
drivers/filesystems/reiserfs/src/nls/nls_cp949.c | 13961 -------------------
drivers/filesystems/reiserfs/src/nls/nls_cp950.c | 9500 -------------
drivers/filesystems/reiserfs/src/nls/nls_euc-jp.c | 601 -
drivers/filesystems/reiserfs/src/nls/nls_euc-kr.c | 62 -
drivers/filesystems/reiserfs/src/nls/nls_gb2312.c | 62 -
.../filesystems/reiserfs/src/nls/nls_iso8859-1.c | 273 -
.../filesystems/reiserfs/src/nls/nls_iso8859-13.c | 301 -
.../filesystems/reiserfs/src/nls/nls_iso8859-14.c | 357 -
.../filesystems/reiserfs/src/nls/nls_iso8859-15.c | 323 -
.../filesystems/reiserfs/src/nls/nls_iso8859-2.c | 324 -
.../filesystems/reiserfs/src/nls/nls_iso8859-3.c | 324 -
.../filesystems/reiserfs/src/nls/nls_iso8859-4.c | 324 -
.../filesystems/reiserfs/src/nls/nls_iso8859-5.c | 288 -
.../filesystems/reiserfs/src/nls/nls_iso8859-6.c | 279 -
.../filesystems/reiserfs/src/nls/nls_iso8859-7.c | 333 -
.../filesystems/reiserfs/src/nls/nls_iso8859-8.c | 62 -
.../filesystems/reiserfs/src/nls/nls_iso8859-9.c | 288 -
drivers/filesystems/reiserfs/src/nls/nls_koi8-r.c | 339 -
drivers/filesystems/reiserfs/src/nls/nls_koi8-ru.c | 99 -
drivers/filesystems/reiserfs/src/nls/nls_koi8-u.c | 346 -
drivers/filesystems/reiserfs/src/nls/nls_sjis.c | 62 -
drivers/filesystems/reiserfs/src/nls/nls_tis-620.c | 62 -
drivers/filesystems/reiserfs/src/nls/nls_utf8.c | 60 -
drivers/filesystems/reiserfs/src/pnp.c | 439 -
drivers/filesystems/reiserfs/src/read.c | 970 --
drivers/filesystems/reiserfs/src/rfsd.c | 3038 ----
drivers/filesystems/reiserfs/src/rfsd.rc | 108 -
drivers/filesystems/reiserfs/src/rfsdblock.c | 166 -
drivers/filesystems/reiserfs/src/shutdown.c | 121 -
drivers/filesystems/reiserfs/src/volinfo.c | 429 -
drivers/filesystems/reiserfs/src/write.c | 1462 --
media/doc/3rd Party Files.txt | 6 -
sdk/cmake/baseaddress.cmake | 1 -
sdk/cmake/baseaddress_dwarf.cmake | 1 -
sdk/cmake/baseaddress_msvc.cmake | 1 -
sdk/cmake/baseaddress_msvc_x64.cmake | 1 -
sdk/include/reactos/libs/fslib/reiserfslib.h | 39 -
sdk/lib/fslib/CMakeLists.txt | 1 -
sdk/lib/fslib/reiserfslib/CMakeLists.txt | 3 -
sdk/lib/fslib/reiserfslib/reiserfslib.c | 49 -
120 files changed, 3 insertions(+), 83333 deletions(-)
diff --git a/CODEOWNERS b/CODEOWNERS
index f93cde130e2..736ee9ce6aa 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -269,7 +269,6 @@
/drivers/filesystems/fastfat_new/ @HeisSpiter
/drivers/filesystems/ffs/ @HeisSpiter
/drivers/filesystems/nfs/ @HeisSpiter
-/drivers/filesystems/reiserfs/ @HeisSpiter
/media/doc/README.FSD @HeisSpiter
/sdk/lib/fslib/btrfslib/ @HeisSpiter
/sdk/lib/fslib/ext2lib/ @HeisSpiter
diff --git a/base/setup/lib/bootsup.c b/base/setup/lib/bootsup.c
index d3aad8ee95e..3aefff04ee4 100644
--- a/base/setup/lib/bootsup.c
+++ b/base/setup/lib/bootsup.c
@@ -1261,8 +1261,7 @@ InstallVBRToPartition(
else if (wcsicmp(FileSystemName, L"EXT2") == 0 ||
wcsicmp(FileSystemName, L"EXT3") == 0 ||
wcsicmp(FileSystemName, L"EXT4") == 0 ||
- wcsicmp(FileSystemName, L"FFS") == 0 ||
- wcsicmp(FileSystemName, L"REISERFS") == 0)
+ wcsicmp(FileSystemName, L"FFS") == 0)
{
return STATUS_NOT_SUPPORTED;
}
diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c
index c244111a381..fde965c89cf 100644
--- a/base/setup/lib/fsutil.c
+++ b/base/setup/lib/fsutil.c
@@ -143,7 +143,6 @@ static FILE_SYSTEM RegisteredFileSystems[] =
{ L"EXT3" , Ext2Format, Ext2Chkdsk },
{ L"EXT4" , Ext2Format, Ext2Chkdsk },
{ L"FFS" , FfsFormat , FfsChkdsk },
- { L"REISERFS", ReiserfsFormat, ReiserfsChkdsk },
#endif
};
diff --git a/base/setup/lib/utils/fsrec.c b/base/setup/lib/utils/fsrec.c
index 0b42113a805..6011ef4107f 100644
--- a/base/setup/lib/utils/fsrec.c
+++ b/base/setup/lib/utils/fsrec.c
@@ -393,8 +393,7 @@ FileSystemToMBRPartitionType(
wcsicmp(FileSystem, L"EXT2") == 0 ||
wcsicmp(FileSystem, L"EXT3") == 0 ||
wcsicmp(FileSystem, L"EXT4") == 0 ||
- wcsicmp(FileSystem, L"FFS") == 0 ||
- wcsicmp(FileSystem, L"REISERFS") == 0)
+ wcsicmp(FileSystem, L"FFS") == 0)
{
return PARTITION_LINUX;
}
diff --git a/base/system/autochk/CMakeLists.txt b/base/system/autochk/CMakeLists.txt
index d2c03339285..f7448ee585d 100644
--- a/base/system/autochk/CMakeLists.txt
+++ b/base/system/autochk/CMakeLists.txt
@@ -1,6 +1,6 @@
add_executable(autochk WIN32 autochk.c autochk.rc)
set_module_type(autochk nativecui)
-target_link_libraries(autochk nt vfatlib vfatxlib ntfslib btrfslib ext2lib ffslib reiserfslib cdfslib)
+target_link_libraries(autochk nt vfatlib vfatxlib ntfslib btrfslib ext2lib ffslib cdfslib)
add_importlibs(autochk ntdll)
add_cd_file(TARGET autochk DESTINATION reactos/system32 FOR all)
diff --git a/base/system/autochk/autochk.c b/base/system/autochk/autochk.c
index 33d3593d776..8f2a7a427bf 100644
--- a/base/system/autochk/autochk.c
+++ b/base/system/autochk/autochk.c
@@ -32,7 +32,6 @@
#include <fslib/btrfslib.h>
#include <fslib/ext2lib.h>
#include <fslib/ffslib.h>
-#include <fslib/reiserfslib.h>
#include <fslib/cdfslib.h>
#define NDEBUG
@@ -57,7 +56,6 @@ FILESYSTEM_CHKDSK FileSystems[] =
{ L"EXT3", Ext2Chkdsk },
{ L"EXT4", Ext2Chkdsk },
{ L"FFS", FfsChkdsk },
- { L"RFSD", ReiserfsChkdsk },
{ L"CDFS", CdfsChkdsk },
};
diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf
index f35501c8a0c..c041a0b379e 100644
--- a/boot/bootdata/hivesys.inf
+++ b/boot/bootdata/hivesys.inf
@@ -2197,15 +2197,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\btrfs","ImagePath",0x00020000,"system32\
HKLM,"SYSTEM\CurrentControlSet\Services\btrfs","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\btrfs","Type",0x00010001,0x00000002
-; REISER Filesystem driver
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs","ErrorControl",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs","Group",0x00000000,"Boot File System"
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs","ImagePath",0x00020000,"system32\drivers\reiserfs.sys"
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs","Start",0x00010001,0x00000003
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs","Type",0x00010001,0x00000002
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs\Parameters","CodePage",0x00000000,"default"
-HKLM,"SYSTEM\CurrentControlSet\Services\Reiserfs\Parameters","WritingSupport",0x00010001,0x00000001
-
; FFS Filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\ffs","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\ffs","Group",0x00000000,"Boot File System"
diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt
index 2f46ab09f56..e60d18bed0c 100644
--- a/dll/win32/CMakeLists.txt
+++ b/dll/win32/CMakeLists.txt
@@ -217,7 +217,6 @@ add_subdirectory(ufatx)
add_subdirectory(uffs)
add_subdirectory(untfs)
add_subdirectory(updspapi)
-add_subdirectory(ureiserfs)
add_subdirectory(url)
add_subdirectory(urlmon)
add_subdirectory(userenv)
diff --git a/dll/win32/ureiserfs/CMakeLists.txt b/dll/win32/ureiserfs/CMakeLists.txt
deleted file mode 100644
index e08d3835989..00000000000
--- a/dll/win32/ureiserfs/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-spec2def(ureiserfs.dll ureiserfs.spec)
-
-list(APPEND SOURCE
- ureiserfs.c
- ureiserfs.rc
- ${CMAKE_CURRENT_BINARY_DIR}/ureiserfs.def)
-
-add_library(ureiserfs MODULE ${SOURCE})
-set_module_type(ureiserfs nativedll)
-target_link_libraries(ureiserfs reiserfslib)
-add_importlibs(ureiserfs ntdll)
-add_cd_file(TARGET ureiserfs DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/ureiserfs/ureiserfs.c b/dll/win32/ureiserfs/ureiserfs.c
deleted file mode 100644
index 112c8a788bf..00000000000
--- a/dll/win32/ureiserfs/ureiserfs.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReiserFS File System Management
- * FILE: dll/win32/ureiserfs/ureiserfs.c
- * PURPOSE: ureiserfs DLL initialisation
- * PROGRAMMERS: Pierre Schweitzer
- */
-
-#include <windef.h>
-
-INT WINAPI
-DllMain(
- IN HINSTANCE hinstDLL,
- IN DWORD dwReason,
- IN LPVOID lpvReserved)
-{
- UNREFERENCED_PARAMETER(hinstDLL);
- UNREFERENCED_PARAMETER(dwReason);
- UNREFERENCED_PARAMETER(lpvReserved);
-
- return TRUE;
-}
diff --git a/dll/win32/ureiserfs/ureiserfs.rc b/dll/win32/ureiserfs/ureiserfs.rc
deleted file mode 100644
index b404581e825..00000000000
--- a/dll/win32/ureiserfs/ureiserfs.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-#define REACTOS_VERSION_DLL
-#define REACTOS_STR_FILE_DESCRIPTION "ReiserFS File System Management"
-#define REACTOS_STR_INTERNAL_NAME "ureiserfs"
-#define REACTOS_STR_ORIGINAL_FILENAME "ureiserfs.dll"
-#include <reactos/version.rc>
diff --git a/dll/win32/ureiserfs/ureiserfs.spec b/dll/win32/ureiserfs/ureiserfs.spec
deleted file mode 100644
index 496546ae682..00000000000
--- a/dll/win32/ureiserfs/ureiserfs.spec
+++ /dev/null
@@ -1,2 +0,0 @@
-@ stdcall Chkdsk(ptr ptr long long long long ptr ptr ptr ptr ptr) ReiserfsChkdsk
-@ stdcall Format(ptr ptr long long long ptr long) ReiserfsFormat
diff --git a/drivers/filesystems/CMakeLists.txt b/drivers/filesystems/CMakeLists.txt
index 3d5277dfa74..74372075bf7 100644
--- a/drivers/filesystems/CMakeLists.txt
+++ b/drivers/filesystems/CMakeLists.txt
@@ -11,5 +11,4 @@ add_subdirectory(mup)
add_subdirectory(nfs)
add_subdirectory(npfs)
add_subdirectory(ntfs)
-add_subdirectory(reiserfs)
add_subdirectory(udfs)
diff --git a/drivers/filesystems/reiserfs/CMakeLists.txt b/drivers/filesystems/reiserfs/CMakeLists.txt
deleted file mode 100644
index 84e680eb2f7..00000000000
--- a/drivers/filesystems/reiserfs/CMakeLists.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-
-include_directories(${REACTOS_SOURCE_DIR}/sdk/include/drivers
- inc)
-
-list(APPEND SOURCE
- src/nls/nls_base.c
- src/nls/nls_big5.c
- src/nls/nls_cp437.c
- src/nls/nls_cp737.c
- src/nls/nls_cp775.c
- src/nls/nls_cp850.c
- src/nls/nls_cp852.c
- src/nls/nls_cp855.c
- src/nls/nls_cp857.c
- src/nls/nls_cp860.c
- src/nls/nls_cp861.c
- src/nls/nls_cp862.c
- src/nls/nls_cp863.c
- src/nls/nls_cp864.c
- src/nls/nls_cp865.c
- src/nls/nls_cp866.c
- src/nls/nls_cp869.c
- src/nls/nls_cp874.c
- src/nls/nls_cp932.c
- src/nls/nls_cp936.c
- src/nls/nls_cp949.c
- src/nls/nls_cp950.c
- src/nls/nls_cp1251.c
- src/nls/nls_cp1255.c
- src/nls/nls_euc-jp.c
- src/nls/nls_euc-kr.c
- src/nls/nls_gb2312.c
- src/nls/nls_iso8859-1.c
- src/nls/nls_iso8859-2.c
- src/nls/nls_iso8859-3.c
- src/nls/nls_iso8859-4.c
- src/nls/nls_iso8859-5.c
- src/nls/nls_iso8859-6.c
- src/nls/nls_iso8859-7.c
- src/nls/nls_iso8859-8.c
- src/nls/nls_iso8859-9.c
- src/nls/nls_iso8859-13.c
- src/nls/nls_iso8859-14.c
- src/nls/nls_iso8859-15.c
- src/nls/nls_koi8-r.c
- src/nls/nls_koi8-ru.c
- src/nls/nls_koi8-u.c
- src/nls/nls_sjis.c
- src/nls/nls_tis-620.c
- src/nls/nls_utf8.c
- src/blockio.c
- src/cleanup.c
- src/close.c
- src/cmcb.c
- src/create.c
- src/debug.c
- src/devctl.c
- src/dirctl.c
- src/dispatch.c
- src/except.c
- src/fastio.c
- src/fileinfo.c
- src/flush.c
- src/fsctl.c
- src/init.c
- src/lockctl.c
- src/memory.c
- src/misc.c
- src/nls.c
- src/pnp.c
- src/read.c
- src/rfsd.c
- src/rfsdblock.c
- src/shutdown.c
- src/volinfo.c
- src/write.c
- inc/rfsd.h)
-
-add_library(reiserfs MODULE ${SOURCE} src/rfsd.rc)
-
-if(USE_CLANG_CL OR (NOT MSVC))
- target_compile_options(reiserfs PRIVATE -Wno-missing-braces -Wno-pointer-sign)
- target_compile_options(reiserfs PRIVATE -Wno-unused-function -Wno-unused-variable)
- if(NOT USE_CLANG_CL)
- target_compile_definitions(reiserfs PRIVATE __GCC__)
- endif()
-else()
- #disable warnings: "unreferenced local variable", "initialized, but not used variable", "benign include"
- remove_target_compile_option(reiserfs "/we4101")
- remove_target_compile_option(reiserfs "/we4189")
- target_compile_options(reiserfs PRIVATE /wd4189 /wd4142 /wd4101)
-endif()
-
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
- target_compile_options(reiserfs PRIVATE -Wno-unused-but-set-variable)
-endif()
-
-target_link_libraries(reiserfs memcmp ${PSEH_LIB})
-add_definitions(-D__KERNEL__ -D_CRT_NO_POSIX_ERROR_CODES)
-set_module_type(reiserfs kernelmodedriver)
-add_importlibs(reiserfs ntoskrnl hal)
-add_pch(reiserfs inc/rfsd.h SOURCE)
-add_cd_file(TARGET reiserfs DESTINATION reactos/system32/drivers FOR all)
diff --git a/drivers/filesystems/reiserfs/inc/linux/bit_spinlock.h b/drivers/filesystems/reiserfs/inc/linux/bit_spinlock.h
deleted file mode 100644
index 7113a32a86e..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/bit_spinlock.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef __LINUX_BIT_SPINLOCK_H
-#define __LINUX_BIT_SPINLOCK_H
-
-/*
- * bit-based spin_lock()
- *
- * Don't use this unless you really need to: spin_lock() and spin_unlock()
- * are significantly faster.
- */
-static inline void bit_spin_lock(int bitnum, unsigned long *addr)
-{
- /*
- * Assuming the lock is uncontended, this never enters
- * the body of the outer loop. If it is contended, then
- * within the inner loop a non-atomic test is used to
- * busywait with less bus contention for a good time to
- * attempt to acquire the lock bit.
- */
- preempt_disable();
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
- while (unlikely(test_and_set_bit_lock(bitnum, addr))) {
- while (test_bit(bitnum, addr)) {
- preempt_enable();
- cpu_relax();
- preempt_disable();
- }
- }
-#endif
- __acquire(bitlock);
-}
-
-/*
- * Return true if it was acquired
- */
-static inline int bit_spin_trylock(int bitnum, unsigned long *addr)
-{
- preempt_disable();
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
- if (unlikely(test_and_set_bit_lock(bitnum, addr))) {
- preempt_enable();
- return 0;
- }
-#endif
- __acquire(bitlock);
- return 1;
-}
-
-/*
- * bit-based spin_unlock()
- */
-static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
-{
-#ifdef CONFIG_DEBUG_SPINLOCK
- BUG_ON(!test_bit(bitnum, addr));
-#endif
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
- clear_bit_unlock(bitnum, addr);
-#endif
- preempt_enable();
- __release(bitlock);
-}
-
-/*
- * bit-based spin_unlock()
- * non-atomic version, which can be used eg. if the bit lock itself is
- * protecting the rest of the flags in the word.
- */
-static inline void __bit_spin_unlock(int bitnum, unsigned long *addr)
-{
-#ifdef CONFIG_DEBUG_SPINLOCK
- BUG_ON(!test_bit(bitnum, addr));
-#endif
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
- __clear_bit_unlock(bitnum, addr);
-#endif
- preempt_enable();
- __release(bitlock);
-}
-
-/*
- * Return true if the lock is held.
- */
-static inline int bit_spin_is_locked(int bitnum, unsigned long *addr)
-{
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
- return test_bit(bitnum, addr);
-#elif defined CONFIG_PREEMPT
- return preempt_count();
-#else
- return 1;
-#endif
-}
-
-#endif /* __LINUX_BIT_SPINLOCK_H */
-
diff --git a/drivers/filesystems/reiserfs/inc/linux/bitops.h b/drivers/filesystems/reiserfs/inc/linux/bitops.h
deleted file mode 100644
index ce6f73ad7e0..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/bitops.h
+++ /dev/null
@@ -1,342 +0,0 @@
-#ifndef _LINUX_BITOPS_H
-#define _LINUX_BITOPS_H
-
-#include <ntifs.h>
-#include <linux/types.h>
-
-#ifdef __KERNEL__
-#define BIT(nr) (1 << (nr))
-#define BIT_MASK(nr) (1 << ((nr) % BITS_PER_LONG))
-#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
-#define BITS_PER_BYTE 8
-#endif
-
-/*
- * Include this here because some architectures need generic_ffs/fls in
- * scope
- */
-
-/**
- * find_first_zero_bit - find the first zero bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit number of the first zero bit, not the number of the byte
- * containing a bit.
- */
-#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
-
-/**
- * find_next_zero_bit - find the first zero bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bit number to start searching at
- * @size: The maximum size to search
- */
-int find_next_zero_bit(const unsigned long *addr, int size, int offset);
-
-/**
- * __ffs - find first bit in word.
- * @word: The word to search
- *
- * Undefined if no bit exists, so code should check against 0 first.
- */
-static inline unsigned long __ffs(unsigned long word)
-{
- int num = 0;
-
-#if BITS_PER_LONG == 64
- if ((word & 0xffffffff) == 0) {
- num += 32;
- word >>= 32;
- }
-#endif
- if ((word & 0xffff) == 0) {
- num += 16;
- word >>= 16;
- }
- if ((word & 0xff) == 0) {
- num += 8;
- word >>= 8;
- }
- if ((word & 0xf) == 0) {
- num += 4;
- word >>= 4;
- }
- if ((word & 0x3) == 0) {
- num += 2;
- word >>= 2;
- }
- if ((word & 0x1) == 0)
- num += 1;
- return num;
-}
-
-/**
- * find_first_bit - find the first set bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit number of the first set bit, not the number of the byte
- * containing a bit.
- */
-static inline unsigned find_first_bit(const unsigned long *addr, unsigned size)
-{
- unsigned x = 0;
-
- while (x < size) {
- unsigned long val = *addr++;
- if (val)
- return __ffs(val) + x;
- x += (sizeof(*addr)<<3);
- }
- return x;
-}
-
-/**
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-
-#pragma message("WARNINGS: find_next_bit NOT implemented ...")
-
-#if _X86_
-int find_next_bit(const unsigned long *addr, int size, int offset)
-{
- const unsigned long *p = addr + (offset >> 5);
- int set = 0, bit = offset & 31, res = 0;
-#if 0
- if (bit) {
-
- /*
- * Look for nonzero in the first 32 bits:
- */
- __asm__("bsfl %1,%0\n\t"
- "jne 1f\n\t"
- "movl $32, %0\n"
- "1:"
- : "=r" (set)
- : "r" (*p >> bit));
-
- if (set < (32 - bit))
- return set + offset;
- set = 32 - bit;
- p++;
- }
- /*
- * No set bit yet, search remaining full words for a bit
- */
- res = find_first_bit (p, size - 32 * (p - addr));
-#endif
- return (offset + set + res);
-}
-#else /* _X64_ */
-long find_next_bit(const unsigned long * addr, long size, long offset)
-{
- const unsigned long * p = addr + (offset >> 6);
- unsigned long set = 0, bit = offset & 63, res = 0;
-
-#if 0
- if (bit) {
- /*
- * Look for nonzero in the first 64 bits:
- */
- asm("bsfq %1,%0\n\t"
- "cmoveq %2,%0\n\t"
- : "=r" (set)
- : "r" (*p >> bit), "r" (64L));
- if (set < (64 - bit))
- return set + offset;
- set = 64 - bit;
- p++;
- }
- /*
- * No set bit yet, search remaining full words for a bit
- */
- res = find_first_bit (p, size - 64 * (p - addr));
-#endif
-
- return (offset + set + res);
-}
-#endif /* _X86_ */
-
-/*
- * ffz - find first zero in word.
- * @word: The word to search
- *
- * Undefined if no zero exists, so code should check against ~0UL first.
- */
-#define ffz(x) __ffs(~(x))
-
-
-/**
- * ffs - find first bit set
- * @x: the word to search
- *
- * This is defined the same way as
- * the libc and compiler builtin ffs routines, therefore
- * differs in spirit from the above ffz (man ffs).
- */
-static inline int ffs(int x)
-{
- int r = 1;
-
- if (!x)
- return 0;
- if (!(x & 0xffff)) {
- x >>= 16;
- r += 16;
- }
- if (!(x & 0xff)) {
- x >>= 8;
- r += 8;
- }
- if (!(x & 0xf)) {
- x >>= 4;
- r += 4;
- }
- if (!(x & 3)) {
- x >>= 2;
- r += 2;
- }
- if (!(x & 1)) {
- x >>= 1;
- r += 1;
- }
- return r;
-}
-
-/**
- * fls - find last (most-significant) bit set
- * @x: the word to search
- *
- * This is defined the same way as ffs.
- * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
- */
-
-static inline int fls(int x)
-{
- int r = 32;
-
- if (!x)
- return 0;
- if (!(x & 0xffff0000u)) {
- x <<= 16;
- r -= 16;
- }
- if (!(x & 0xff000000u)) {
- x <<= 8;
- r -= 8;
- }
- if (!(x & 0xf0000000u)) {
- x <<= 4;
- r -= 4;
- }
- if (!(x & 0xc0000000u)) {
- x <<= 2;
- r -= 2;
- }
- if (!(x & 0x80000000u)) {
- x <<= 1;
- r -= 1;
- }
- return r;
-}
-
-static inline int fls64(__u64 x)
-{
- __u32 h = (__u32) (x >> 32);
- if (h)
- return fls(h) + 32;
- return fls((int)x);
-}
-
-#define for_each_bit(bit, addr, size) \
- for ((bit) = find_first_bit((addr), (size)); \
- (bit) < (size); \
- (bit) = find_next_bit((addr), (size), (bit) + 1))
-
-
-static __inline int get_bitmask_order(unsigned int count)
-{
- int order;
-
- order = fls(count);
- return order; /* We could be slightly more clever with -1 here... */
-}
-
-static __inline int get_count_order(unsigned int count)
-{
- int order;
-
- order = fls(count) - 1;
- if (count & (count - 1))
- order++;
- return order;
-}
-
-
-/**
- * rol32 - rotate a 32-bit value left
- * @word: value to rotate
- * @shift: bits to roll
- */
-static inline __u32 rol32(__u32 word, unsigned int shift)
-{
- return (word << shift) | (word >> (32 - shift));
-}
-
-/**
- * ror32 - rotate a 32-bit value right
- * @word: value to rotate
- * @shift: bits to roll
- */
-static inline __u32 ror32(__u32 word, unsigned int shift)
-{
- return (word >> shift) | (word << (32 - shift));
-}
-
-static inline unsigned fls_long(unsigned long l)
-{
- if (sizeof(l) == 4)
- return fls(l);
- return fls64(l);
-}
-
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-
-static inline unsigned long hweight32(unsigned long w)
-{
- unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
- res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
- res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
- res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
- return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
-}
-
-static inline unsigned long hweight64(__u64 w)
-{
-#if BITS_PER_LONG < 64
- return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
-#else
- u64 res;
- res = (w & 0x5555555555555555U) + ((w >> 1) & 0x5555555555555555U);
- res = (res & 0x3333333333333333U) + ((res >> 2) & 0x3333333333333333U);
- res = (res & 0x0F0F0F0F0F0F0F0FU) + ((res >> 4) & 0x0F0F0F0F0F0F0F0FU);
- res = (res & 0x00FF00FF00FF00FFU) + ((res >> 8) & 0x00FF00FF00FF00FFU);
- res = (res & 0x0000FFFF0000FFFFU) + ((res >> 16) & 0x0000FFFF0000FFFFU);
- return (res & 0x00000000FFFFFFFFU) + ((res >> 32) & 0x00000000FFFFFFFFU);
-#endif
-}
-
-static inline unsigned long hweight_long(unsigned long w)
-{
- return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
-}
-
-#endif
diff --git a/drivers/filesystems/reiserfs/inc/linux/config.h b/drivers/filesystems/reiserfs/inc/linux/config.h
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/drivers/filesystems/reiserfs/inc/linux/errno.h b/drivers/filesystems/reiserfs/inc/linux/errno.h
deleted file mode 100644
index e061be9abf2..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/errno.h
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifndef _I386_ERRNO_H
-#define _I386_ERRNO_H
-
-#define EPERM 1 /* Operation not permitted */
-#define ENOENT 2 /* No such file or directory */
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted system call */
-#define EIO 5 /* I/O error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file number */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Try again */
-#define ENOMEM 12 /* Out of memory */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-#define ENOTBLK 15 /* Block device required */
-#define EBUSY 16 /* Device or resource busy */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Cross-device link */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* File table overflow */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Not a typewriter */
-#define ETXTBSY 26 /* Text file busy */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Illegal seek */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Math argument out of domain of func */
-#define ERANGE 34 /* Math result not representable */
-#undef EDEADLK
-#define EDEADLK 35 /* Resource deadlock would occur */
-#undef ENAMETOOLONG
-#define ENAMETOOLONG 36 /* File name too long */
-#undef ENOLCK
-#define ENOLCK 37 /* No record locks available */
-#undef ENOSYS
-#define ENOSYS 38 /* Function not implemented */
-#undef ENOTEMPTY
-#define ENOTEMPTY 39 /* Directory not empty */
-#define ELOOP 40 /* Too many symbolic links encountered */
-#ifndef __REACTOS__
-#define EWOULDBLOCK EAGAIN /* Operation would block */
-#endif
-#define ENOMSG 42 /* No message of desired type */
-#define EIDRM 43 /* Identifier removed */
-#define ECHRNG 44 /* Channel number out of range */
-#define EL2NSYNC 45 /* Level 2 not synchronized */
-#define EL3HLT 46 /* Level 3 halted */
-#define EL3RST 47 /* Level 3 reset */
-#define ELNRNG 48 /* Link number out of range */
-#define EUNATCH 49 /* Protocol driver not attached */
-#define ENOCSI 50 /* No CSI structure available */
-#define EL2HLT 51 /* Level 2 halted */
-#define EBADE 52 /* Invalid exchange */
-#define EBADR 53 /* Invalid request descriptor */
-#define EXFULL 54 /* Exchange full */
-#define ENOANO 55 /* No anode */
-#define EBADRQC 56 /* Invalid request code */
-#define EBADSLT 57 /* Invalid slot */
-
-#define EDEADLOCK EDEADLK
-
-#define EBFONT 59 /* Bad font file format */
-#define ENOSTR 60 /* Device not a stream */
-#define ENODATA 61 /* No data available */
-#define ETIME 62 /* Timer expired */
-#define ENOSR 63 /* Out of streams resources */
-#define ENONET 64 /* Machine is not on the network */
-#define ENOPKG 65 /* Package not installed */
-#define EREMOTE 66 /* Object is remote */
-#define ENOLINK 67 /* Link has been severed */
-#define EADV 68 /* Advertise error */
-#define ESRMNT 69 /* Srmount error */
-#define ECOMM 70 /* Communication error on send */
-#define EPROTO 71 /* Protocol error */
-#define EMULTIHOP 72 /* Multihop attempted */
-#define EDOTDOT 73 /* RFS specific error */
-#define EBADMSG 74 /* Not a data message */
-#define EOVERFLOW 75 /* Value too large for defined data type */
-#define ENOTUNIQ 76 /* Name not unique on network */
-#define EBADFD 77 /* File descriptor in bad state */
-#define EREMCHG 78 /* Remote address changed */
-#define ELIBACC 79 /* Can not access a needed shared library */
-#define ELIBBAD 80 /* Accessing a corrupted shared library */
-#define ELIBSCN 81 /* .lib section in a.out corrupted */
-#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
-#define ELIBEXEC 83 /* Cannot exec a shared library directly */
-#undef EILSEQ
-#define EILSEQ 84 /* Illegal byte sequence */
-#define ERESTART 85 /* Interrupted system call should be restarted */
-#define ESTRPIPE 86 /* Streams pipe error */
-#define EUSERS 87 /* Too many users */
-#define ENOTSOCK 88 /* Socket operation on non-socket */
-#define EDESTADDRREQ 89 /* Destination address required */
-#define EMSGSIZE 90 /* Message too long */
-#define EPROTOTYPE 91 /* Protocol wrong type for socket */
-#define ENOPROTOOPT 92 /* Protocol not available */
-#define EPROTONOSUPPORT 93 /* Protocol not supported */
-#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
-#define EPFNOSUPPORT 96 /* Protocol family not supported */
-#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
-#define EADDRINUSE 98 /* Address already in use */
-#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
-#define ENETDOWN 100 /* Network is down */
-#define ENETUNREACH 101 /* Network is unreachable */
-#define ENETRESET 102 /* Network dropped connection because of reset */
-#define ECONNABORTED 103 /* Software caused connection abort */
-#define ECONNRESET 104 /* Connection reset by peer */
-#define ENOBUFS 105 /* No buffer space available */
-#define EISCONN 106 /* Transport endpoint is already connected */
-#define ENOTCONN 107 /* Transport endpoint is not connected */
-#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
-#define ETOOMANYREFS 109 /* Too many references: cannot splice */
-#define ETIMEDOUT 110 /* Connection timed out */
-#define ECONNREFUSED 111 /* Connection refused */
-#define EHOSTDOWN 112 /* Host is down */
-#define EHOSTUNREACH 113 /* No route to host */
-#define EALREADY 114 /* Operation already in progress */
-#define EINPROGRESS 115 /* Operation now in progress */
-#define ESTALE 116 /* Stale NFS file handle */
-#define EUCLEAN 117 /* Structure needs cleaning */
-#define ENOTNAM 118 /* Not a XENIX named type file */
-#define ENAVAIL 119 /* No XENIX semaphores available */
-#define EISNAM 120 /* Is a named type file */
-#define EREMOTEIO 121 /* Remote I/O error */
-#define EDQUOT 122 /* Quota exceeded */
-
-#define ENOMEDIUM 123 /* No medium found */
-#define EMEDIUMTYPE 124 /* Wrong medium type */
-
-#endif
diff --git a/drivers/filesystems/reiserfs/inc/linux/fs.h b/drivers/filesystems/reiserfs/inc/linux/fs.h
deleted file mode 100644
index 0665e1c5f4e..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/fs.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _LINUX_FS_INCLUDE_
-#define _LINUX_FS_INCLUDE_
-
-#endif /*_LINUX_FS_INCLUDE_*/
\ No newline at end of file
diff --git a/drivers/filesystems/reiserfs/inc/linux/jbd.h b/drivers/filesystems/reiserfs/inc/linux/jbd.h
deleted file mode 100644
index 7d8ce0fb9d1..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/jbd.h
+++ /dev/null
@@ -1,1106 +0,0 @@
-/*
- * linux/include/linux/jbd.h
- *
- * Written by Stephen C. Tweedie <sct(a)redhat.com>
- *
- * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
- *
- * This file is part of the Linux kernel and is made available under
- * the terms of the GNU General Public License, version 2, or at your
- * option, any later version, incorporated herein by reference.
- *
- * Definitions for transaction data structures for the buffer cache
- * filesystem journaling support.
- */
-
-#ifndef _LINUX_JBD_H
-#define _LINUX_JBD_H
-
-/* Allow this file to be included directly into e2fsprogs */
-#ifndef __KERNEL__
-#include "jfs_compat.h"
-#define JFS_DEBUG
-#define jfs_debug jbd_debug
-#else
-
-#include <linux/module.h>
-#include <linux/buffer_head.h>
-#include <linux/journal-head.h>
-#include <linux/stddef.h>
-#include <linux/bit_spinlock.h>
-#include <linux/mutex.h>
-#include <linux/timer.h>
-#include <linux/lockdep.h>
-
-#include <asm/semaphore.h>
-
-#define journal_oom_retry 1
-
-/*
- * Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds
- * certain classes of error which can occur due to failed IOs. Under
- * normal use we want ext3 to continue after such errors, because
- * hardware _can_ fail, but for debugging purposes when running tests on
- * known-good hardware we may want to trap these errors.
- */
-#undef JBD_PARANOID_IOFAIL
-
-/*
- * The default maximum commit age, in seconds.
- */
-#define JBD_DEFAULT_MAX_COMMIT_AGE 5
-
-#ifdef CONFIG_JBD_DEBUG
-/*
- * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
- * consistency checks. By default we don't do this unless
- * CONFIG_JBD_DEBUG is on.
- */
-#define JBD_EXPENSIVE_CHECKING
-extern u8 journal_enable_debug;
-
-#define jbd_debug(n, f, a...) \
- do { \
- if ((n) <= journal_enable_debug) { \
- printk (KERN_DEBUG "(%s, %d): %s: ", \
- __FILE__, __LINE__, __FUNCTION__); \
- printk (f, ## a); \
- } \
- } while (0)
-#else
-#define jbd_debug
-#endif
-
-static inline void *jbd_alloc(size_t size, gfp_t flags)
-{
- return kmalloc(size, flags);
- /*__get_free_pages(flags, get_order(size));*/
-}
-
-static inline void jbd_free(void *ptr, size_t size)
-{
- if (ptr) {
- kfree(ptr);
- }
- /* free_pages((unsigned long)ptr, get_order(size)); */
-};
-
-#define JFS_MIN_JOURNAL_BLOCKS 1024
-
-
-/**
- * typedef handle_t - The handle_t type represents a single atomic update being performed by some process.
- *
- * All filesystem modifications made by the process go
- * through this handle. Recursive operations (such as quota operations)
- * are gathered into a single update.
- *
- * The buffer credits field is used to account for journaled buffers
- * being modified by the running process. To ensure that there is
- * enough log space for all outstanding operations, we need to limit the
- * number of outstanding buffers possible at any time. When the
- * operation completes, any buffer credits not used are credited back to
- * the transaction, so that at all times we know how many buffers the
- * outstanding updates on a transaction might possibly touch.
- *
- * This is an opaque datatype.
- **/
-typedef struct handle_s handle_t; /* Atomic operation type */
-
-
-/**
- * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
- *
- * journal_t is linked to from the fs superblock structure.
- *
- * We use the journal_t to keep track of all outstanding transaction
- * activity on the filesystem, and to manage the state of the log
- * writing process.
- *
- * This is an opaque datatype.
- **/
-typedef struct journal_s journal_t; /* Journal control structure */
-#endif
-
-/*
- * Internal structures used by the logging mechanism:
- */
-
-#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
-
-/*
- * On-disk structures
- */
-
-/*
- * Descriptor block types:
- */
-
-#define JFS_DESCRIPTOR_BLOCK 1
-#define JFS_COMMIT_BLOCK 2
-#define JFS_SUPERBLOCK_V1 3
-#define JFS_SUPERBLOCK_V2 4
-#define JFS_REVOKE_BLOCK 5
-
-/*
- * Standard header for all descriptor blocks:
- */
-typedef struct journal_header_s
-{
- __be32 h_magic;
- __be32 h_blocktype;
- __be32 h_sequence;
-} journal_header_t;
-
-
-/*
- * The block tag: used to describe a single buffer in the journal
- */
-typedef struct journal_block_tag_s
-{
- __be32 t_blocknr; /* The on-disk block number */
- __be32 t_flags; /* See below */
-} journal_block_tag_t;
-
-/*
- * The revoke descriptor: used on disk to describe a series of blocks to
- * be revoked from the log
- */
-typedef struct journal_revoke_header_s
-{
- journal_header_t r_header;
- __be32 r_count; /* Count of bytes used in the block */
-} journal_revoke_header_t;
-
-
-/* Definitions for the journal tag flags word: */
-#define JFS_FLAG_ESCAPE 1 /* on-disk block is escaped */
-#define JFS_FLAG_SAME_UUID 2 /* block has same uuid as previous */
-#define JFS_FLAG_DELETED 4 /* block deleted by this transaction */
-#define JFS_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
-
-
-/*
- * The journal superblock. All fields are in big-endian byte order.
- */
-typedef struct journal_superblock_s
-{
-/* 0x0000 */
- journal_header_t s_header;
-
-/* 0x000C */
- /* Static information describing the journal */
- __be32 s_blocksize; /* journal device blocksize */
- __be32 s_maxlen; /* total blocks in journal file */
- __be32 s_first; /* first block of log information */
-
-/* 0x0018 */
- /* Dynamic information describing the current state of the log */
- __be32 s_sequence; /* first commit ID expected in log */
- __be32 s_start; /* blocknr of start of log */
-
-/* 0x0020 */
- /* Error value, as set by journal_abort(). */
- __be32 s_errno;
-
-/* 0x0024 */
- /* Remaining fields are only valid in a version-2 superblock */
- __be32 s_feature_compat; /* compatible feature set */
- __be32 s_feature_incompat; /* incompatible feature set */
- __be32 s_feature_ro_compat; /* readonly-compatible feature set */
-/* 0x0030 */
- __u8 s_uuid[16]; /* 128-bit uuid for journal */
-
-/* 0x0040 */
- __be32 s_nr_users; /* Nr of filesystems sharing log */
-
- __be32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
-
-/* 0x0048 */
- __be32 s_max_transaction; /* Limit of journal blocks per trans.*/
- __be32 s_max_trans_data; /* Limit of data blocks per trans. */
-
-/* 0x0050 */
- __u32 s_padding[44];
-
-/* 0x0100 */
- __u8 s_users[16*48]; /* ids of all fs'es sharing the log */
-/* 0x0400 */
-} journal_superblock_t;
-
-#define JFS_HAS_COMPAT_FEATURE(j,mask) \
- ((j)->j_format_version >= 2 && \
- ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
-#define JFS_HAS_RO_COMPAT_FEATURE(j,mask) \
- ((j)->j_format_version >= 2 && \
- ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
-#define JFS_HAS_INCOMPAT_FEATURE(j,mask) \
- ((j)->j_format_version >= 2 && \
- ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
-
-#define JFS_FEATURE_INCOMPAT_REVOKE 0x00000001
-
-/* Features known to this kernel version: */
-#define JFS_KNOWN_COMPAT_FEATURES 0
-#define JFS_KNOWN_ROCOMPAT_FEATURES 0
-#define JFS_KNOWN_INCOMPAT_FEATURES JFS_FEATURE_INCOMPAT_REVOKE
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-#include <linux/sched.h>
-
-#define J_ASSERT ASSERT
-
-#if defined(CONFIG_BUFFER_DEBUG)
-void buffer_assertion_failure(struct buffer_head *bh);
-#define J_ASSERT_BH(bh, expr) \
- do { \
- if (!(expr)) \
- buffer_assertion_failure(bh); \
- J_ASSERT(expr); \
- } while (0)
-#define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr)
-#else
-#define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
-#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
-#endif
-
-#if defined(JBD_PARANOID_IOFAIL)
-#define J_EXPECT(expr, why...) J_ASSERT(expr)
-#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
-#define J_EXPECT_JH(jh, expr, why...) J_ASSERT_JH(jh, expr)
-#else
-#if 0
-#define __journal_expect(expr, why...) \
- ({ \
- int val = (expr); \
- if (!val) { \
- printk(KERN_ERR \
- "EXT3-fs unexpected failure: %s;\n",# expr); \
- printk(KERN_ERR why "\n"); \
- } \
- val; \
- })
-#define J_EXPECT(expr, why...) __journal_expect(expr, ## why)
-#define J_EXPECT_BH(bh, expr, why...) __journal_expect(expr, ## why)
-#define J_EXPECT_JH(jh, expr, why...) __journal_expect(expr, ## why)
-#endif
-#define __journal_expect
-
-#define J_EXPECT
-#define J_EXPECT_BH
-#define J_EXPECT_JH
-
-#endif
-
-enum jbd_state_bits {
- BH_JBD /* Has an attached ext3 journal_head */
- = BH_PrivateStart,
- BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
- BH_Freed, /* Has been freed (truncated) */
- BH_Revoked, /* Has been revoked from the log */
- BH_RevokeValid, /* Revoked flag is valid */
- BH_JBDDirty, /* Is dirty but journaled */
- BH_State, /* Pins most journal_head state */
- BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
- BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
-};
-
-BUFFER_FNS(JBD, jbd)
-BUFFER_FNS(JWrite, jwrite)
-BUFFER_FNS(JBDDirty, jbddirty)
-TAS_BUFFER_FNS(JBDDirty, jbddirty)
-BUFFER_FNS(Revoked, revoked)
-TAS_BUFFER_FNS(Revoked, revoked)
-BUFFER_FNS(RevokeValid, revokevalid)
-TAS_BUFFER_FNS(RevokeValid, revokevalid)
-BUFFER_FNS(Freed, freed)
-
-static inline struct buffer_head *jh2bh(struct journal_head *jh)
-{
- return jh->b_bh;
-}
-
-static inline struct journal_head *bh2jh(struct buffer_head *bh)
-{
- return bh->b_private;
-}
-
-static inline void jbd_lock_bh_state(struct buffer_head *bh)
-{
- bit_spin_lock(BH_State, &bh->b_state);
-}
-
-static inline int jbd_trylock_bh_state(struct buffer_head *bh)
-{
- return bit_spin_trylock(BH_State, &bh->b_state);
-}
-
-static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
-{
- return bit_spin_is_locked(BH_State, &bh->b_state);
-}
-
-static inline void jbd_unlock_bh_state(struct buffer_head *bh)
-{
- bit_spin_unlock(BH_State, &bh->b_state);
-}
-
-static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
-{
- bit_spin_lock(BH_JournalHead, &bh->b_state);
-}
-
-static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
-{
- bit_spin_unlock(BH_JournalHead, &bh->b_state);
-}
-
-struct jbd_revoke_table_s;
-
-/**
- * struct handle_s - The handle_s type is the concrete type associated with
- * handle_t.
- * @h_transaction: Which compound transaction is this update a part of?
- * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
- * @h_ref: Reference count on this handle
- * @h_err: Field for caller's use to track errors through large fs operations
- * @h_sync: flag for sync-on-close
- * @h_jdata: flag to force data journaling
- * @h_aborted: flag indicating fatal error on handle
- * @h_lockdep_map: lockdep info for debugging lock problems
- **/
-
-/* Docbook can't yet cope with the bit fields, but will leave the documentation
- * in so it can be fixed later.
- */
-
-struct handle_s
-{
- /* Which compound transaction is this update a part of? */
- transaction_t *h_transaction;
-
- /* Number of remaining buffers we are allowed to dirty: */
- int h_buffer_credits;
-
- /* Reference count on this handle */
- int h_ref;
-
- /* Field for caller's use to track errors through large fs */
- /* operations */
- int h_err;
-
- /* Flags [no locking] */
- unsigned int h_sync: 1; /* sync-on-close */
- unsigned int h_jdata: 1; /* force data journaling */
- unsigned int h_aborted: 1; /* fatal error on handle */
-
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map h_lockdep_map;
-#endif
-};
-
-
-/* The transaction_t type is the guts of the journaling mechanism. It
- * tracks a compound transaction through its various states:
- *
- * RUNNING: accepting new updates
- * LOCKED: Updates still running but we don't accept new ones
- * RUNDOWN: Updates are tidying up but have finished requesting
- * new buffers to modify (state not used for now)
- * FLUSH: All updates complete, but we are still writing to disk
- * COMMIT: All data on disk, writing commit record
- * FINISHED: We still have to keep the transaction for checkpointing.
- *
- * The transaction keeps track of all of the buffers modified by a
- * running transaction, and all of the buffers committed but not yet
- * flushed to home for finished transactions.
- */
-
-/*
- * Lock ranking:
- *
- * j_list_lock
- * ->jbd_lock_bh_journal_head() (This is "innermost")
- *
- * j_state_lock
- * ->jbd_lock_bh_state()
- *
- * jbd_lock_bh_state()
- * ->j_list_lock
- *
- * j_state_lock
- * ->t_handle_lock
- *
- * j_state_lock
- * ->j_list_lock (journal_unmap_buffer)
- *
- */
-
-struct transaction_s
-{
- /* Pointer to the journal for this transaction. [no locking] */
- journal_t *t_journal;
-
- /* Sequence number for this transaction [no locking] */
- tid_t t_tid;
-
- /*
- * Transaction's current state
- * [no locking - only kjournald alters this]
- * [j_list_lock] guards transition of a transaction into T_FINISHED
- * state and subsequent call of __journal_drop_transaction()
- * FIXME: needs barriers
- * KLUDGE: [use j_state_lock]
- */
- enum {
- T_RUNNING,
- T_LOCKED,
- T_RUNDOWN,
- T_FLUSH,
- T_COMMIT,
- T_FINISHED
- } t_state;
-
- /*
- * Where in the log does this transaction's commit start? [no locking]
- */
- unsigned long t_log_start;
-
- /* Number of buffers on the t_buffers list [j_list_lock] */
- int t_nr_buffers;
-
- /*
- * Doubly-linked circular list of all buffers reserved but not yet
- * modified by this transaction [j_list_lock]
- */
- struct journal_head *t_reserved_list;
-
- /*
- * Doubly-linked circular list of all buffers under writeout during
- * commit [j_list_lock]
- */
- struct journal_head *t_locked_list;
-
- /*
- * Doubly-linked circular list of all metadata buffers owned by this
- * transaction [j_list_lock]
- */
- struct journal_head *t_buffers;
-
- /*
- * Doubly-linked circular list of all data buffers still to be
- * flushed before this transaction can be committed [j_list_lock]
- */
- struct journal_head *t_sync_datalist;
-
- /*
- * Doubly-linked circular list of all forget buffers (superseded
- * buffers which we can un-checkpoint once this transaction commits)
- * [j_list_lock]
- */
- struct journal_head *t_forget;
-
- /*
- * Doubly-linked circular list of all buffers still to be flushed before
- * this transaction can be checkpointed. [j_list_lock]
- */
- struct journal_head *t_checkpoint_list;
-
- /*
- * Doubly-linked circular list of all buffers submitted for IO while
- * checkpointing. [j_list_lock]
- */
- struct journal_head *t_checkpoint_io_list;
-
- /*
- * Doubly-linked circular list of temporary buffers currently undergoing
- * IO in the log [j_list_lock]
- */
- struct journal_head *t_iobuf_list;
-
- /*
- * Doubly-linked circular list of metadata buffers being shadowed by log
- * IO. The IO buffers on the iobuf list and the shadow buffers on this
- * list match each other one for one at all times. [j_list_lock]
- */
- struct journal_head *t_shadow_list;
-
- /*
- * Doubly-linked circular list of control buffers being written to the
- * log. [j_list_lock]
- */
- struct journal_head *t_log_list;
-
- /*
- * Protects info related to handles
- */
- spinlock_t t_handle_lock;
-
- /*
- * Number of outstanding updates running on this transaction
- * [t_handle_lock]
- */
- int t_updates;
-
- /*
- * Number of buffers reserved for use by all handles in this transaction
- * handle but not yet modified. [t_handle_lock]
- */
- int t_outstanding_credits;
-
- /*
- * Forward and backward links for the circular list of all transactions
- * awaiting checkpoint. [j_list_lock]
- */
- transaction_t *t_cpnext, *t_cpprev;
-
- /*
- * When will the transaction expire (become due for commit), in jiffies?
- * [no locking]
- */
- unsigned long t_expires;
-
- /*
- * How many handles used this transaction? [t_handle_lock]
- */
- int t_handle_count;
-
-};
-
-/**
- * struct journal_s - The journal_s type is the concrete type associated with
- * journal_t.
- * @j_flags: General journaling state flags
- * @j_errno: Is there an outstanding uncleared error on the journal (from a
- * prior abort)?
- * @j_sb_buffer: First part of superblock buffer
- * @j_superblock: Second part of superblock buffer
- * @j_format_version: Version of the superblock format
- * @j_state_lock: Protect the various scalars in the journal
- * @j_barrier_count: Number of processes waiting to create a barrier lock
- * @j_barrier: The barrier lock itself
- * @j_running_transaction: The current running transaction..
- * @j_committing_transaction: the transaction we are pushing to disk
- * @j_checkpoint_transactions: a linked circular list of all transactions
- * waiting for checkpointing
- * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
- * to start committing, or for a barrier lock to be released
- * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
- * @j_wait_done_commit: Wait queue for waiting for commit to complete
- * @j_wait_checkpoint: Wait queue to trigger checkpointing
- * @j_wait_commit: Wait queue to trigger commit
- * @j_wait_updates: Wait queue to wait for updates to complete
- * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
- * @j_head: Journal head - identifies the first unused block in the journal
- * @j_tail: Journal tail - identifies the oldest still-used block in the
- * journal.
- * @j_free: Journal free - how many free blocks are there in the journal?
- * @j_first: The block number of the first usable block
- * @j_last: The block number one beyond the last usable block
- * @j_dev: Device where we store the journal
- * @j_blocksize: blocksize for the location where we store the journal.
- * @j_blk_offset: starting block offset for into the device where we store the
- * journal
- * @j_fs_dev: Device which holds the client fs. For internal journal this will
- * be equal to j_dev
- * @j_maxlen: Total maximum capacity of the journal region on disk.
- * @j_list_lock: Protects the buffer lists and internal buffer state.
- * @j_inode: Optional inode where we store the journal. If present, all journal
- * block numbers are mapped into this inode via bmap().
- * @j_tail_sequence: Sequence number of the oldest transaction in the log
- * @j_transaction_sequence: Sequence number of the next transaction to grant
- * @j_commit_sequence: Sequence number of the most recently committed
- * transaction
- * @j_commit_request: Sequence number of the most recent transaction wanting
- * commit
- * @j_uuid: Uuid of client object.
- * @j_task: Pointer to the current commit thread for this journal
- * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
- * single compound commit transaction
- * @j_commit_interval: What is the maximum transaction lifetime before we begin
- * a commit?
- * @j_commit_timer: The timer used to wakeup the commit thread
- * @j_revoke_lock: Protect the revoke table
- * @j_revoke: The revoke table - maintains the list of revoked blocks in the
- * current transaction.
- * @j_revoke_table: alternate revoke tables for j_revoke
- * @j_wbuf: array of buffer_heads for journal_commit_transaction
- * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
- * number that will fit in j_blocksize
- * @j_last_sync_writer: most recent pid which did a synchronous write
- * @j_private: An opaque pointer to fs-private information.
- */
-
-struct journal_s
-{
- /* General journaling state flags [j_state_lock] */
- unsigned long j_flags;
-
- /*
- * Is there an outstanding uncleared error on the journal (from a prior
- * abort)? [j_state_lock]
- */
- int j_errno;
-
- /* The superblock buffer */
- struct buffer_head *j_sb_buffer;
- journal_superblock_t *j_superblock;
-
- /* Version of the superblock format */
- int j_format_version;
-
- /*
- * Protect the various scalars in the journal
- */
- spinlock_t j_state_lock;
-
- /*
- * Number of processes waiting to create a barrier lock [j_state_lock]
- */
- int j_barrier_count;
-
- /* The barrier lock itself */
- struct mutex j_barrier;
-
- /*
- * Transactions: The current running transaction...
- * [j_state_lock] [caller holding open handle]
- */
- transaction_t *j_running_transaction;
-
- /*
- * the transaction we are pushing to disk
- * [j_state_lock] [caller holding open handle]
- */
- transaction_t *j_committing_transaction;
-
- /*
- * ... and a linked circular list of all transactions waiting for
- * checkpointing. [j_list_lock]
- */
- transaction_t *j_checkpoint_transactions;
-
- /*
- * Wait queue for waiting for a locked transaction to start committing,
- * or for a barrier lock to be released
- */
- wait_queue_head_t j_wait_transaction_locked;
-
- /* Wait queue for waiting for checkpointing to complete */
- wait_queue_head_t j_wait_logspace;
-
- /* Wait queue for waiting for commit to complete */
- wait_queue_head_t j_wait_done_commit;
-
- /* Wait queue to trigger checkpointing */
- wait_queue_head_t j_wait_checkpoint;
-
- /* Wait queue to trigger commit */
- wait_queue_head_t j_wait_commit;
-
- /* Wait queue to wait for updates to complete */
- wait_queue_head_t j_wait_updates;
-
- /* Semaphore for locking against concurrent checkpoints */
- struct mutex j_checkpoint_mutex;
-
- /*
- * Journal head: identifies the first unused block in the journal.
- * [j_state_lock]
- */
- unsigned long j_head;
-
- /*
- * Journal tail: identifies the oldest still-used block in the journal.
- * [j_state_lock]
- */
- unsigned long j_tail;
-
- /*
- * Journal free: how many free blocks are there in the journal?
- * [j_state_lock]
- */
- unsigned long j_free;
-
- /*
- * Journal start and end: the block numbers of the first usable block
- * and one beyond the last usable block in the journal. [j_state_lock]
- */
- unsigned long j_first;
- unsigned long j_last;
-
- /*
- * Device, blocksize and starting block offset for the location where we
- * store the journal.
- */
- struct block_device *j_dev;
- int j_blocksize;
- unsigned long j_blk_offset;
-
- /*
- * Device which holds the client fs. For internal journal this will be
- * equal to j_dev.
- */
- struct block_device *j_fs_dev;
-
- /* Total maximum capacity of the journal region on disk. */
- unsigned int j_maxlen;
-
- /*
- * Protects the buffer lists and internal buffer state.
- */
- spinlock_t j_list_lock;
-
- /* Optional inode where we store the journal. If present, all */
- /* journal block numbers are mapped into this inode via */
- /* bmap(). */
- struct inode *j_inode;
-
- /*
- * Sequence number of the oldest transaction in the log [j_state_lock]
- */
- tid_t j_tail_sequence;
-
- /*
- * Sequence number of the next transaction to grant [j_state_lock]
- */
- tid_t j_transaction_sequence;
-
- /*
- * Sequence number of the most recently committed transaction
- * [j_state_lock].
- */
- tid_t j_commit_sequence;
-
- /*
- * Sequence number of the most recent transaction wanting commit
- * [j_state_lock]
- */
- tid_t j_commit_request;
-
- /*
- * Journal uuid: identifies the object (filesystem, LVM volume etc)
- * backed by this journal. This will eventually be replaced by an array
- * of uuids, allowing us to index multiple devices within a single
- * journal and to perform atomic updates across them.
- */
- __u8 j_uuid[16];
-
- /* Pointer to the current commit thread for this journal */
- struct task_struct *j_task;
-
- /*
- * Maximum number of metadata buffers to allow in a single compound
- * commit transaction
- */
- int j_max_transaction_buffers;
-
- /*
- * What is the maximum transaction lifetime before we begin a commit?
- */
- unsigned long j_commit_interval;
-
- /* The timer used to wakeup the commit thread: */
- struct timer_list j_commit_timer;
-
- /*
- * The revoke table: maintains the list of revoked blocks in the
- * current transaction. [j_revoke_lock]
- */
- spinlock_t j_revoke_lock;
- struct jbd_revoke_table_s *j_revoke;
- struct jbd_revoke_table_s *j_revoke_table[2];
-
- /*
- * array of bhs for journal_commit_transaction
- */
- struct buffer_head **j_wbuf;
- int j_wbufsize;
-
- pid_t j_last_sync_writer;
-
- /*
- * An opaque pointer to fs-private information. ext3 puts its
- * superblock pointer here
- */
- void *j_private;
-};
-
-/*
- * Journal flag definitions
- */
-#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
-#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
-#define JFS_ACK_ERR 0x004 /* The errno in the sb has been acked */
-#define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */
-#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
-#define JFS_BARRIER 0x020 /* Use IDE barriers */
-
-/*
- * Function declarations for the journaling transaction and buffer
- * management
- */
-
-/* Filing buffers */
-extern void journal_unfile_buffer(journal_t *, struct journal_head *);
-extern void __journal_unfile_buffer(struct journal_head *);
-extern void __journal_refile_buffer(struct journal_head *);
-extern void journal_refile_buffer(journal_t *, struct journal_head *);
-extern void __journal_file_buffer(struct journal_head *, transaction_t *, int);
-extern void __journal_free_buffer(struct journal_head *bh);
-extern void journal_file_buffer(struct journal_head *, transaction_t *, int);
-extern void __journal_clean_data_list(transaction_t *transaction);
-
-/* Log buffer allocation */
-extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
-int journal_next_log_block(journal_t *, unsigned long *);
-
-/* Commit management */
-extern void journal_commit_transaction(journal_t *);
-
-/* Checkpoint list management */
-int __journal_clean_checkpoint_list(journal_t *journal);
-int __journal_remove_checkpoint(struct journal_head *);
-void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
-
-/* Buffer IO */
-extern int
-journal_write_metadata_buffer(transaction_t *transaction,
- struct journal_head *jh_in,
- struct journal_head **jh_out,
- unsigned long blocknr);
-
-/* Transaction locking */
-extern void __wait_on_journal (journal_t *);
-
-/*
- * Journal locking.
- *
- * We need to lock the journal during transaction state changes so that nobody
- * ever tries to take a handle on the running transaction while we are in the
- * middle of moving it to the commit phase. j_state_lock does this.
- *
- * Note that the locking is completely interrupt unsafe. We never touch
- * journal structures from interrupts.
- */
-
-static inline handle_t *journal_current_handle(void)
-{
- return NULL;
- /* return current->journal_info; */
-#pragma message("WARNINGS: journal_current_handle NOT implemented")
-}
-
-/* The journaling code user interface:
- *
- * Create and destroy handles
- * Register buffer modifications against the current transaction.
- */
-
-extern handle_t *journal_start(journal_t *, int nblocks);
-extern int journal_restart (handle_t *, int nblocks);
-extern int journal_extend (handle_t *, int nblocks);
-extern int journal_get_write_access(handle_t *, struct buffer_head *);
-extern int journal_get_create_access (handle_t *, struct buffer_head *);
-extern int journal_get_undo_access(handle_t *, struct buffer_head *);
-extern int journal_dirty_data (handle_t *, struct buffer_head *);
-extern int journal_dirty_metadata (handle_t *, struct buffer_head *);
-extern void journal_release_buffer (handle_t *, struct buffer_head *);
-extern int journal_forget (handle_t *, struct buffer_head *);
-extern void journal_sync_buffer (struct buffer_head *);
-extern void journal_invalidatepage(journal_t *,
- struct page *, unsigned long);
-extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
-extern int journal_stop(handle_t *);
-extern int journal_flush (journal_t *);
-extern void journal_lock_updates (journal_t *);
-extern void journal_unlock_updates (journal_t *);
-
-extern journal_t * journal_init_dev(struct block_device *bdev,
- struct block_device *fs_dev,
- int start, int len, int bsize);
-extern journal_t * journal_init_inode (struct inode *);
-extern int journal_update_format (journal_t *);
-extern int journal_check_used_features
- (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int journal_check_available_features
- (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int journal_set_features
- (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int journal_create (journal_t *);
-extern int journal_load (journal_t *journal);
-extern void journal_destroy (journal_t *);
-extern int journal_recover (journal_t *journal);
-extern int journal_wipe (journal_t *, int);
-extern int journal_skip_recovery (journal_t *);
-extern void journal_update_superblock (journal_t *, int);
- void journal_abort (journal_t *, int);
-extern int journal_errno (journal_t *);
-extern void journal_ack_err (journal_t *);
-extern int journal_clear_err (journal_t *);
-extern int journal_bmap(journal_t *, unsigned long, unsigned long *);
-extern int journal_force_commit(journal_t *);
-
-/* added by matt */
-void journal_wipe_recovery(journal_t *journal);
-
-/*
- * journal_head management
- */
-struct journal_head *journal_add_journal_head(struct buffer_head *bh);
-struct journal_head *journal_grab_journal_head(struct buffer_head *bh);
-void journal_remove_journal_head(struct buffer_head *bh);
-void journal_put_journal_head(struct journal_head *jh);
-
-/*
- * handle management
- */
-extern struct kmem_cache *jbd_handle_cache;
-
-static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
-{
- return (handle_t *)kmem_cache_alloc(jbd_handle_cache, gfp_flags);
-}
-
-static inline void jbd_free_handle(handle_t *handle)
-{
- kmem_cache_free(jbd_handle_cache, handle);
-}
-
-/* Primary revoke support */
-#define JOURNAL_REVOKE_DEFAULT_HASH 256
-extern int journal_init_revoke(journal_t *, int);
-extern void journal_destroy_revoke_caches(void);
-extern int journal_init_revoke_caches(void);
-
-extern void journal_destroy_revoke(journal_t *);
-extern int journal_revoke (handle_t *,
- unsigned long, struct buffer_head *);
-extern int journal_cancel_revoke(handle_t *, struct journal_head *);
-extern void journal_write_revoke_records(journal_t *, transaction_t *);
-
-/* Recovery revoke support */
-extern int journal_set_revoke(journal_t *, unsigned long, tid_t);
-extern int journal_test_revoke(journal_t *, unsigned long, tid_t);
-extern void journal_clear_revoke(journal_t *);
-extern void journal_switch_revoke_table(journal_t *journal);
-
-/*
- * The log thread user interface:
- *
- * Request space in the current transaction, and force transaction commit
- * transitions on demand.
- */
-
-int __log_space_left(journal_t *); /* Called with journal locked */
-int log_start_commit(journal_t *journal, tid_t tid);
-int __log_start_commit(journal_t *journal, tid_t tid);
-int journal_start_commit(journal_t *journal, tid_t *tid);
-int journal_force_commit_nested(journal_t *journal);
-int log_wait_commit(journal_t *journal, tid_t tid);
-int log_do_checkpoint(journal_t *journal);
-
-void __log_wait_for_space(journal_t *journal);
-extern void __journal_drop_transaction(journal_t *, transaction_t *);
-extern int cleanup_journal_tail(journal_t *);
-
-/* Debugging code only: */
-
-#define jbd_ENOSYS() \
-do { \
- printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \
- current->state = TASK_UNINTERRUPTIBLE; \
- schedule(); \
-} while (1)
-
-/*
- * is_journal_abort
- *
- * Simple test wrapper function to test the JFS_ABORT state flag. This
- * bit, when set, indicates that we have had a fatal error somewhere,
- * either inside the journaling layer or indicated to us by the client
- * (eg. ext3), and that we and should not commit any further
- * transactions.
- */
-
-static inline int is_journal_aborted(journal_t *journal)
-{
- return journal->j_flags & JFS_ABORT;
-}
-
-static inline int is_handle_aborted(handle_t *handle)
-{
- if (handle->h_aborted)
- return 1;
- return is_journal_aborted(handle->h_transaction->t_journal);
-}
-
-static inline void journal_abort_handle(handle_t *handle)
-{
- handle->h_aborted = 1;
-}
-
-#endif /* __KERNEL__ */
-
-/* Comparison functions for transaction IDs: perform comparisons using
- * modulo arithmetic so that they work over sequence number wraps. */
-
-static inline int tid_gt(tid_t x, tid_t y)
-{
- int difference = (x - y);
- return (difference > 0);
-}
-
-static inline int tid_geq(tid_t x, tid_t y)
-{
- int difference = (x - y);
- return (difference >= 0);
-}
-
-extern int journal_blocks_per_page(struct inode *inode);
-
-/*
- * Return the minimum number of blocks which must be free in the journal
- * before a new transaction may be started. Must be called under j_state_lock.
- */
-static inline int jbd_space_needed(journal_t *journal)
-{
- int nblocks = journal->j_max_transaction_buffers;
- if (journal->j_committing_transaction)
- nblocks += journal->j_committing_transaction->
- t_outstanding_credits;
- return nblocks;
-}
-
-/*
- * Definitions which augment the buffer_head layer
- */
-
-/* journaling buffer types */
-#define BJ_None 0 /* Not journaled */
-#define BJ_SyncData 1 /* Normal data: flush before commit */
-#define BJ_Metadata 2 /* Normal journaled metadata */
-#define BJ_Forget 3 /* Buffer superseded by this transaction */
-#define BJ_IO 4 /* Buffer is for temporary IO use */
-#define BJ_Shadow 5 /* Buffer contents being shadowed to the log */
-#define BJ_LogCtl 6 /* Buffer contains log descriptors */
-#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
-#define BJ_Locked 8 /* Locked for I/O during commit */
-#define BJ_Types 9
-
-extern int jbd_blocks_per_page(struct inode *inode);
-
-#ifdef __KERNEL__
-
-#define buffer_trace_init(bh) do {} while (0)
-#define print_buffer_fields(bh) do {} while (0)
-#define print_buffer_trace(bh) do {} while (0)
-#define BUFFER_TRACE(bh, info) do {} while (0)
-#define BUFFER_TRACE2(bh, bh2, info) do {} while (0)
-#define JBUFFER_TRACE(jh, info) do {} while (0)
-
-#endif /* __KERNEL__ */
-
-#endif /* _LINUX_JBD_H */
diff --git a/drivers/filesystems/reiserfs/inc/linux/journal-head.h b/drivers/filesystems/reiserfs/inc/linux/journal-head.h
deleted file mode 100644
index 8a62d1e84b9..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/journal-head.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * include/linux/journal-head.h
- *
- * buffer_head fields for JBD
- *
- * 27 May 2001 Andrew Morton <akpm(a)digeo.com>
- * Created - pulled out of fs.h
- */
-
-#ifndef JOURNAL_HEAD_H_INCLUDED
-#define JOURNAL_HEAD_H_INCLUDED
-
-typedef unsigned int tid_t; /* Unique transaction ID */
-typedef struct transaction_s transaction_t; /* Compound transaction type */
-struct buffer_head;
-
-struct journal_head {
- /*
- * Points back to our buffer_head. [jbd_lock_bh_journal_head()]
- */
- struct buffer_head *b_bh;
-
- /*
- * Reference count - see description in journal.c
- * [jbd_lock_bh_journal_head()]
- */
- int b_jcount;
-
- /*
- * Journalling list for this buffer [jbd_lock_bh_state()]
- */
- unsigned b_jlist;
-
- /*
- * This flag signals the buffer has been modified by
- * the currently running transaction
- * [jbd_lock_bh_state()]
- */
- unsigned b_modified;
-
- /*
- * Copy of the buffer data frozen for writing to the log.
- * [jbd_lock_bh_state()]
- */
- char *b_frozen_data;
-
- /*
- * Pointer to a saved copy of the buffer containing no uncommitted
- * deallocation references, so that allocations can avoid overwriting
- * uncommitted deletes. [jbd_lock_bh_state()]
- */
- char *b_committed_data;
-
- /*
- * Pointer to the compound transaction which owns this buffer's
- * metadata: either the running transaction or the committing
- * transaction (if there is one). Only applies to buffers on a
- * transaction's data or metadata journaling list.
- * [j_list_lock] [jbd_lock_bh_state()]
- */
- transaction_t *b_transaction;
-
- /*
- * Pointer to the running compound transaction which is currently
- * modifying the buffer's metadata, if there was already a transaction
- * committing it when the new transaction touched it.
- * [t_list_lock] [jbd_lock_bh_state()]
- */
- transaction_t *b_next_transaction;
-
- /*
- * Doubly-linked list of buffers on a transaction's data, metadata or
- * forget queue. [t_list_lock] [jbd_lock_bh_state()]
- */
- struct journal_head *b_tnext, *b_tprev;
-
- /*
- * Pointer to the compound transaction against which this buffer
- * is checkpointed. Only dirty buffers can be checkpointed.
- * [j_list_lock]
- */
- transaction_t *b_cp_transaction;
-
- /*
- * Doubly-linked list of buffers still remaining to be flushed
- * before an old transaction can be checkpointed.
- * [j_list_lock]
- */
- struct journal_head *b_cpnext, *b_cpprev;
-};
-
-#endif /* JOURNAL_HEAD_H_INCLUDED */
diff --git a/drivers/filesystems/reiserfs/inc/linux/kernel.h b/drivers/filesystems/reiserfs/inc/linux/kernel.h
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/drivers/filesystems/reiserfs/inc/linux/list.h b/drivers/filesystems/reiserfs/inc/linux/list.h
deleted file mode 100644
index 6a5e668e3c8..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/list.h
+++ /dev/null
@@ -1,255 +0,0 @@
-#ifndef __LINUX_LIST_H__
-#define __LINUX_LIST_H__
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-#define prefetch(a) ((void *)a)
-
-struct list_head {
- struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
-
-static inline void INIT_LIST_HEAD(struct list_head *list)
-{
- list->next = list;
- list->prev = list;
-}
-
-/*
- * Insert a new entry between two known consecutive entries.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_add(struct list_head * new,
- struct list_head * prev,
- struct list_head * next)
-{
- next->prev = new;
- new->next = next;
- new->prev = prev;
- prev->next = new;
-}
-
-/**
- * list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void list_add(struct list_head *new, struct list_head *head)
-{
- __list_add(new, head, head->next);
-}
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
-{
- __list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_del(struct list_head * prev, struct list_head * next)
-{
- next->prev = prev;
- prev->next = next;
-}
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static inline void list_del(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static inline void list_del_init(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
-}
-
-/**
- * list_move - delete from one list and add as another's head
- * @list: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
- __list_del(list->prev, list->next);
- list_add(list, head);
-}
-
-/**
- * list_move_tail - delete from one list and add as another's tail
- * @list: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void list_move_tail(struct list_head *list,
- struct list_head *head)
-{
- __list_del(list->prev, list->next);
- list_add_tail(list, head);
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static inline int list_empty(struct list_head *head)
-{
- return head->next == head;
-}
-
-static inline int list_empty_careful(const struct list_head *head)
-{
- struct list_head *next = head->next;
- return (next == head) && (next == head->prev);
-}
-
-static inline void __list_splice(struct list_head *list,
- struct list_head *head)
-{
- struct list_head *first = list->next;
- struct list_head *last = list->prev;
- struct list_head *at = head->next;
-
- first->prev = head;
- head->next = first;
-
- last->next = at;
- at->prev = last;
-}
-
-/**
- * list_splice - join two lists
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(struct list_head *list, struct list_head *head)
-{
- if (!list_empty(list))
- __list_splice(list, head);
-}
-
-/**
- * list_splice_init - join two lists and reinitialise the emptied list.
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * The list at @list is reinitialised
- */
-static inline void list_splice_init(struct list_head *list,
- struct list_head *head)
-{
- if (!list_empty(list)) {
- __list_splice(list, head);
- INIT_LIST_HEAD(list);
- }
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
-
-/**
- * list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
- */
-#define list_for_each(pos, head) \
- for (pos = (head)->next, prefetch(pos->next); pos != (head); \
- pos = pos->next, prefetch(pos->next))
-
-/**
- * list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos: the &struct list_head to use as a loop counter.
- * @n: another &struct list_head to use as temporary storage
- * @head: the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-
-#ifndef list_for_each_prev
-/**
- * list_for_each_prev - iterate over a list in reverse order
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
- */
-#define list_for_each_prev(pos, head) \
- for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
- pos = pos->prev, prefetch(pos->prev))
-
-#endif /* list_for_each_prev */
-
-#ifndef list_for_each_entry
-/**
- * list_for_each_entry - iterate over list of given type
- * @pos: the type * to use as a loop counter.
- * @head: the head for your list.
- * @member: the name of the list_struct within the struct.
- */
-#define list_for_each_entry(pos, head, type, member) \
- for (pos = list_entry((head)->next, type, member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = list_entry(pos->member.next, type, member), \
- prefetch(pos->member.next))
-#endif /* list_for_each_entry */
-
-#ifndef list_for_each_entry_safe
-/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos: the type * to use as a loop counter.
- * @n: another type * to use as temporary storage
- * @head: the head for your list.
- * @member: the name of the list_struct within the struct.
- */
-#define list_for_each_entry_safe(pos, n, head, type, member) \
- for (pos = list_entry((head)->next, type, member), \
- n = list_entry(pos->member.next, type, member); \
- &pos->member != (head); \
- pos = n, n = list_entry(n->member.next, type, member))
-#endif /* list_for_each_entry_safe */
-
-#endif /* __LINUX_LIST_H__ */
diff --git a/drivers/filesystems/reiserfs/inc/linux/log2.h b/drivers/filesystems/reiserfs/inc/linux/log2.h
deleted file mode 100644
index 9817e878a26..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/log2.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* Integer base 2 logarithm calculation
- *
- * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowells(a)redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef _LINUX_LOG2_H
-#define _LINUX_LOG2_H
-
-#include <linux/types.h>
-#include <linux/bitops.h>
-
-/*
- * deal with unrepresentable constant logarithms
- */
-int ____ilog2_NaN(void);
-
-/*
- * non-constant log of base 2 calculators
- * - the arch may override these in asm/bitops.h if they can be implemented
- * more efficiently than using fls() and fls64()
- * - the arch is not required to handle n==0 if implementing the fallback
- */
-#ifndef CONFIG_ARCH_HAS_ILOG2_U32
-static inline __attribute__((const))
-int __ilog2_u32(u32 n)
-{
- return fls(n) - 1;
-}
-#endif
-
-#ifndef CONFIG_ARCH_HAS_ILOG2_U64
-static inline __attribute__((const))
-int __ilog2_u64(u64 n)
-{
- return fls64(n) - 1;
-}
-#endif
-
-/*
- * Determine whether some value is a power of two, where zero is
- * *not* considered a power of two.
- */
-
-static inline __attribute__((const))
-bool is_power_of_2(unsigned long n)
-{
- return (n != 0 && ((n & (n - 1)) == 0));
-}
-
-/*
- * round up to nearest power of two
- */
-static inline __attribute__((const))
-unsigned long __roundup_pow_of_two(unsigned long n)
-{
- return 1UL << fls_long(n - 1);
-}
-
-/*
- * round down to nearest power of two
- */
-static inline __attribute__((const))
-unsigned long __rounddown_pow_of_two(unsigned long n)
-{
- return 1UL << (fls_long(n) - 1);
-}
-
-/**
- * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value
- * @n - parameter
- *
- * constant-capable log of base 2 calculation
- * - this can be used to initialise global variables from constant data, hence
- * the massive ternary operator construction
- *
- * selects the appropriately-sized optimised version depending on sizeof(n)
- */
-#define ilog2(n) \
-( \
- __builtin_constant_p(n) ? ( \
- (n) < 1 ? ____ilog2_NaN() : \
- (n) & (1ULL << 63) ? 63 : \
- (n) & (1ULL << 62) ? 62 : \
- (n) & (1ULL << 61) ? 61 : \
- (n) & (1ULL << 60) ? 60 : \
- (n) & (1ULL << 59) ? 59 : \
- (n) & (1ULL << 58) ? 58 : \
- (n) & (1ULL << 57) ? 57 : \
- (n) & (1ULL << 56) ? 56 : \
- (n) & (1ULL << 55) ? 55 : \
- (n) & (1ULL << 54) ? 54 : \
- (n) & (1ULL << 53) ? 53 : \
- (n) & (1ULL << 52) ? 52 : \
- (n) & (1ULL << 51) ? 51 : \
- (n) & (1ULL << 50) ? 50 : \
- (n) & (1ULL << 49) ? 49 : \
- (n) & (1ULL << 48) ? 48 : \
- (n) & (1ULL << 47) ? 47 : \
- (n) & (1ULL << 46) ? 46 : \
- (n) & (1ULL << 45) ? 45 : \
- (n) & (1ULL << 44) ? 44 : \
- (n) & (1ULL << 43) ? 43 : \
- (n) & (1ULL << 42) ? 42 : \
- (n) & (1ULL << 41) ? 41 : \
- (n) & (1ULL << 40) ? 40 : \
- (n) & (1ULL << 39) ? 39 : \
- (n) & (1ULL << 38) ? 38 : \
- (n) & (1ULL << 37) ? 37 : \
- (n) & (1ULL << 36) ? 36 : \
- (n) & (1ULL << 35) ? 35 : \
- (n) & (1ULL << 34) ? 34 : \
- (n) & (1ULL << 33) ? 33 : \
- (n) & (1ULL << 32) ? 32 : \
- (n) & (1ULL << 31) ? 31 : \
- (n) & (1ULL << 30) ? 30 : \
- (n) & (1ULL << 29) ? 29 : \
- (n) & (1ULL << 28) ? 28 : \
- (n) & (1ULL << 27) ? 27 : \
- (n) & (1ULL << 26) ? 26 : \
- (n) & (1ULL << 25) ? 25 : \
- (n) & (1ULL << 24) ? 24 : \
- (n) & (1ULL << 23) ? 23 : \
- (n) & (1ULL << 22) ? 22 : \
- (n) & (1ULL << 21) ? 21 : \
- (n) & (1ULL << 20) ? 20 : \
- (n) & (1ULL << 19) ? 19 : \
- (n) & (1ULL << 18) ? 18 : \
- (n) & (1ULL << 17) ? 17 : \
- (n) & (1ULL << 16) ? 16 : \
- (n) & (1ULL << 15) ? 15 : \
- (n) & (1ULL << 14) ? 14 : \
- (n) & (1ULL << 13) ? 13 : \
- (n) & (1ULL << 12) ? 12 : \
- (n) & (1ULL << 11) ? 11 : \
- (n) & (1ULL << 10) ? 10 : \
- (n) & (1ULL << 9) ? 9 : \
- (n) & (1ULL << 8) ? 8 : \
- (n) & (1ULL << 7) ? 7 : \
- (n) & (1ULL << 6) ? 6 : \
- (n) & (1ULL << 5) ? 5 : \
- (n) & (1ULL << 4) ? 4 : \
- (n) & (1ULL << 3) ? 3 : \
- (n) & (1ULL << 2) ? 2 : \
- (n) & (1ULL << 1) ? 1 : \
- (n) & (1ULL << 0) ? 0 : \
- ____ilog2_NaN() \
- ) : \
- (sizeof(n) <= 4) ? \
- __ilog2_u32(n) : \
- __ilog2_u64(n) \
- )
-
-/**
- * roundup_pow_of_two - round the given value up to nearest power of two
- * @n - parameter
- *
- * round the given value up to the nearest power of two
- * - the result is undefined when n == 0
- * - this can be used to initialise global variables from constant data
- */
-#define roundup_pow_of_two(n) \
-( \
- __builtin_constant_p(n) ? ( \
- (n == 1) ? 1 : \
- (1UL << (ilog2((n) - 1) + 1)) \
- ) : \
- __roundup_pow_of_two(n) \
- )
-
-/**
- * rounddown_pow_of_two - round the given value down to nearest power of two
- * @n - parameter
- *
- * round the given value down to the nearest power of two
- * - the result is undefined when n == 0
- * - this can be used to initialise global variables from constant data
- */
-#define rounddown_pow_of_two(n) \
-( \
- __builtin_constant_p(n) ? ( \
- (n == 1) ? 0 : \
- (1UL << ilog2(n))) : \
- __rounddown_pow_of_two(n) \
- )
-
-/**
- * order_base_2 - calculate the (rounded up) base 2 order of the argument
- * @n: parameter
- *
- * The first few values calculated by this routine:
- * ob2(0) = 0
- * ob2(1) = 0
- * ob2(2) = 1
- * ob2(3) = 2
- * ob2(4) = 2
- * ob2(5) = 3
- * ... and so on.
- */
-
-#define order_base_2(n) ilog2(roundup_pow_of_two(n))
-
-#endif /* _LINUX_LOG2_H */
diff --git a/drivers/filesystems/reiserfs/inc/linux/module.h b/drivers/filesystems/reiserfs/inc/linux/module.h
deleted file mode 100644
index 3458af73a50..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/module.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
- * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
- * FILE: module.h
- * PURPOSE: Header file: nls structures & linux kernel ...
- * PROGRAMMER: Mark Piper, Matt Wu, Bo Brant�n.
- * HOMEPAGE:
- * UPDATE HISTORY:
- */
-
-#ifndef _RFSD_MODULE_HEADER_
-#define _RFSD_MODULE_HEADER_
-
-/* INCLUDES *************************************************************/
-
-#include "ntifs.h"
-#include "linux/types.h"
-
-/* STRUCTS & S******************************************************/
-
-//
-// Linux modules
-//
-
-#define __init
-#define __exit
-
-#define try_inc_mod_count(x) TRUE
-#define __MOD_DEC_USE_COUNT(x) do {} while(FALSE);
-#define EXPORT_SYMBOL(x)
-#define THIS_MODULE NULL
-
-#define module_init(X) int __init module_##X() {return X();}
-#define module_exit(X) void __exit module_##X() {X();}
-
-#define MODULE_LICENSE(x)
-
-#define inline __inline
-
-#define DECLARE_INIT(X) extern int __init module_##X(void)
-#define DECLARE_EXIT(X) extern void __exit module_##X(void)
-
-#define LOAD_NLS(X) do { rc = module_##X(); \
- if (rc != 0) { \
- goto errorout; \
- } \
- } while(0)
-
-
-#define UNLOAD_NLS(X) do { module_##X(); } while(0)
-
-//
-// Spin locks .....
-//
-
-typedef struct _spinlock_t {
-
- KSPIN_LOCK SpinLock;
- KIRQL Irql;
-} spinlock_t;
-
-#define spin_lock_init(lock) KeInitializeSpinLock(&((lock)->SpinLock))
-#define spin_lock(lock) KeAcquireSpinLock(&((lock)->SpinLock), &((lock)->Irql))
-#define spin_unlock(lock) KeReleaseSpinLock(&((lock)->SpinLock), (lock)->Irql)
-
-
-//
-// unicode character
-//
-
-struct nls_table {
- char *charset;
- int (*uni2char) (wchar_t uni, unsigned char *out, int boundlen);
- int (*char2uni) (const unsigned char *rawstring, int boundlen,
- wchar_t *uni);
- unsigned char *charset2lower;
- unsigned char *charset2upper;
- struct module *owner;
- struct nls_table *next;
-};
-
-/* this value hold the maximum octet of charset */
-#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */
-
-/* nls.c */
-extern int register_nls(struct nls_table *);
-extern int unregister_nls(struct nls_table *);
-extern struct nls_table *load_nls(char *);
-extern void unload_nls(struct nls_table *);
-extern struct nls_table *load_nls_default(void);
-
-extern int utf8_mbtowc(wchar_t *, const __u8 *, int);
-extern int utf8_mbstowcs(wchar_t *, const __u8 *, int);
-extern int utf8_wctomb(__u8 *, wchar_t, int);
-extern int utf8_wcstombs(__u8 *, const wchar_t *, int);
-
-/* FUNCTIONS DECLARATION *****************************************************/
-
-#endif // _RFSD_MODULE_HEADER_
diff --git a/drivers/filesystems/reiserfs/inc/linux/nls.h b/drivers/filesystems/reiserfs/inc/linux/nls.h
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/drivers/filesystems/reiserfs/inc/linux/reiserfs_acl.h b/drivers/filesystems/reiserfs/inc/linux/reiserfs_acl.h
deleted file mode 100644
index a57e973af0b..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/reiserfs_acl.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <linux/init.h>
-#include <linux/posix_acl.h>
-#include <linux/xattr_acl.h>
-
-#define REISERFS_ACL_VERSION 0x0001
-
-typedef struct {
- __u16 e_tag;
- __u16 e_perm;
- __u32 e_id;
-} reiserfs_acl_entry;
-
-typedef struct {
- __u16 e_tag;
- __u16 e_perm;
-} reiserfs_acl_entry_short;
-
-typedef struct {
- __u32 a_version;
-} reiserfs_acl_header;
-
-static inline size_t reiserfs_acl_size(int count)
-{
- if (count <= 4) {
- return sizeof(reiserfs_acl_header) +
- count * sizeof(reiserfs_acl_entry_short);
- } else {
- return sizeof(reiserfs_acl_header) +
- 4 * sizeof(reiserfs_acl_entry_short) +
- (count - 4) * sizeof(reiserfs_acl_entry);
- }
-}
-
-static inline int reiserfs_acl_count(size_t size)
-{
- ssize_t s;
- size -= sizeof(reiserfs_acl_header);
- s = size - 4 * sizeof(reiserfs_acl_entry_short);
- if (s < 0) {
- if (size % sizeof(reiserfs_acl_entry_short))
- return -1;
- return size / sizeof(reiserfs_acl_entry_short);
- } else {
- if (s % sizeof(reiserfs_acl_entry))
- return -1;
- return s / sizeof(reiserfs_acl_entry) + 4;
- }
-}
-
-
-#ifdef CONFIG_REISERFS_FS_POSIX_ACL
-struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
-int reiserfs_acl_chmod (struct inode *inode);
-int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
-int reiserfs_cache_default_acl (struct inode *dir);
-extern int reiserfs_xattr_posix_acl_init (void) __init;
-extern int reiserfs_xattr_posix_acl_exit (void);
-extern struct reiserfs_xattr_handler posix_acl_default_handler;
-extern struct reiserfs_xattr_handler posix_acl_access_handler;
-#else
-
-#define reiserfs_get_acl NULL
-#define reiserfs_cache_default_acl(inode) 0
-
-static inline int
-reiserfs_xattr_posix_acl_init (void)
-{
- return 0;
-}
-
-static inline int
-reiserfs_xattr_posix_acl_exit (void)
-{
- return 0;
-}
-
-static inline int
-reiserfs_acl_chmod (struct inode *inode)
-{
- return 0;
-}
-
-static inline int
-reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode)
-{
- return 0;
-}
-
-#endif
diff --git a/drivers/filesystems/reiserfs/inc/linux/reiserfs_fs.h b/drivers/filesystems/reiserfs/inc/linux/reiserfs_fs.h
deleted file mode 100644
index 98a04720588..00000000000
--- a/drivers/filesystems/reiserfs/inc/linux/reiserfs_fs.h
+++ /dev/null
@@ -1,2214 +0,0 @@
-/*
- * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
- */
-
-#ifdef __GCC__
-#ifndef __REACTOS__
- #define __PACKED __PACKED
-#else
- #define __PACKED __attribute__((packed))
-#endif
-#else
- #define __PACKED
-#endif
-
- /* this file has an amazingly stupid
- name, yura please fix it to be
- reiserfs.h, and merge all the rest
- of our .h files that are in this
- directory into it. */
-
-
-#ifndef _LINUX_REISER_FS_H
-#define _LINUX_REISER_FS_H
-
-#include <linux/types.h>
-#ifdef __KERNEL__
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/sched.h>
-#include <linux/workqueue.h>
-#include <asm/unaligned.h>
-#include <linux/bitops.h>
-#include <linux/proc_fs.h>
-#include <linux/smp_lock.h>
-#include <linux/buffer_head.h>
-#include <linux/reiserfs_fs_i.h>
-#include <linux/reiserfs_fs_sb.h>
-#endif
-
-/*
- * include/linux/reiser_fs.h
- *
- * Reiser File System constants and structures
- *
- */
-
-/* in reading the #defines, it may help to understand that they employ
- the following abbreviations:
-
- B = Buffer
- I = Item header
- H = Height within the tree (should be changed to LEV)
- N = Number of the item in the node
- STAT = stat data
- DEH = Directory Entry Header
- EC = Entry Count
- E = Entry number
- UL = Unsigned Long
- BLKH = BLocK Header
- UNFM = UNForMatted node
- DC = Disk Child
- P = Path
-
- These #defines are named by concatenating these abbreviations,
- where first comes the arguments, and last comes the return value,
- of the macro.
-
-*/
-
-#define USE_INODE_GENERATION_COUNTER
-
-#define REISERFS_PREALLOCATE
-#define DISPLACE_NEW_PACKING_LOCALITIES
-#define PREALLOCATION_SIZE 9
-
-/* n must be power of 2 */
-#define _ROUND_UP(x,n) (((x)+(n)-1u) & ~((n)-1u))
-
-// to be ok for alpha and others we have to align structures to 8 byte
-// boundary.
-// FIXME: do not change 4 by anything else: there is code which relies on that
-#define ROUND_UP(x) _ROUND_UP(x,8LL)
-
-/* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug
-** messages.
-*/
-#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
-
-void reiserfs_warning (struct super_block *s, const char * fmt, ...);
-/* assertions handling */
-
-#ifdef __GCC__
-#define CONSTF __attribute_const__
-#else
-#define CONSTF
-#endif
-
-/*
- * Disk Data Structures
- */
-
-/***************************************************************************/
-/* SUPER BLOCK */
-/***************************************************************************/
-
-/*
- * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs
- * the version in RAM is part of a larger structure containing fields never written to disk.
- */
-#define UNSET_HASH 0 // read_super will guess about, what hash names
- // in directories were sorted with
-#define TEA_HASH 1
-#define YURA_HASH 2
-#define R5_HASH 3
-#define DEFAULT_HASH R5_HASH
-
-
-struct journal_params {
- __u32 jp_journal_1st_block; /* where does journal start from on its
- * device */
- __u32 jp_journal_dev; /* journal device st_rdev */
- __u32 jp_journal_size; /* size of the journal */
- __u32 jp_journal_trans_max; /* max number of blocks in a transaction. */
- __u32 jp_journal_magic; /* random value made on fs creation (this
- * was sb_journal_block_count) */
- __u32 jp_journal_max_batch; /* max number of blocks to batch into a
- * trans */
- __u32 jp_journal_max_commit_age; /* in seconds, how old can an async
- * commit be */
- __u32 jp_journal_max_trans_age; /* in seconds, how old can a transaction
- * be */
-};
-
-/* this is the super from 3.5.X, where X >= 10 */
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-struct reiserfs_super_block_v1
-{
- __u32 s_block_count; /* blocks count */
- __u32 s_free_blocks; /* free blocks count */
- __u32 s_root_block; /* root block number */
- struct journal_params s_journal;
- __u16 s_blocksize; /* block size */
- __u16 s_oid_maxsize; /* max size of object id array, see
- * get_objectid() commentary */
- __u16 s_oid_cursize; /* current size of object id array */
- __u16 s_umount_state; /* this is set to 1 when filesystem was
- * umounted, to 2 - when not */
- char s_magic[10]; /* reiserfs magic string indicates that
- * file system is reiserfs:
- * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */
- __u16 s_fs_state; /* it is set to used by fsck to mark which
- * phase of rebuilding is done */
- __u32 s_hash_function_code; /* indicate, what hash function is being use
- * to sort names in a directory*/
- __u16 s_tree_height; /* height of disk tree */
- __u16 s_bmap_nr; /* amount of bitmap blocks needed to address
- * each block of file system */
- __u16 s_version; /* this field is only reliable on filesystem
- * with non-standard journal */
- __u16 s_reserved_for_journal; /* size in blocks of journal area on main
- * device, we need to keep after
- * making fs with non-standard journal */
-} __PACKED;
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-
-#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1))
-
-/* this is the on disk super block */
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-struct reiserfs_super_block
-{
- struct reiserfs_super_block_v1 s_v1;
- __u32 s_inode_generation;
- __u32 s_flags; /* Right now used only by inode-attributes, if enabled */
- unsigned char s_uuid[16]; /* filesystem unique identifier */
- unsigned char s_label[16]; /* filesystem volume label */
- char s_unused[88] ; /* zero filled by mkreiserfs and
- * reiserfs_convert_objectid_map_v1()
- * so any additions must be updated
- * there as well. */
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-#define SB_SIZE (sizeof(struct reiserfs_super_block))
-
-#define REISERFS_VERSION_1 0
-#define REISERFS_VERSION_2 2
-
-
-// on-disk super block fields converted to cpu form
-#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs)
-#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1))
-#define SB_BLOCKSIZE(s) \
- le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_blocksize))
-#define SB_BLOCK_COUNT(s) \
- le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_block_count))
-#define SB_FREE_BLOCKS(s) \
- le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks))
-#define SB_REISERFS_MAGIC(s) \
- (SB_V1_DISK_SUPER_BLOCK(s)->s_magic)
-#define SB_ROOT_BLOCK(s) \
- le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_root_block))
-#define SB_TREE_HEIGHT(s) \
- le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height))
-#define SB_REISERFS_STATE(s) \
- le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state))
-#define SB_VERSION(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_version))
-#define SB_BMAP_NR(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr))
-
-#define PUT_SB_BLOCK_COUNT(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_block_count = cpu_to_le32(val); } while (0)
-#define PUT_SB_FREE_BLOCKS(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks = cpu_to_le32(val); } while (0)
-#define PUT_SB_ROOT_BLOCK(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_root_block = cpu_to_le32(val); } while (0)
-#define PUT_SB_TREE_HEIGHT(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0)
-#define PUT_SB_REISERFS_STATE(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0)
-#define PUT_SB_VERSION(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0)
-#define PUT_SB_BMAP_NR(s, val) \
- do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0)
-
-
-#define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal)
-#define SB_ONDISK_JOURNAL_SIZE(s) \
- le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size))
-#define SB_ONDISK_JOURNAL_1st_BLOCK(s) \
- le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_1st_block))
-#define SB_ONDISK_JOURNAL_DEVICE(s) \
- le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev))
-#define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \
- le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal))
-
-#define is_block_in_log_or_reserved_area(s, block) \
- block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \
- && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \
- ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \
- SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s)))
-
-
-
- /* used by gcc */
-#define REISERFS_SUPER_MAGIC 0x52654973
- /* used by file system utilities that
- look at the superblock, etc. */
-#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
-#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
-#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
-
-int is_reiserfs_3_5 (struct reiserfs_super_block * rs);
-int is_reiserfs_3_6 (struct reiserfs_super_block * rs);
-int is_reiserfs_jr (struct reiserfs_super_block * rs);
-
-/* ReiserFS leaves the first 64k unused, so that partition labels have
- enough space. If someone wants to write a fancy bootloader that
- needs more than 64k, let us know, and this will be increased in size.
- This number must be larger than than the largest block size on any
- platform, or code will break. -Hans */
-#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
-#define REISERFS_FIRST_BLOCK unused_define
-#define REISERFS_JOURNAL_OFFSET_IN_BYTES REISERFS_DISK_OFFSET_IN_BYTES
-
-/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
-#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
-
-// reiserfs internal error code (used by search_by_key adn fix_nodes))
-#define CARRY_ON 0
-#define REPEAT_SEARCH -1
-#define IO_ERROR -2
-#define NO_DISK_SPACE -3
-#define NO_BALANCING_NEEDED (-4)
-#define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5)
-#define QUOTA_EXCEEDED -6
-
-typedef __u32 b_blocknr_t;
-typedef __u32 unp_t;
-
-struct unfm_nodeinfo {
- unp_t unfm_nodenum;
- unsigned short unfm_freespace;
-};
-
-/* there are two formats of keys: 3.5 and 3.6
- */
-#define KEY_FORMAT_3_5 0
-#define KEY_FORMAT_3_6 1
-
-/* there are two stat datas */
-#define STAT_DATA_V1 0
-#define STAT_DATA_V2 1
-
-/** this says about version of key of all items (but stat data) the
- object consists of */
-#define get_inode_item_key_version( inode ) \
- ((REISERFS_I(inode)->i_flags & i_item_key_version_mask) ? KEY_FORMAT_3_6 : KEY_FORMAT_3_5)
-
-#define set_inode_item_key_version( inode, version ) \
- ({ if((version)==KEY_FORMAT_3_6) \
- REISERFS_I(inode)->i_flags |= i_item_key_version_mask; \
- else \
- REISERFS_I(inode)->i_flags &= ~i_item_key_version_mask; })
-
-#define get_inode_sd_version(inode) \
- ((REISERFS_I(inode)->i_flags & i_stat_data_version_mask) ? STAT_DATA_V2 : STAT_DATA_V1)
-
-#define set_inode_sd_version(inode, version) \
- ({ if((version)==STAT_DATA_V2) \
- REISERFS_I(inode)->i_flags |= i_stat_data_version_mask; \
- else \
- REISERFS_I(inode)->i_flags &= ~i_stat_data_version_mask; })
-
-/* This is an aggressive tail suppression policy, I am hoping it
- improves our benchmarks. The principle behind it is that percentage
- space saving is what matters, not absolute space saving. This is
- non-intuitive, but it helps to understand it if you consider that the
- cost to access 4 blocks is not much more than the cost to access 1
- block, if you have to do a seek and rotate. A tail risks a
- non-linear disk access that is significant as a percentage of total
- time cost for a 4 block file and saves an amount of space that is
- less significant as a percentage of space, or so goes the hypothesis.
- -Hans */
-#define STORE_TAIL_IN_UNFM_S1(n_file_size,n_tail_size,n_block_size) \
-(\
- (!(n_tail_size)) || \
- (((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \
- ( (n_file_size) >= (n_block_size) * 4 ) || \
- ( ( (n_file_size) >= (n_block_size) * 3 ) && \
- ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \
- ( ( (n_file_size) >= (n_block_size) * 2 ) && \
- ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \
- ( ( (n_file_size) >= (n_block_size) ) && \
- ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \
-)
-
-/* Another strategy for tails, this one means only create a tail if all the
- file would fit into one DIRECT item.
- Primary intention for this one is to increase performance by decreasing
- seeking.
-*/
-#define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \
-(\
- (!(n_tail_size)) || \
- (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \
-)
-
-
-
-/*
- * values for s_umount_state field
- */
-#define REISERFS_VALID_FS 1
-#define REISERFS_ERROR_FS 2
-
-//
-// there are 5 item types currently
-//
-#define TYPE_STAT_DATA 0
-#define TYPE_INDIRECT 1
-#define TYPE_DIRECT 2
-#define TYPE_DIRENTRY 3
-#define TYPE_MAXTYPE 3
-#define TYPE_ANY 15 // FIXME: comment is required
-
-/***************************************************************************/
-/* KEY & ITEM HEAD */
-/***************************************************************************/
-
-//
-// directories use this key as well as old files
-//
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-struct offset_v1 {
- __u32 k_offset;
- __u32 k_uniqueness;
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-struct offset_v2 {
-#ifdef __LITTLE_ENDIAN
- /* little endian version */
- __u64 k_offset:60;
- __u64 k_type: 4;
-#else
- /* big endian version */
- __u64 k_type: 4;
- __u64 k_offset:60;
-#endif
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-
-#ifndef __LITTLE_ENDIAN
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-typedef union {
- struct offset_v2 offset_v2;
- __u64 linear;
-} __PACKED offset_v2_esafe_overlay;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-
-#else
-# define offset_v2_k_type(v2) ((v2)->k_type)
-# define set_offset_v2_k_type(v2,val) (offset_v2_k_type(v2) = (val))
-# define offset_v2_k_offset(v2) ((v2)->k_offset)
-# define set_offset_v2_k_offset(v2,val) (offset_v2_k_offset(v2) = (val))
-#endif
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-/* Key of an item determines its location in the S+tree, and
- is composed of 4 components */
-struct reiserfs_key {
- __u32 k_dir_id; /* packing locality: by default parent
- directory object id */
- __u32 k_objectid; /* object identifier */
- union {
- struct offset_v1 k_offset_v1;
- struct offset_v2 k_offset_v2;
- } __PACKED u;
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-struct cpu_key {
- struct reiserfs_key on_disk_key;
- int version;
- int key_length; /* 3 in all cases but direct2indirect and
- indirect2direct conversion */
-};
-
-/* Our function for comparing keys can compare keys of different
- lengths. It takes as a parameter the length of the keys it is to
- compare. These defines are used in determining what is to be passed
- to it as that parameter. */
-#define REISERFS_FULL_KEY_LEN 4
-#define REISERFS_SHORT_KEY_LEN 2
-
-/* The result of the key compare */
-#define FIRST_GREATER 1
-#define SECOND_GREATER -1
-#define KEYS_IDENTICAL 0
-#define KEY_FOUND 1
-#define KEY_NOT_FOUND 0
-
-#define KEY_SIZE (sizeof(struct reiserfs_key))
-#define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32))
-
-/* return values for search_by_key and clones */
-#define ITEM_FOUND 1
-#define ITEM_NOT_FOUND 0
-#define ENTRY_FOUND 1
-#define ENTRY_NOT_FOUND 0
-#define DIRECTORY_NOT_FOUND -1
-#define REGULAR_FILE_FOUND -2
-#define DIRECTORY_FOUND -3
-#define BYTE_FOUND 1
-#define BYTE_NOT_FOUND 0
-#define FILE_NOT_FOUND -1
-
-#define POSITION_FOUND 1
-#define POSITION_NOT_FOUND 0
-
-// return values for reiserfs_find_entry and search_by_entry_key
-#define NAME_FOUND 1
-#define NAME_NOT_FOUND 0
-#define GOTO_PREVIOUS_ITEM 2
-#define NAME_FOUND_INVISIBLE 3
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-/* Everything in the filesystem is stored as a set of items. The
- item head contains the key of the item, its free space (for
- indirect items) and specifies the location of the item itself
- within the block. */
-struct item_head
-{
- /* Everything in the tree is found by searching for it based on
- * its key.*/
- struct reiserfs_key ih_key;
- union {
- /* The free space in the last unformatted node of an
- indirect item if this is an indirect item. This
- equals 0xFFFF iff this is a direct item or stat data
- item. Note that the key, not this field, is used to
- determine the item type, and thus which field this
- union contains. */
- __u16 ih_free_space_reserved;
- /* Iff this is a directory item, this field equals the
- number of directory entries in the directory item. */
- __u16 ih_entry_count;
- } __PACKED u;
- __u16 ih_item_len; /* total size of the item body */
- __u16 ih_item_location; /* an offset to the item body
- * within the block */
- __u16 ih_version; /* 0 for all old items, 2 for new
- ones. Highest bit is set by fsck
- temporary, cleaned after all
- done */
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-/* size of item header */
-#define IH_SIZE (sizeof(struct item_head))
-
-#define ih_free_space(ih) le16_to_cpu((ih)->u.ih_free_space_reserved)
-#define ih_version(ih) le16_to_cpu((ih)->ih_version)
-#define ih_entry_count(ih) le16_to_cpu((ih)->u.ih_entry_count)
-#define ih_location(ih) le16_to_cpu((ih)->ih_item_location)
-#define ih_item_len(ih) le16_to_cpu((ih)->ih_item_len)
-
-#define put_ih_free_space(ih, val) do { (ih)->u.ih_free_space_reserved = cpu_to_le16(val); } while(0)
-#define put_ih_version(ih, val) do { (ih)->ih_version = cpu_to_le16(val); } while (0)
-#define put_ih_entry_count(ih, val) do { (ih)->u.ih_entry_count = cpu_to_le16(val); } while (0)
-#define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0)
-#define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0)
-
-
-#define unreachable_item(ih) (ih_version(ih) & (1 << 15))
-
-#define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih))
-#define set_ih_free_space(ih,val) put_ih_free_space((ih), ((ih_version(ih) == KEY_FORMAT_3_6) ? 0 : (val)))
-
-/* these operate on indirect items, where you've got an array of ints
-** at a possibly unaligned location. These are a noop on ia32
-**
-** p is the array of __u32, i is the index into the array, v is the value
-** to store there.
-*/
-#define get_block_num(p, i) le32_to_cpu(get_unaligned((p) + (i)))
-#define put_block_num(p, i, v) put_unaligned(cpu_to_le32(v), (p) + (i))
-
-//
-// in old version uniqueness field shows key type
-//
-#define V1_SD_UNIQUENESS 0
-#define V1_INDIRECT_UNIQUENESS 0xfffffffe
-#define V1_DIRECT_UNIQUENESS 0xffffffff
-#define V1_DIRENTRY_UNIQUENESS 500
-#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required
-
-//
-// here are conversion routines
-//
-static inline int uniqueness2type (__u32 uniqueness) CONSTF;
-static inline int uniqueness2type (__u32 uniqueness)
-{
- switch ((int)uniqueness) {
- case V1_SD_UNIQUENESS: return TYPE_STAT_DATA;
- case V1_INDIRECT_UNIQUENESS: return TYPE_INDIRECT;
- case V1_DIRECT_UNIQUENESS: return TYPE_DIRECT;
- case V1_DIRENTRY_UNIQUENESS: return TYPE_DIRENTRY;
- default:
- reiserfs_warning (NULL, "vs-500: unknown uniqueness %d",
- uniqueness);
- case V1_ANY_UNIQUENESS:
- return TYPE_ANY;
- }
-}
-
-static inline __u32 type2uniqueness (int type) CONSTF;
-static inline __u32 type2uniqueness (int type)
-{
- switch (type) {
- case TYPE_STAT_DATA: return V1_SD_UNIQUENESS;
- case TYPE_INDIRECT: return V1_INDIRECT_UNIQUENESS;
- case TYPE_DIRECT: return V1_DIRECT_UNIQUENESS;
- case TYPE_DIRENTRY: return V1_DIRENTRY_UNIQUENESS;
- default:
- reiserfs_warning (NULL, "vs-501: unknown type %d", type);
- case TYPE_ANY:
- return V1_ANY_UNIQUENESS;
- }
-}
-
-#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY)
-#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT)
-#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT)
-#define is_statdata_le_key(version,key) (le_key_k_type (version, key) == TYPE_STAT_DATA)
-
-//
-// item header has version.
-//
-#define is_direntry_le_ih(ih) is_direntry_le_key (ih_version (ih), &((ih)->ih_key))
-#define is_direct_le_ih(ih) is_direct_le_key (ih_version (ih), &((ih)->ih_key))
-#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key))
-#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key))
-
-#define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY)
-#define is_direct_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRECT)
-#define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT)
-#define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA)
-
-
-/* are these used ? */
-#define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key)))
-#define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key)))
-#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
-#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
-
-
-
-
-
-#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \
- ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \
- I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) )
-
-/* maximal length of item */
-#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
-#define MIN_ITEM_LEN 1
-
-
-/* object identifier for root dir */
-#define REISERFS_ROOT_OBJECTID 2
-#define REISERFS_ROOT_PARENT_OBJECTID 1
-extern struct reiserfs_key root_key;
-
-
-
-
-/*
- * Picture represents a leaf of the S+tree
- * ______________________________________________________
- * | | Array of | | |
- * |Block | Object-Item | F r e e | Objects- |
- * | head | Headers | S p a c e | Items |
- * |______|_______________|___________________|___________|
- */
-
-/* Header of a disk block. More precisely, header of a formatted leaf
- or internal node, and not the header of an unformatted node. */
-struct block_head {
- __u16 blk_level; /* Level of a block in the tree. */
- __u16 blk_nr_item; /* Number of keys/items in a block. */
- __u16 blk_free_space; /* Block free space in bytes. */
- __u16 blk_reserved;
- /* dump this in v4/planA */
- struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */
-};
-
-#define BLKH_SIZE (sizeof(struct block_head))
-#define blkh_level(p_blkh) (le16_to_cpu((p_blkh)->blk_level))
-#define blkh_nr_item(p_blkh) (le16_to_cpu((p_blkh)->blk_nr_item))
-#define blkh_free_space(p_blkh) (le16_to_cpu((p_blkh)->blk_free_space))
-#define blkh_reserved(p_blkh) (le16_to_cpu((p_blkh)->blk_reserved))
-#define set_blkh_level(p_blkh,val) ((p_blkh)->blk_level = cpu_to_le16(val))
-#define set_blkh_nr_item(p_blkh,val) ((p_blkh)->blk_nr_item = cpu_to_le16(val))
-#define set_blkh_free_space(p_blkh,val) ((p_blkh)->blk_free_space = cpu_to_le16(val))
-#define set_blkh_reserved(p_blkh,val) ((p_blkh)->blk_reserved = cpu_to_le16(val))
-#define blkh_right_delim_key(p_blkh) ((p_blkh)->blk_right_delim_key)
-#define set_blkh_right_delim_key(p_blkh,val) ((p_blkh)->blk_right_delim_key = val)
-
-/*
- * values for blk_level field of the struct block_head
- */
-
-#define FREE_LEVEL 0 /* when node gets removed from the tree its
- blk_level is set to FREE_LEVEL. It is then
- used to see whether the node is still in the
- tree */
-
-#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level.*/
-
-/* Given the buffer head of a formatted node, resolve to the block head of that node. */
-#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data))
-/* Number of items that are in buffer. */
-#define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh)))
-#define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh)))
-#define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh)))
-
-#define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0)
-#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0)
-#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0)
-
-
-/* Get right delimiting key. -- little endian */
-#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh))
-
-/* Does the buffer contain a disk leaf. */
-#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL)
-
-/* Does the buffer contain a disk internal node */
-#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \
- && B_LEVEL(p_s_bh) <= MAX_HEIGHT)
-
-
-
-
-/***************************************************************************/
-/* STAT DATA */
-/***************************************************************************/
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-//
-// old stat data is 32 bytes long. We are going to distinguish new one by
-// different size
-//
-struct stat_data_v1
-{
- __u16 sd_mode; /* file type, permissions */
- __u16 sd_nlink; /* number of hard links */
- __u16 sd_uid; /* owner */
- __u16 sd_gid; /* group */
- __u32 sd_size; /* file size */
- __u32 sd_atime; /* time of last access */
- __u32 sd_mtime; /* time file was last modified */
- __u32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
- union {
- __u32 sd_rdev;
- __u32 sd_blocks; /* number of blocks file uses */
- } __PACKED u;
- __u32 sd_first_direct_byte; /* first byte of file which is stored
- in a direct item: except that if it
- equals 1 it is a symlink and if it
- equals ~(__u32)0 there is no
- direct item. The existence of this
- field really grates on me. Let's
- replace it with a macro based on
- sd_size and our tail suppression
- policy. Someday. -Hans */
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-#define SD_V1_SIZE (sizeof(struct stat_data_v1))
-#define stat_data_v1(ih) (ih_version (ih) == KEY_FORMAT_3_5)
-#define sd_v1_mode(sdp) (le16_to_cpu((sdp)->sd_mode))
-#define set_sd_v1_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v))
-#define sd_v1_nlink(sdp) (le16_to_cpu((sdp)->sd_nlink))
-#define set_sd_v1_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le16(v))
-#define sd_v1_uid(sdp) (le16_to_cpu((sdp)->sd_uid))
-#define set_sd_v1_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le16(v))
-#define sd_v1_gid(sdp) (le16_to_cpu((sdp)->sd_gid))
-#define set_sd_v1_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le16(v))
-#define sd_v1_size(sdp) (le32_to_cpu((sdp)->sd_size))
-#define set_sd_v1_size(sdp,v) ((sdp)->sd_size = cpu_to_le32(v))
-#define sd_v1_atime(sdp) (le32_to_cpu((sdp)->sd_atime))
-#define set_sd_v1_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v))
-#define sd_v1_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime))
-#define set_sd_v1_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v))
-#define sd_v1_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime))
-#define set_sd_v1_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v))
-#define sd_v1_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev))
-#define set_sd_v1_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v))
-#define sd_v1_blocks(sdp) (le32_to_cpu((sdp)->u.sd_blocks))
-#define set_sd_v1_blocks(sdp,v) ((sdp)->u.sd_blocks = cpu_to_le32(v))
-#define sd_v1_first_direct_byte(sdp) \
- (le32_to_cpu((sdp)->sd_first_direct_byte))
-#define set_sd_v1_first_direct_byte(sdp,v) \
- ((sdp)->sd_first_direct_byte = cpu_to_le32(v))
-
-#include <linux/ext2_fs.h>
-
-/* inode flags stored in sd_attrs (nee sd_reserved) */
-
-/* we want common flags to have the same values as in ext2,
- so chattr(1) will work without problems */
-#define REISERFS_IMMUTABLE_FL EXT2_IMMUTABLE_FL
-#define REISERFS_APPEND_FL EXT2_APPEND_FL
-#define REISERFS_SYNC_FL EXT2_SYNC_FL
-#define REISERFS_NOATIME_FL EXT2_NOATIME_FL
-#define REISERFS_NODUMP_FL EXT2_NODUMP_FL
-#define REISERFS_SECRM_FL EXT2_SECRM_FL
-#define REISERFS_UNRM_FL EXT2_UNRM_FL
-#define REISERFS_COMPR_FL EXT2_COMPR_FL
-#define REISERFS_NOTAIL_FL EXT2_NOTAIL_FL
-
-/* persistent flags that file inherits from the parent directory */
-#define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
- REISERFS_SYNC_FL | \
- REISERFS_NOATIME_FL | \
- REISERFS_NODUMP_FL | \
- REISERFS_SECRM_FL | \
- REISERFS_COMPR_FL | \
- REISERFS_NOTAIL_FL )
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-/* Stat Data on disk (reiserfs version of UFS disk inode minus the
- address blocks) */
-struct stat_data {
- __u16 sd_mode; /* file type, permissions */
- __u16 sd_attrs; /* persistent inode flags */
- __u32 sd_nlink; /* number of hard links */
- __u64 sd_size; /* file size */
- __u32 sd_uid; /* owner */
- __u32 sd_gid; /* group */
- __u32 sd_atime; /* time of last access */
- __u32 sd_mtime; /* time file was last modified */
- __u32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
- __u32 sd_blocks;
- union {
- __u32 sd_rdev;
- __u32 sd_generation;
- //__u32 sd_first_direct_byte;
- /* first byte of file which is stored in a
- direct item: except that if it equals 1
- it is a symlink and if it equals
- ~(__u32)0 there is no direct item. The
- existence of this field really grates
- on me. Let's replace it with a macro
- based on sd_size and our tail
- suppression policy? */
- } __PACKED u;
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-//
-// this is 44 bytes long
-//
-#define SD_SIZE (sizeof(struct stat_data))
-#define SD_V2_SIZE SD_SIZE
-#define stat_data_v2(ih) (ih_version (ih) == KEY_FORMAT_3_6)
-#define sd_v2_mode(sdp) (le16_to_cpu((sdp)->sd_mode))
-#define set_sd_v2_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v))
-/* sd_reserved */
-/* set_sd_reserved */
-#define sd_v2_nlink(sdp) (le32_to_cpu((sdp)->sd_nlink))
-#define set_sd_v2_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le32(v))
-#define sd_v2_size(sdp) (le64_to_cpu((sdp)->sd_size))
-#define set_sd_v2_size(sdp,v) ((sdp)->sd_size = cpu_to_le64(v))
-#define sd_v2_uid(sdp) (le32_to_cpu((sdp)->sd_uid))
-#define set_sd_v2_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le32(v))
-#define sd_v2_gid(sdp) (le32_to_cpu((sdp)->sd_gid))
-#define set_sd_v2_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le32(v))
-#define sd_v2_atime(sdp) (le32_to_cpu((sdp)->sd_atime))
-#define set_sd_v2_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v))
-#define sd_v2_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime))
-#define set_sd_v2_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v))
-#define sd_v2_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime))
-#define set_sd_v2_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v))
-#define sd_v2_blocks(sdp) (le32_to_cpu((sdp)->sd_blocks))
-#define set_sd_v2_blocks(sdp,v) ((sdp)->sd_blocks = cpu_to_le32(v))
-#define sd_v2_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev))
-#define set_sd_v2_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v))
-#define sd_v2_generation(sdp) (le32_to_cpu((sdp)->u.sd_generation))
-#define set_sd_v2_generation(sdp,v) ((sdp)->u.sd_generation = cpu_to_le32(v))
-#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs))
-#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v))
-
-
-/***************************************************************************/
-/* DIRECTORY STRUCTURE */
-/***************************************************************************/
-/*
- Picture represents the structure of directory items
- ________________________________________________
- | Array of | | | | | |
- | directory |N-1| N-2 | .... | 1st |0th|
- | entry headers | | | | | |
- |_______________|___|_____|________|_______|___|
- <---- directory entries ------>
-
- First directory item has k_offset component 1. We store "." and ".."
- in one item, always, we never split "." and ".." into differing
- items. This makes, among other things, the code for removing
- directories simpler. */
-#define SD_OFFSET 0
-#define SD_UNIQUENESS 0
-#define DOT_OFFSET 1
-#define DOT_DOT_OFFSET 2
-#define DIRENTRY_UNIQUENESS 500
-
-/* */
-#define FIRST_ITEM_OFFSET 1
-
-/*
- Q: How to get key of object pointed to by entry from entry?
-
- A: Each directory entry has its header. This header has deh_dir_id and deh_objectid fields, those are key
- of object, entry points to */
-
-/* NOT IMPLEMENTED:
- Directory will someday contain stat data of object */
-
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-struct reiserfs_de_head
-{
- __u32 deh_offset; /* third component of the directory entry key */
- __u32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced
- by directory entry */
- __u32 deh_objectid; /* objectid of the object, that is referenced by directory entry */
- __u16 deh_location; /* offset of name in the whole item */
- __u16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
- entry is hidden (unlinked) */
-} __PACKED;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-#define DEH_SIZE sizeof(struct reiserfs_de_head)
-#define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset))
-#define deh_dir_id(p_deh) (le32_to_cpu((p_deh)->deh_dir_id))
-#define deh_objectid(p_deh) (le32_to_cpu((p_deh)->deh_objectid))
-#define deh_location(p_deh) (le16_to_cpu((p_deh)->deh_location))
-#define deh_state(p_deh) (le16_to_cpu((p_deh)->deh_state))
-
-#define put_deh_offset(p_deh,v) ((p_deh)->deh_offset = cpu_to_le32((v)))
-#define put_deh_dir_id(p_deh,v) ((p_deh)->deh_dir_id = cpu_to_le32((v)))
-#define put_deh_objectid(p_deh,v) ((p_deh)->deh_objectid = cpu_to_le32((v)))
-#define put_deh_location(p_deh,v) ((p_deh)->deh_location = cpu_to_le16((v)))
-#define put_deh_state(p_deh,v) ((p_deh)->deh_state = cpu_to_le16((v)))
-
-/* empty directory contains two entries "." and ".." and their headers */
-#define EMPTY_DIR_SIZE \
-(DEH_SIZE * 2 + ROUND_UP (strlen (".")) + ROUND_UP (strlen ("..")))
-
-/* old format directories have this size when empty */
-#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3)
-
-#define DEH_Statdata 0 /* not used now */
-#define DEH_Visible 2
-
-/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */
-#if BITS_PER_LONG == 64 || defined(__s390__) || defined(__hppa__)
-# define ADDR_UNALIGNED_BITS (3)
-#endif
-
-/* These are only used to manipulate deh_state.
- * Because of this, we'll use the ext2_ bit routines,
- * since they are little endian */
-#ifdef ADDR_UNALIGNED_BITS
-
-# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1)))
-# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3)
-
-# define set_bit_unaligned(nr, addr) ext2_set_bit((nr) + unaligned_offset(addr), aligned_address(addr))
-# define clear_bit_unaligned(nr, addr) ext2_clear_bit((nr) + unaligned_offset(addr), aligned_address(addr))
-# define test_bit_unaligned(nr, addr) ext2_test_bit((nr) + unaligned_offset(addr), aligned_address(addr))
-
-#else
-
-# define set_bit_unaligned(nr, addr) ext2_set_bit(nr, addr)
-# define clear_bit_unaligned(nr, addr) ext2_clear_bit(nr, addr)
-# define test_bit_unaligned(nr, addr) ext2_test_bit(nr, addr)
-
-#endif
-
-#define mark_de_with_sd(deh) set_bit_unaligned (DEH_Statdata, &((deh)->deh_state))
-#define mark_de_without_sd(deh) clear_bit_unaligned (DEH_Statdata, &((deh)->deh_state))
-#define mark_de_visible(deh) set_bit_unaligned (DEH_Visible, &((deh)->deh_state))
-#define mark_de_hidden(deh) clear_bit_unaligned (DEH_Visible, &((deh)->deh_state))
-
-#define de_with_sd(deh) test_bit_unaligned (DEH_Statdata, &((deh)->deh_state))
-#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
-#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
-
-extern void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid,
- __u32 par_dirid, __u32 par_objid);
-extern void make_empty_dir_item (char * body, __u32 dirid, __u32 objid,
- __u32 par_dirid, __u32 par_objid);
-
-/* array of the entry headers */
- /* get item body */
-#define B_I_PITEM(bh,ih) ( (bh)->b_data + ih_location(ih) )
-#define B_I_DEH(bh,ih) ((struct reiserfs_de_head *)(B_I_PITEM(bh,ih)))
-
-/* length of the directory entry in directory item. This define
- calculates length of i-th directory entry using directory entry
- locations from dir entry head. When it calculates length of 0-th
- directory entry, it uses length of whole item in place of entry
- location of the non-existent following entry in the calculation.
- See picture above.*/
-/*
-#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
-((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh))))
-*/
-static inline int entry_length (const struct buffer_head * bh,
- const struct item_head * ih, int pos_in_item)
-{
- struct reiserfs_de_head * deh;
-
- deh = B_I_DEH (bh, ih) + pos_in_item;
- if (pos_in_item)
- return deh_location(deh-1) - deh_location(deh);
-
- return ih_item_len(ih) - deh_location(deh);
-}
-
-
-
-/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */
-#define I_ENTRY_COUNT(ih) (ih_entry_count((ih)))
-
-
-/* name by bh, ih and entry_num */
-#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
-
-// two entries per block (at least)
-#define REISERFS_MAX_NAME(block_size) 255
-
-
-/* this structure is used for operations on directory entries. It is
- not a disk structure. */
-/* When reiserfs_find_entry or search_by_entry_key find directory
- entry, they return filled reiserfs_dir_entry structure */
-struct reiserfs_dir_entry
-{
- struct buffer_head * de_bh;
- int de_item_num;
- struct item_head * de_ih;
- int de_entry_num;
- struct reiserfs_de_head * de_deh;
- int de_entrylen;
- int de_namelen;
- char * de_name;
- char * de_gen_number_bit_string;
-
- __u32 de_dir_id;
- __u32 de_objectid;
-
- struct cpu_key de_entry_key;
-};
-
-/* these defines are useful when a particular member of a reiserfs_dir_entry is needed */
-
-/* pointer to file name, stored in entry */
-#define B_I_DEH_ENTRY_FILE_NAME(bh,ih,deh) (B_I_PITEM (bh, ih) + deh_location(deh))
-
-/* length of name */
-#define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \
-(I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0))
-
-
-
-/* hash value occupies bits from 7 up to 30 */
-#define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL)
-/* generation number occupies 7 bits starting from 0 up to 6 */
-#define GET_GENERATION_NUMBER(offset) ((offset) & 0x7fLL)
-#define MAX_GENERATION_NUMBER 127
-
-#define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number))
-
-
-/*
- * Picture represents an internal node of the reiserfs tree
- * ______________________________________________________
- * | | Array of | Array of | Free |
- * |block | keys | pointers | space |
- * | head | N | N+1 | |
- * |______|_______________|___________________|___________|
- */
-
-/***************************************************************************/
-/* DISK CHILD */
-/***************************************************************************/
-/* Disk child pointer: The pointer from an internal node of the tree
- to a node that is on disk. */
-struct disk_child {
- __u32 dc_block_number; /* Disk child's block number. */
- __u16 dc_size; /* Disk child's used space. */
- __u16 dc_reserved;
-};
-
-#define DC_SIZE (sizeof(struct disk_child))
-#define dc_block_number(dc_p) (le32_to_cpu((dc_p)->dc_block_number))
-#define dc_size(dc_p) (le16_to_cpu((dc_p)->dc_size))
-#define put_dc_block_number(dc_p, val) do { (dc_p)->dc_block_number = cpu_to_le32(val); } while(0)
-#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
-
-/* Get disk child by buffer header and position in the tree node. */
-#define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\
-((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos)))
-
-/* Get disk child number by buffer header and position in the tree node. */
-#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos)))
-#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val ))
-
- /* maximal value of field child_size in structure disk_child */
- /* child size is the combined size of all items and their headers */
-#define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE ))
-
-/* amount of used space in buffer (not including block head) */
-#define B_CHILD_SIZE(cur) (MAX_CHILD_SIZE(cur)-(B_FREE_SPACE(cur)))
-
-/* max and min number of keys in internal node */
-#define MAX_NR_KEY(bh) ( (MAX_CHILD_SIZE(bh)-DC_SIZE)/(KEY_SIZE+DC_SIZE) )
-#define MIN_NR_KEY(bh) (MAX_NR_KEY(bh)/2)
-
-/***************************************************************************/
-/* PATH STRUCTURES AND DEFINES */
-/***************************************************************************/
-
-
-/* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the
- key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it
- does not find them in the cache it reads them from disk. For each node search_by_key finds using
- reiserfs_bread it then uses bin_search to look through that node. bin_search will find the
- position of the block_number of the next node if it is looking through an internal node. If it
- is looking through a leaf node bin_search will find the position of the item which has key either
- equal to given key, or which is the maximal key less than the given key. */
-
-struct path_element {
- struct buffer_head * pe_buffer; /* Pointer to the buffer at the path in the tree. */
- int pe_position; /* Position in the tree node which is placed in the */
- /* buffer above. */
-};
-
-#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */
-#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */
-#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */
-
-#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
-#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
-
-
-
-/* We need to keep track of who the ancestors of nodes are. When we
- perform a search we record which nodes were visited while
- descending the tree looking for the node we searched for. This list
- of nodes is called the path. This information is used while
- performing balancing. Note that this path information may become
- invalid, and this means we must check it when using it to see if it
- is still valid. You'll need to read search_by_key and the comments
- in it, especially about decrement_counters_in_path(), to understand
- this structure.
-
-Paths make the code so much harder to work with and debug.... An
-enormous number of bugs are due to them, and trying to write or modify
-code that uses them just makes my head hurt. They are based on an
-excessive effort to avoid disturbing the precious VFS code.:-( The
-gods only know how we are going to SMP the code that uses them.
-znodes are the way! */
-
-#define PATH_READA 0x1 /* do read ahead */
-#define PATH_READA_BACK 0x2 /* read backwards */
-
-struct path {
- int path_length; /* Length of the array above. */
- int reada;
- struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
- int pos_in_item;
-};
-
-#define pos_in_item(path) ((path)->pos_in_item)
-
-#define INITIALIZE_PATH(var) \
-struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
-
-/* Get path element by path and path position. */
-#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset))
-
-/* Get buffer header at the path by path and path position. */
-#define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer)
-
-/* Get position in the element at the path by path and path position. */
-#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position)
-
-
-#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length))
- /* you know, to the person who didn't
- write this the macro name does not
- at first suggest what it does.
- Maybe POSITION_FROM_PATH_END? Or
- maybe we should just focus on
- dumping paths... -Hans */
-#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length))
-
-
-#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path))
-
-/* in do_balance leaf has h == 0 in contrast with path structure,
- where root has level == 0. That is why we need these defines */
-#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */
-#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
-#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
-#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
-
-#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h))
-
-#define get_last_bh(path) PATH_PLAST_BUFFER(path)
-#define get_ih(path) PATH_PITEM_HEAD(path)
-#define get_item_pos(path) PATH_LAST_POSITION(path)
-#define get_item(path) ((void *)B_N_PITEM(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION (path)))
-#define item_moved(ih,path) comp_items(ih, path)
-#define path_changed(ih,path) comp_items (ih, path)
-
-
-/***************************************************************************/
-/* MISC */
-/***************************************************************************/
-
-/* Size of pointer to the unformatted node. */
-#define UNFM_P_SIZE (sizeof(unp_t))
-#define UNFM_P_SHIFT 2
-
-// in in-core inode key is stored on le form
-#define INODE_PKEY(inode) ((struct reiserfs_key *)(REISERFS_I(inode)->i_key))
-
-#define MAX_UL_INT 0xffffffff
-#define MAX_INT 0x7ffffff
-#define MAX_US_INT 0xffff
-
-// reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset
-#define U32_MAX (~(__u32)0)
-
-static inline loff_t max_reiserfs_offset (struct inode * inode)
-{
- if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
- return (loff_t)U32_MAX;
-
- return (loff_t)((~(__u64)0) >> 4);
-}
-
-
-/*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/
-#define MAX_KEY_OBJECTID MAX_UL_INT
-
-
-#define MAX_B_NUM MAX_UL_INT
-#define MAX_FC_NUM MAX_US_INT
-
-
-/* the purpose is to detect overflow of an unsigned short */
-#define REISERFS_LINK_MAX (MAX_US_INT - 1000)
-
-
-/* The following defines are used in reiserfs_insert_item and reiserfs_append_item */
-#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */
-#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */
-
-#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter)
-#define get_generation(s) atomic_read (&fs_generation(s))
-#define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen)
-#define __fs_changed(gen,s) (gen != get_generation (s))
-#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);})
-
-
-/***************************************************************************/
-/* FIXATE NODES */
-/***************************************************************************/
-
-#define VI_TYPE_LEFT_MERGEABLE 1
-#define VI_TYPE_RIGHT_MERGEABLE 2
-
-/* To make any changes in the tree we always first find node, that
- contains item to be changed/deleted or place to insert a new
- item. We call this node S. To do balancing we need to decide what
- we will shift to left/right neighbor, or to a new node, where new
- item will be etc. To make this analysis simpler we build virtual
- node. Virtual node is an array of items, that will replace items of
- node S. (For instance if we are going to delete an item, virtual
- node does not contain it). Virtual node keeps information about
- item sizes and types, mergeability of first and last items, sizes
- of all entries in directory item. We use this array of items when
- calculating what we can shift to neighbors and how many nodes we
- have to have if we do not any shiftings, if we shift to left/right
- neighbor or to both. */
-struct virtual_item
-{
- int vi_index; // index in the array of item operations
- unsigned short vi_type; // left/right mergeability
- unsigned short vi_item_len; /* length of item that it will have after balancing */
- struct item_head * vi_ih;
- const char * vi_item; // body of item (old or new)
- const void * vi_new_data; // 0 always but paste mode
- void * vi_uarea; // item specific area
-};
-
-
-struct virtual_node
-{
- char * vn_free_ptr; /* this is a pointer to the free space in the buffer */
- unsigned short vn_nr_item; /* number of items in virtual node */
- short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */
- short vn_mode; /* mode of balancing (paste, insert, delete, cut) */
- short vn_affected_item_num;
- short vn_pos_in_item;
- struct item_head * vn_ins_ih; /* item header of inserted item, 0 for other modes */
- const void * vn_data;
- struct virtual_item * vn_vi; /* array of items (including a new one, excluding item to be deleted) */
-};
-
-
-#ifndef __GCC__
- #pragma pack(push, 1)
-#endif
-
-/* used by directory items when creating virtual nodes */
-struct direntry_uarea {
- int flags;
- __u16 entry_count;
- __u16 entry_sizes[1];
-} __PACKED ;
-
-#ifndef __GCC__
- #pragma pack(pop)
-#endif
-
-/***************************************************************************/
-/* TREE BALANCE */
-/***************************************************************************/
-
-/* This temporary structure is used in tree balance algorithms, and
- constructed as we go to the extent that its various parts are
- needed. It contains arrays of nodes that can potentially be
- involved in the balancing of node S, and parameters that define how
- each of the nodes must be balanced. Note that in these algorithms
- for balancing the worst case is to need to balance the current node
- S and the left and right neighbors and all of their parents plus
- create a new node. We implement S1 balancing for the leaf nodes
- and S0 balancing for the internal nodes (S1 and S0 are defined in
- our papers.)*/
-
-#define MAX_FREE_BLOCK 7 /* size of the array of buffers to free at end of do_balance */
-
-/* maximum number of FEB blocknrs on a single level */
-#define MAX_AMOUNT_NEEDED 2
-
-/* someday somebody will prefix every field in this struct with tb_ */
-struct tree_balance
-{
- int tb_mode;
- int need_balance_dirty;
- struct super_block * tb_sb;
- struct reiserfs_transaction_handle *transaction_handle ;
- struct path * tb_path;
- struct buffer_head * L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */
- struct buffer_head * R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path*/
- struct buffer_head * FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */
- struct buffer_head * FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */
- struct buffer_head * CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */
- struct buffer_head * CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */
-
- struct buffer_head * FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals
- cur_blknum. */
- struct buffer_head * used[MAX_FEB_SIZE];
- struct buffer_head * thrown[MAX_FEB_SIZE];
- int lnum[MAX_HEIGHT]; /* array of number of items which must be
- shifted to the left in order to balance the
- current node; for leaves includes item that
- will be partially shifted; for internal
- nodes, it is the number of child pointers
- rather than items. It includes the new item
- being created. The code sometimes subtracts
- one to get the number of wholly shifted
- items for other purposes. */
- int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */
- int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and
- S[h] to its item number within the node CFL[h] */
- int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */
- int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from
- S[h]. A negative value means removing. */
- int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after
- balancing on the level h of the tree. If 0 then S is
- being deleted, if 1 then S is remaining and no new nodes
- are being created, if 2 or 3 then 1 or 2 new nodes is
- being created */
-
- /* fields that are used only for balancing leaves of the tree */
- int cur_blknum; /* number of empty blocks having been already allocated */
- int s0num; /* number of items that fall into left most node when S[0] splits */
- int s1num; /* number of items that fall into first new node when S[0] splits */
- int s2num; /* number of items that fall into second new node when S[0] splits */
- int lbytes; /* number of bytes which can flow to the left neighbor from the left */
- /* most liquid item that cannot be shifted from S[0] entirely */
- /* if -1 then nothing will be partially shifted */
- int rbytes; /* number of bytes which will flow to the right neighbor from the right */
- /* most liquid item that cannot be shifted from S[0] entirely */
- /* if -1 then nothing will be partially shifted */
- int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */
- /* note: if S[0] splits into 3 nodes, then items do not need to be cut */
- int s2bytes;
- struct buffer_head * buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */
- char * vn_buf; /* kmalloced memory. Used to create
- virtual node and keep map of
- dirtied bitmap blocks */
- int vn_buf_size; /* size of the vn_buf */
- struct virtual_node * tb_vn; /* VN starts after bitmap of bitmap blocks */
-
- int fs_gen; /* saved value of `reiserfs_generation' counter
- see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */
-#ifdef DISPLACE_NEW_PACKING_LOCALITIES
- struct reiserfs_key key; /* key pointer, to pass to block allocator or
- another low-level subsystem */
-#endif
-} ;
-
-/* These are modes of balancing */
-
-/* When inserting an item. */
-#define M_INSERT 'i'
-/* When inserting into (directories only) or appending onto an already
- existant item. */
-#define M_PASTE 'p'
-/* When deleting an item. */
-#define M_DELETE 'd'
-/* When truncating an item or removing an entry from a (directory) item. */
-#define M_CUT 'c'
-
-/* used when balancing on leaf level skipped (in reiserfsck) */
-#define M_INTERNAL 'n'
-
-/* When further balancing is not needed, then do_balance does not need
- to be called. */
-#define M_SKIP_BALANCING 's'
-#define M_CONVERT 'v'
-
-/* modes of leaf_move_items */
-#define LEAF_FROM_S_TO_L 0
-#define LEAF_FROM_S_TO_R 1
-#define LEAF_FROM_R_TO_L 2
-#define LEAF_FROM_L_TO_R 3
-#define LEAF_FROM_S_TO_SNEW 4
-
-#define FIRST_TO_LAST 0
-#define LAST_TO_FIRST 1
-
-/* used in do_balance for passing parent of node information that has
- been gotten from tb struct */
-struct buffer_info {
- struct tree_balance * tb;
- struct buffer_head * bi_bh;
- struct buffer_head * bi_parent;
- int bi_position;
-};
-
-
-/* there are 4 types of items: stat data, directory item, indirect, direct.
-+-------------------+------------+--------------+------------+
-| | k_offset | k_uniqueness | mergeable? |
-+-------------------+------------+--------------+------------+
-| stat data | 0 | 0 | no |
-+-------------------+------------+--------------+------------+
-| 1st directory item| DOT_OFFSET |DIRENTRY_UNIQUENESS| no |
-| non 1st directory | hash value | | yes |
-| item | | | |
-+-------------------+------------+--------------+------------+
-| indirect item | offset + 1 |TYPE_INDIRECT | if this is not the first indirect item of the object
-+-------------------+------------+--------------+------------+
-| direct item | offset + 1 |TYPE_DIRECT | if not this is not the first direct item of the object
-+-------------------+------------+--------------+------------+
-*/
-
-struct item_operations {
- int (*bytes_number) (struct item_head * ih, int block_size);
- void (*decrement_key) (struct cpu_key *);
- int (*is_left_mergeable) (struct reiserfs_key * ih, unsigned long bsize);
- void (*print_item) (struct item_head *, char * item);
- void (*check_item) (struct item_head *, char * item);
-
- int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi,
- int is_affected, int insert_size);
- int (*check_left) (struct virtual_item * vi, int free,
- int start_skip, int end_skip);
- int (*check_right) (struct virtual_item * vi, int free);
- int (*part_size) (struct virtual_item * vi, int from, int to);
- int (*unit_num) (struct virtual_item * vi);
- void (*print_vi) (struct virtual_item * vi);
-};
-
-
-extern struct item_operations * item_ops [TYPE_ANY + 1];
-
-#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)
-#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)
-#define op_print_item(ih,item) item_ops[le_ih_k_type (ih)]->print_item (ih, item)
-#define op_check_item(ih,item) item_ops[le_ih_k_type (ih)]->check_item (ih, item)
-#define op_create_vi(vn,vi,is_affected,insert_size) item_ops[le_ih_k_type ((vi)->vi_ih)]->create_vi (vn,vi,is_affected,insert_size)
-#define op_check_left(vi,free,start_skip,end_skip) item_ops[(vi)->vi_index]->check_left (vi, free, start_skip, end_skip)
-#define op_check_right(vi,free) item_ops[(vi)->vi_index]->check_right (vi, free)
-#define op_part_size(vi,from,to) item_ops[(vi)->vi_index]->part_size (vi, from, to)
-#define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi)
-#define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi)
-
-
-
-#define COMP_SHORT_KEYS comp_short_keys
-
-/* number of blocks pointed to by the indirect item */
-#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE )
-
-/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
-#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
-
-/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */
-
-
-/* get the item header */
-#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )
-
-/* get key */
-#define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key * )((bh)->b_data + BLKH_SIZE) + (item_num) )
-
-/* get the key */
-#define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) )
-
-/* get item body */
-#define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num))))
-
-/* get the stat data by the buffer header and the item order */
-#define B_N_STAT_DATA(bh,nr) \
-( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) )
-
- /* following defines use reiserfs buffer header and item header */
-
-/* get stat-data */
-#define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )((bh)->b_data + ih_location(ih)) )
-
-// this is 3976 for size==4096
-#define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE)
-
-/* indirect items consist of entries which contain blocknrs, pos
- indicates which entry, and B_I_POS_UNFM_POINTER resolves to the
- blocknr contained by the entry pos points to */
-#define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)))
-#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)
-
-struct reiserfs_iget_args {
- __u32 objectid ;
- __u32 dirid ;
-} ;
-
-/***************************************************************************/
-/* FUNCTION DECLARATIONS */
-/***************************************************************************/
-
-/*#ifdef __KERNEL__*/
-#define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
-
-#define journal_trans_half(blocksize) \
- ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32))
-
-/* journal.c see journal.c for all the comments here */
-
-/* first block written in a commit. */
-struct reiserfs_journal_desc {
- __u32 j_trans_id ; /* id of commit */
- __u32 j_len ; /* length of commit. len +1 is the commit block */
- __u32 j_mount_id ; /* mount id of this trans*/
- __u32 j_realblock[1] ; /* real locations for each block */
-} ;
-
-#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
-#define get_desc_trans_len(d) le32_to_cpu((d)->j_len)
-#define get_desc_mount_id(d) le32_to_cpu((d)->j_mount_id)
-
-#define set_desc_trans_id(d,val) do { (d)->j_trans_id = cpu_to_le32 (val); } while (0)
-#define set_desc_trans_len(d,val) do { (d)->j_len = cpu_to_le32 (val); } while (0)
-#define set_desc_mount_id(d,val) do { (d)->j_mount_id = cpu_to_le32 (val); } while (0)
-
-/* last block written in a commit */
-struct reiserfs_journal_commit {
- __u32 j_trans_id ; /* must match j_trans_id from the desc block */
- __u32 j_len ; /* ditto */
- __u32 j_realblock[1] ; /* real locations for each block */
-} ;
-
-#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
-#define get_commit_trans_len(c) le32_to_cpu((c)->j_len)
-#define get_commit_mount_id(c) le32_to_cpu((c)->j_mount_id)
-
-#define set_commit_trans_id(c,val) do { (c)->j_trans_id = cpu_to_le32 (val); } while (0)
-#define set_commit_trans_len(c,val) do { (c)->j_len = cpu_to_le32 (val); } while (0)
-
-/* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the
-** last fully flushed transaction. fully flushed means all the log blocks and all the real blocks are on disk,
-** and this transaction does not need to be replayed.
-*/
-struct reiserfs_journal_header {
- __u32 j_last_flush_trans_id ; /* id of last fully flushed transaction */
- __u32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */
- __u32 j_mount_id ;
- /* 12 */ struct journal_params jh_journal;
-} ;
-
-/* biggest tunable defines are right here */
-#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */
-#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */
-#define JOURNAL_TRANS_MIN_DEFAULT 256
-#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */
-#define JOURNAL_MIN_RATIO 2
-#define JOURNAL_MAX_COMMIT_AGE 30
-#define JOURNAL_MAX_TRANS_AGE 30
-#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
-#ifdef CONFIG_QUOTA
-#define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */
-#define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*(JOURNAL_PER_BALANCE_CNT+2)+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */
-#else
-#define REISERFS_QUOTA_TRANS_BLOCKS 0
-#define REISERFS_QUOTA_INIT_BLOCKS 0
-#endif
-
-/* both of these can be as low as 1, or as high as you want. The min is the
-** number of 4k bitmap nodes preallocated on mount. New nodes are allocated
-** as needed, and released when transactions are committed. On release, if
-** the current number of nodes is > max, the node is freed, otherwise,
-** it is put on a free list for faster use later.
-*/
-#define REISERFS_MIN_BITMAP_NODES 10
-#define REISERFS_MAX_BITMAP_NODES 100
-
-#define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */
-#define JBH_HASH_MASK 8191
-
-#define _jhashfn(sb,block) \
- (((unsigned long)sb>>L1_CACHE_SHIFT) ^ \
- (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12))))
-#define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK])
-
-// We need these to make journal.c code more readable
-#define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
-#define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
-#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
-
-enum reiserfs_bh_state_bits {
- BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */
- BH_JDirty_wait,
- BH_JNew, /* disk block was taken off free list before
- * being in a finished transaction, or
- * written to disk. Can be reused immed. */
- BH_JPrepared,
- BH_JRestore_dirty,
- BH_JTest, // debugging only will go away
-};
-
-BUFFER_FNS(JDirty, journaled);
-TAS_BUFFER_FNS(JDirty, journaled);
-BUFFER_FNS(JDirty_wait, journal_dirty);
-TAS_BUFFER_FNS(JDirty_wait, journal_dirty);
-BUFFER_FNS(JNew, journal_new);
-TAS_BUFFER_FNS(JNew, journal_new);
-BUFFER_FNS(JPrepared, journal_prepared);
-TAS_BUFFER_FNS(JPrepared, journal_prepared);
-BUFFER_FNS(JRestore_dirty, journal_restore_dirty);
-TAS_BUFFER_FNS(JRestore_dirty, journal_restore_dirty);
-BUFFER_FNS(JTest, journal_test);
-TAS_BUFFER_FNS(JTest, journal_test);
-
-/*
-** transaction handle which is passed around for all journal calls
-*/
-struct reiserfs_transaction_handle {
- struct super_block *t_super ; /* super for this FS when journal_begin was
- called. saves calls to reiserfs_get_super
- also used by nested transactions to make
- sure they are nesting on the right FS
- _must_ be first in the handle
- */
- int t_refcount;
- int t_blocks_logged ; /* number of blocks this writer has logged */
- int t_blocks_allocated ; /* number of blocks this writer allocated */
- unsigned long t_trans_id ; /* sanity check, equals the current trans id */
- void *t_handle_save ; /* save existing current->journal_info */
- unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
- should be displaced from others */
- struct list_head t_list;
-} ;
-
-/* used to keep track of ordered and tail writes, attached to the buffer
- * head through b_journal_head.
- */
-struct reiserfs_jh {
- struct reiserfs_journal_list *jl;
- struct buffer_head *bh;
- struct list_head list;
-};
-
-void reiserfs_free_jh(struct buffer_head *bh);
-int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh);
-int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh);
-int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ;
-
-static inline int
-reiserfs_file_data_log(struct inode *inode) {
- if (reiserfs_data_log(inode->i_sb) ||
- (REISERFS_I(inode)->i_flags & i_data_log))
- return 1 ;
- return 0 ;
-}
-
-static inline int reiserfs_transaction_running(struct super_block *s) {
- struct reiserfs_transaction_handle *th = current->journal_info ;
- if (th && th->t_super == s)
- return 1 ;
- if (th && th->t_super == NULL)
- BUG();
- return 0 ;
-}
-
-int reiserfs_async_progress_wait(struct super_block *s);
-
-struct reiserfs_transaction_handle *
-reiserfs_persistent_transaction(struct super_block *, int count);
-int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *);
-int reiserfs_commit_page(struct inode *inode, struct page *page,
- unsigned from, unsigned to);
-int reiserfs_flush_old_commits(struct super_block *);
-int reiserfs_commit_for_inode(struct inode *) ;
-int reiserfs_inode_needs_commit(struct inode *) ;
-void reiserfs_update_inode_transaction(struct inode *) ;
-void reiserfs_wait_on_write_block(struct super_block *s) ;
-void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ;
-void reiserfs_allow_writes(struct super_block *s) ;
-void reiserfs_check_lock_depth(struct super_block *s, char *caller) ;
-int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ;
-void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ;
-int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ;
-int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ;
-int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ;
-int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ;
-int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ;
-int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, b_blocknr_t blocknr) ;
-int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ;
-int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, int searchall, b_blocknr_t *next) ;
-int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ;
-int journal_join_abort(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ;
-void reiserfs_journal_abort (struct super_block *sb, int errno);
-void reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...);
-int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ;
-
-void add_save_link (struct reiserfs_transaction_handle * th,
- struct inode * inode, int truncate);
-int remove_save_link (struct inode * inode, int truncate);
-
-/* objectid.c */
-__u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th);
-void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, __u32 objectid_to_release);
-int reiserfs_convert_objectid_map_v1(struct super_block *) ;
-
-/* stree.c */
-int B_IS_IN_TREE(const struct buffer_head *);
-extern void copy_item_head(struct item_head * p_v_to,
- const struct item_head * p_v_from);
-
-// first key is in cpu form, second - le
-extern int comp_short_keys (const struct reiserfs_key * le_key,
- const struct cpu_key * cpu_key);
-extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from);
-
-// both are in le form
-extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *);
-extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *);
-
-//
-// get key version from on disk key - kludge
-//
-static inline int le_key_version (const struct reiserfs_key * key)
-{
- int type;
-
- type = offset_v2_k_type( &(key->u.k_offset_v2));
- if (type != TYPE_DIRECT && type != TYPE_INDIRECT && type != TYPE_DIRENTRY)
- return KEY_FORMAT_3_5;
-
- return KEY_FORMAT_3_6;
-
-}
-
-
-static inline void copy_key (struct reiserfs_key *to, const struct reiserfs_key *from)
-{
- memcpy (to, from, KEY_SIZE);
-}
-
-
-int comp_items (const struct item_head * stored_ih, const struct path * p_s_path);
-const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path,
- const struct super_block * p_s_sb);
-int search_by_key (struct super_block *, const struct cpu_key *,
- struct path *, int);
-#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
-int search_for_position_by_key (struct super_block * p_s_sb,
- const struct cpu_key * p_s_cpu_key,
- struct path * p_s_search_path);
-extern void decrement_bcount (struct buffer_head * p_s_bh);
-void decrement_counters_in_path (struct path * p_s_search_path);
-void pathrelse (struct path * p_s_search_path);
-int reiserfs_check_path(struct path *p) ;
-void pathrelse_and_restore (struct super_block *s, struct path * p_s_search_path);
-
-int reiserfs_insert_item (struct reiserfs_transaction_handle *th,
- struct path * path,
- const struct cpu_key * key,
- struct item_head * ih,
- struct inode *inode, const char * body);
-
-int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th,
- struct path * path,
- const struct cpu_key * key,
- struct inode *inode,
- const char * body, int paste_size);
-
-int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th,
- struct path * path,
- struct cpu_key * key,
- struct inode * inode,
- struct page *page,
- loff_t new_file_size);
-
-int reiserfs_delete_item (struct reiserfs_transaction_handle *th,
- struct path * path,
- const struct cpu_key * key,
- struct inode * inode,
- struct buffer_head * p_s_un_bh);
-
-void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th,
- struct inode *inode, struct reiserfs_key * key);
-int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode * p_s_inode);
-int reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
- struct inode * p_s_inode, struct page *,
- int update_timestamps);
-
-#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
-#define file_size(inode) ((inode)->i_size)
-#define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1))
-
-#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\
-!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 )
-
-void padd_item (char * item, int total_length, int length);
-
-/* inode.c */
-/* args for the create parameter of reiserfs_get_block */
-#define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */
-#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
-#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
-#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
-#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */
-#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
-
-int restart_transaction(struct reiserfs_transaction_handle *th, struct inode *inode, struct path *path);
-void reiserfs_read_locked_inode(struct inode * inode, struct reiserfs_iget_args *args) ;
-int reiserfs_find_actor(struct inode * inode, void *p) ;
-int reiserfs_init_locked_inode(struct inode * inode, void *p) ;
-void reiserfs_delete_inode (struct inode * inode);
-int reiserfs_write_inode (struct inode * inode, int) ;
-int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create);
-struct dentry *reiserfs_get_dentry(struct super_block *, void *) ;
-struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data,
- int len, int fhtype,
- int (*acceptable)(void *contect, struct dentry *de),
- void *context) ;
-int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp,
- int connectable );
-
-int reiserfs_truncate_file(struct inode *, int update_timestamps) ;
-void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset,
- int type, int key_length);
-void make_le_item_head (struct item_head * ih, const struct cpu_key * key,
- int version,
- loff_t offset, int type, int length, int entry_count);
-struct inode * reiserfs_iget (struct super_block * s,
- const struct cpu_key * key);
-
-
-int reiserfs_new_inode (struct reiserfs_transaction_handle *th,
- struct inode * dir, int mode,
- const char * symname, loff_t i_size,
- struct dentry *dentry, struct inode *inode);
-
-void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th,
- struct inode * inode, loff_t size);
-
-static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th,
- struct inode *inode)
-{
- reiserfs_update_sd_size(th, inode, inode->i_size) ;
-}
-
-void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode );
-void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs );
-int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
-
-/* namei.c */
-void set_de_name_and_namelen (struct reiserfs_dir_entry * de);
-int search_by_entry_key (struct super_block * sb, const struct cpu_key * key,
- struct path * path,
- struct reiserfs_dir_entry * de);
-struct dentry *reiserfs_get_parent(struct dentry *) ;
-/* procfs.c */
-
-#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
-#define REISERFS_PROC_INFO
-#else
-#undef REISERFS_PROC_INFO
-#endif
-
-int reiserfs_proc_info_init( struct super_block *sb );
-int reiserfs_proc_info_done( struct super_block *sb );
-struct proc_dir_entry *reiserfs_proc_register_global( char *name,
- read_proc_t *func );
-void reiserfs_proc_unregister_global( const char *name );
-int reiserfs_proc_info_global_init( void );
-int reiserfs_proc_info_global_done( void );
-int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset,
- int count, int *eof, void *data );
-
-#if defined( REISERFS_PROC_INFO )
-
-#define PROC_EXP( e ) e
-
-#define __PINFO( sb ) REISERFS_SB(sb) -> s_proc_info_data
-#define PROC_INFO_MAX( sb, field, value ) \
- __PINFO( sb ).field = \
- max( REISERFS_SB( sb ) -> s_proc_info_data.field, value )
-#define PROC_INFO_INC( sb, field ) ( ++ ( __PINFO( sb ).field ) )
-#define PROC_INFO_ADD( sb, field, val ) ( __PINFO( sb ).field += ( val ) )
-#define PROC_INFO_BH_STAT( sb, bh, level ) \
- PROC_INFO_INC( sb, sbk_read_at[ ( level ) ] ); \
- PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \
- PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) )
-#else
-#define PROC_EXP( e )
-#define VOID_V ( ( void ) 0 )
-#define PROC_INFO_MAX( sb, field, value ) VOID_V
-#define PROC_INFO_INC( sb, field ) VOID_V
-#define PROC_INFO_ADD( sb, field, val ) VOID_V
-#define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V
-#endif
-
-/* dir.c */
-extern struct inode_operations reiserfs_dir_inode_operations;
-extern struct inode_operations reiserfs_symlink_inode_operations;
-extern struct inode_operations reiserfs_special_inode_operations;
-extern struct file_operations reiserfs_dir_operations;
-
-/* tail_conversion.c */
-int direct2indirect (struct reiserfs_transaction_handle *, struct inode *, struct path *, struct buffer_head *, loff_t);
-int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, const struct cpu_key *, loff_t, char *);
-void reiserfs_unmap_buffer(struct buffer_head *) ;
-
-
-/* file.c */
-extern struct inode_operations reiserfs_file_inode_operations;
-extern struct file_operations reiserfs_file_operations;
-extern struct address_space_operations reiserfs_address_space_operations ;
-
-/* fix_nodes.c */
-#ifdef CONFIG_REISERFS_CHECK
-void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s);
-void reiserfs_kfree (const void * vp, size_t size, struct super_block * s);
-#else
-static inline void *reiserfs_kmalloc(size_t size, int flags,
- struct super_block *s)
-{
- return kmalloc(size, flags);
-}
-
-static inline void reiserfs_kfree(const void *vp, size_t size,
- struct super_block *s)
-{
- kfree(vp);
-}
-#endif
-
-int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb,
- struct item_head * p_s_ins_ih, const void *);
-void unfix_nodes (struct tree_balance *);
-
-
-/* prints.c */
-void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) );
-void reiserfs_info (struct super_block *s, const char * fmt, ...);
-void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...);
-void print_indirect_item (struct buffer_head * bh, int item_num);
-void store_print_tb (struct tree_balance * tb);
-void print_cur_tb (char * mes);
-void print_de (struct reiserfs_dir_entry * de);
-void print_bi (struct buffer_info * bi, char * mes);
-#define PRINT_LEAF_ITEMS 1 /* print all items */
-#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */
-#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */
-void print_block (struct buffer_head * bh, ...);
-void print_bmap (struct super_block * s, int silent);
-void print_bmap_block (int i, char * data, int size, int silent);
-/*void print_super_block (struct super_block * s, char * mes);*/
-void print_objectid_map (struct super_block * s);
-void print_block_head (struct buffer_head * bh, char * mes);
-void check_leaf (struct buffer_head * bh);
-void check_internal (struct buffer_head * bh);
-void print_statistics (struct super_block * s);
-char * reiserfs_hashname(int code);
-
-/* lbalance.c */
-int leaf_move_items (int shift_mode, struct tree_balance * tb, int mov_num, int mov_bytes, struct buffer_head * Snew);
-int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes);
-int leaf_shift_right (struct tree_balance * tb, int shift_num, int shift_bytes);
-void leaf_delete_items (struct buffer_info * cur_bi, int last_first, int first, int del_num, int del_bytes);
-void leaf_insert_into_buf (struct buffer_info * bi, int before,
- struct item_head * inserted_item_ih, const char * inserted_item_body, int zeros_number);
-void leaf_paste_in_buffer (struct buffer_info * bi, int pasted_item_num,
- int pos_in_item, int paste_size, const char * body, int zeros_number);
-void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num, int pos_in_item,
- int cut_size);
-void leaf_paste_entries (struct buffer_head * bh, int item_num, int before,
... 79258 lines suppressed ...