Fix btrfs_shell build
The hacks to still use actual system headers for zlib didn't quite work. - Define Z_SOLO, which makes zlib build without any system include - Remove use of std::max and #include <algorithm> from AVLTree - Do not include DebugSupport.h because it uses system headers - Do not include uuid.h and define just what we need Now it's possible to compile the btrfs_shell on Linux. Change-Id: I74a14b5f6804db45ab5a9f582ab493d696376fd3 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2098 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
7b4d924f98
commit
c5e9dd9b68
@@ -9,7 +9,6 @@
|
||||
#ifndef FS_SHELL
|
||||
# include <SupportDefs.h>
|
||||
#else
|
||||
# include <algorithm>
|
||||
# include "fssh_api_wrapper.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "BTree.h"
|
||||
#include "Journal.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
//#define TRACE_BTRFS
|
||||
#ifdef TRACE_BTRFS
|
||||
|
||||
@@ -6,10 +6,17 @@
|
||||
#define EXTENT_ALLOCATOR_H
|
||||
|
||||
|
||||
#include "Volume.h"
|
||||
#include "BTree.h"
|
||||
#include "Volume.h"
|
||||
|
||||
#include "system_dependencies.h"
|
||||
|
||||
|
||||
#ifdef FS_SHELL
|
||||
#define ERROR(x...) TRACE(x)
|
||||
#else
|
||||
#include <DebugSupport.h>
|
||||
#endif
|
||||
|
||||
|
||||
//#define TRACE_BTRFS
|
||||
|
||||
@@ -16,12 +16,16 @@
|
||||
#include "CachedBlock.h"
|
||||
#include "Chunk.h"
|
||||
#include "CRCTable.h"
|
||||
#include "DebugSupport.h"
|
||||
#include "ExtentAllocator.h"
|
||||
#include "Inode.h"
|
||||
#include "Journal.h"
|
||||
#include "Utility.h"
|
||||
|
||||
#ifdef FS_SHELL
|
||||
#define RETURN_ERROR return
|
||||
#else
|
||||
#include "DebugSupport.h"
|
||||
#endif
|
||||
|
||||
//#define TRACE_BTRFS
|
||||
#ifdef TRACE_BTRFS
|
||||
|
||||
@@ -12,12 +12,22 @@
|
||||
#include "AttributeIterator.h"
|
||||
#include "btrfs.h"
|
||||
#include "btrfs_disk_system.h"
|
||||
#include "DebugSupport.h"
|
||||
#include "DirectoryIterator.h"
|
||||
#include "Inode.h"
|
||||
#include "system_dependencies.h"
|
||||
#include "Utility.h"
|
||||
|
||||
|
||||
#ifdef FS_SHELL
|
||||
#define ERROR(x...) TRACE(x)
|
||||
#define INFORM(x...) TRACE(x)
|
||||
#define init_debugging()
|
||||
#define exit_debugging()
|
||||
#else
|
||||
#include <DebugSupport.h>
|
||||
#endif
|
||||
|
||||
|
||||
//#define TRACE_BTRFS
|
||||
#ifdef TRACE_BTRFS
|
||||
# define TRACE(x...) dprintf("\33[34mbtrfs:\33[0m " x)
|
||||
@@ -928,7 +938,7 @@ btrfs_initialize(int fd, partition_id partitionID, const char* name,
|
||||
if (parameters.verbose) {
|
||||
btrfs_super_block super = volume.SuperBlock();
|
||||
|
||||
INFORM(("Disk was initialized successfully.\n"));
|
||||
INFORM("Disk was initialized successfully.\n");
|
||||
INFORM("\tlabel: \"%s\"\n", super.label);
|
||||
INFORM("\tblock size: %u bytes\n", (unsigned)super.BlockSize());
|
||||
INFORM("\tsector size: %u bytes\n", (unsigned)super.SectorSize());
|
||||
|
||||
@@ -8,15 +8,23 @@
|
||||
|
||||
#ifdef FS_SHELL
|
||||
|
||||
// This needs to be included before the fs_shell wrapper
|
||||
#include <zlib.h>
|
||||
|
||||
#include <util/AVLTree.h>
|
||||
#include <uuid.h>
|
||||
|
||||
#include "fssh_api_wrapper.h"
|
||||
#include "fssh_auto_deleter.h"
|
||||
|
||||
#include <util/AVLTree.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef unsigned char uuid_t[16];
|
||||
|
||||
void uuid_generate(uuid_t out);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#else // !FS_SHELL
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
@@ -629,5 +629,5 @@ AVLTreeBase::_CheckTree(AVLTreeNode* parent, AVLTreeNode* node,
|
||||
}
|
||||
|
||||
_nodeCount = leftNodeCount + rightNodeCount + 1;
|
||||
return std::max(leftDepth, rightDepth) + 1;
|
||||
return max_c(leftDepth, rightDepth) + 1;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ DEFINES += HAIKU_BUILD_COMPATIBILITY_H ;
|
||||
{
|
||||
local defines =
|
||||
FS_SHELL
|
||||
Z_SOLO # prevent inclusion of system headers from zlib.h
|
||||
TRACE_BTRFS # ENABLE DEBUGGING
|
||||
USER=1
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user