btrfs_shell for testing btrfs code.
* Adding Jamfile in src/tools/btrfs_shell and include the subdir in src/tools/Jamfile * Adding system_dependencies.h in btrfs source to include all the system headers * fs_shell wrapping for btrfs source. If FS_SHELL is defined, compile with fs_shell headers instead. * Change macro BTRFS_SHELL to FS_SHELL * Adding btrfs_std_ops function: fs_shell now can recognize and load module
This commit is contained in:
@@ -9,11 +9,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Attribute.h"
|
#include "Attribute.h"
|
||||||
|
|
||||||
#include <new>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "BPlusTree.h"
|
#include "BPlusTree.h"
|
||||||
#include "CRCTable.h"
|
#include "CRCTable.h"
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
#include "AttributeIterator.h"
|
#include "AttributeIterator.h"
|
||||||
|
|
||||||
#include <new>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_BTRFS
|
//#define TRACE_BTRFS
|
||||||
#ifdef TRACE_BTRFS
|
#ifdef TRACE_BTRFS
|
||||||
|
|||||||
@@ -9,13 +9,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "BPlusTree.h"
|
#include "BPlusTree.h"
|
||||||
|
|
||||||
#include "CachedBlock.h"
|
#include "CachedBlock.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <util/AutoLock.h>
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_BTRFS
|
//#define TRACE_BTRFS
|
||||||
#ifdef TRACE_BTRFS
|
#ifdef TRACE_BTRFS
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "btrfs.h"
|
#include "btrfs.h"
|
||||||
|
|
||||||
#include <util/SinglyLinkedList.h>
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include "system_dependencies.h"
|
||||||
|
|
||||||
|
|
||||||
//! CRC 03667067501 table, as generated by crc_table.cpp
|
//! CRC 03667067501 table, as generated by crc_table.cpp
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
//! interface for the block cache
|
//! interface for the block cache
|
||||||
|
|
||||||
#include <fs_cache.h>
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,6 @@
|
|||||||
|
|
||||||
#include "Chunk.h"
|
#include "Chunk.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_BTRFS
|
//#define TRACE_BTRFS
|
||||||
#ifdef TRACE_BTRFS
|
#ifdef TRACE_BTRFS
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "DirectoryIterator.h"
|
#include "DirectoryIterator.h"
|
||||||
|
|
||||||
#include <new>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "CRCTable.h"
|
#include "CRCTable.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Inode.h"
|
#include "Inode.h"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#include "BPlusTree.h"
|
#include "BPlusTree.h"
|
||||||
#include "CachedBlock.h"
|
#include "CachedBlock.h"
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
|
|||||||
@@ -7,10 +7,6 @@
|
|||||||
#define INODE_H
|
#define INODE_H
|
||||||
|
|
||||||
|
|
||||||
#include <fs_cache.h>
|
|
||||||
#include <lock.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "btrfs.h"
|
#include "btrfs.h"
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
|
||||||
|
|||||||
@@ -9,18 +9,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <new>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <fs_cache.h>
|
|
||||||
#include <fs_volume.h>
|
|
||||||
|
|
||||||
#include <util/AutoLock.h>
|
|
||||||
|
|
||||||
#include "BPlusTree.h"
|
#include "BPlusTree.h"
|
||||||
#include "CachedBlock.h"
|
#include "CachedBlock.h"
|
||||||
#include "Chunk.h"
|
#include "Chunk.h"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#ifndef VOLUME_H
|
#ifndef VOLUME_H
|
||||||
#define VOLUME_H
|
#define VOLUME_H
|
||||||
|
|
||||||
#include <lock.h>
|
|
||||||
|
|
||||||
#include "btrfs.h"
|
#include "btrfs.h"
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,7 @@
|
|||||||
#define BTRFS_H
|
#define BTRFS_H
|
||||||
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include "system_dependencies.h"
|
||||||
|
|
||||||
#include <ByteOrder.h>
|
|
||||||
#include <fs_interface.h>
|
|
||||||
#include <KernelExport.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef uint64 fileblock_t; // file block number
|
typedef uint64 fileblock_t; // file block number
|
||||||
|
|||||||
@@ -17,8 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "system_dependencies.h"
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned int uint32 ;
|
typedef unsigned int uint32 ;
|
||||||
|
|||||||
@@ -5,17 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <util/kernel_cpp.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <AutoDeleter.h>
|
|
||||||
#include <fs_cache.h>
|
|
||||||
#include <fs_info.h>
|
|
||||||
#include <io_requests.h>
|
|
||||||
#include <NodeMonitor.h>
|
|
||||||
#include <util/AutoLock.h>
|
|
||||||
|
|
||||||
#include "Attribute.h"
|
#include "Attribute.h"
|
||||||
#include "AttributeIterator.h"
|
#include "AttributeIterator.h"
|
||||||
#include "btrfs.h"
|
#include "btrfs.h"
|
||||||
@@ -266,7 +255,7 @@ btrfs_io(fs_volume* _volume, fs_vnode* _node, void* _cookie, io_request* request
|
|||||||
Volume* volume = (Volume*)_volume->private_volume;
|
Volume* volume = (Volume*)_volume->private_volume;
|
||||||
Inode* inode = (Inode*)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
|
|
||||||
#ifndef BTRFS_SHELL
|
#ifndef FS_SHELL
|
||||||
if (io_request_is_write(request) && volume->IsReadOnly()) {
|
if (io_request_is_write(request) && volume->IsReadOnly()) {
|
||||||
notify_io_request(request, B_READ_ONLY_DEVICE);
|
notify_io_request(request, B_READ_ONLY_DEVICE);
|
||||||
return B_READ_ONLY_DEVICE;
|
return B_READ_ONLY_DEVICE;
|
||||||
@@ -274,7 +263,7 @@ btrfs_io(fs_volume* _volume, fs_vnode* _node, void* _cookie, io_request* request
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (inode->FileCache() == NULL) {
|
if (inode->FileCache() == NULL) {
|
||||||
#ifndef BTRFS_SHELL
|
#ifndef FS_SHELL
|
||||||
notify_io_request(request, B_BAD_VALUE);
|
notify_io_request(request, B_BAD_VALUE);
|
||||||
#endif
|
#endif
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -752,6 +741,23 @@ btrfs_remove_attr(fs_volume* _volume, fs_vnode* vnode,
|
|||||||
return EROFS;
|
return EROFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
btrfs_std_ops(int32 op, ...)
|
||||||
|
{
|
||||||
|
switch (op) {
|
||||||
|
case B_MODULE_INIT:
|
||||||
|
return B_OK;
|
||||||
|
case B_MODULE_UNINIT:
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fs_volume_ops gBtrfsVolumeOps = {
|
fs_volume_ops gBtrfsVolumeOps = {
|
||||||
&btrfs_unmount,
|
&btrfs_unmount,
|
||||||
@@ -839,7 +845,7 @@ static file_system_module_info sBtrfsFileSystem = {
|
|||||||
{
|
{
|
||||||
"file_systems/btrfs" B_CURRENT_FS_API_VERSION,
|
"file_systems/btrfs" B_CURRENT_FS_API_VERSION,
|
||||||
0,
|
0,
|
||||||
NULL,
|
btrfs_std_ops,
|
||||||
},
|
},
|
||||||
|
|
||||||
"btrfs", // short_name
|
"btrfs", // short_name
|
||||||
@@ -854,7 +860,28 @@ static file_system_module_info sBtrfsFileSystem = {
|
|||||||
|
|
||||||
&btrfs_mount,
|
&btrfs_mount,
|
||||||
|
|
||||||
|
|
||||||
|
/* capability querying operations */
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
|
NULL, // validate_resize
|
||||||
|
NULL, // validate_move
|
||||||
|
NULL, // validate_set_content_name
|
||||||
|
NULL, // validate_set_content_parameters
|
||||||
|
NULL, // validate_initialize,
|
||||||
|
|
||||||
|
/* shadow partition modification */
|
||||||
|
NULL, // shadow_changed
|
||||||
|
|
||||||
|
/* writing */
|
||||||
|
NULL, // defragment
|
||||||
|
NULL, // repair
|
||||||
|
NULL, // resize
|
||||||
|
NULL, // move
|
||||||
|
NULL, // set_content_name
|
||||||
|
NULL, // set_content_parameters
|
||||||
|
NULL, // initialize
|
||||||
|
NULL // unitialize
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#ifndef _SYSTEM_DEPENDENCIES_H
|
||||||
|
#define _SYSTEM_DEPENDENCIES_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FS_SHELL
|
||||||
|
|
||||||
|
// This needs to be included before the fs_shell wrapper
|
||||||
|
#include <zlib.h>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
#include "fssh_api_wrapper.h"
|
||||||
|
#include "fssh_auto_deleter.h"
|
||||||
|
|
||||||
|
#else // !FS_SHELL
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
#include <util/kernel_cpp.h>
|
||||||
|
#include <util/AutoLock.h>
|
||||||
|
#include <util/SinglyLinkedList.h>
|
||||||
|
#include <util/Stack.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <ByteOrder.h>
|
||||||
|
#include <fs_cache.h>
|
||||||
|
#include <fs_interface.h>
|
||||||
|
#include <fs_info.h>
|
||||||
|
#include <fs_volume.h>
|
||||||
|
#include <KernelExport.h>
|
||||||
|
#include <io_requests.h>
|
||||||
|
#include <NodeMonitor.h>
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
#include <lock.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <new>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
|
#endif // !FS_SHELL
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _SYSTEM_DEPENDENCIES
|
||||||
@@ -88,6 +88,7 @@ SEARCH on [ FGristFiles
|
|||||||
SubInclude HAIKU_TOP src tools addattr ;
|
SubInclude HAIKU_TOP src tools addattr ;
|
||||||
SubInclude HAIKU_TOP src tools anyboot ;
|
SubInclude HAIKU_TOP src tools anyboot ;
|
||||||
SubInclude HAIKU_TOP src tools bfs_shell ;
|
SubInclude HAIKU_TOP src tools bfs_shell ;
|
||||||
|
SubInclude HAIKU_TOP src tools btrfs_shell ;
|
||||||
SubInclude HAIKU_TOP src tools cppunit ;
|
SubInclude HAIKU_TOP src tools cppunit ;
|
||||||
SubInclude HAIKU_TOP src tools create_repository_config ;
|
SubInclude HAIKU_TOP src tools create_repository_config ;
|
||||||
SubInclude HAIKU_TOP src tools elfsymbolpatcher ;
|
SubInclude HAIKU_TOP src tools elfsymbolpatcher ;
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
SubDir HAIKU_TOP src tools btrfs_shell ;
|
||||||
|
|
||||||
|
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems btrfs ] ;
|
||||||
|
|
||||||
|
# prevent inclusion of HaikuBuildCompatibility.h
|
||||||
|
DEFINES += HAIKU_BUILD_COMPATIBILITY_H ;
|
||||||
|
|
||||||
|
# set some additional defines
|
||||||
|
{
|
||||||
|
local defines =
|
||||||
|
#BTRFS_BIG_ENDIAN_ONLY
|
||||||
|
FS_SHELL
|
||||||
|
TRACE_BTRFS # ENABLE DEBUGGING
|
||||||
|
;
|
||||||
|
|
||||||
|
defines = [ FDefines $(defines) ] ;
|
||||||
|
SubDirCcFlags $(defines) -Wno-multichar ;
|
||||||
|
SubDirC++Flags $(defines) -Wno-multichar -fno-rtti ;
|
||||||
|
HOST_LINKFLAGS += -lz ; # zlib link
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# platform specific libraries
|
||||||
|
local fsShellCommandLibs ;
|
||||||
|
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||||
|
fsShellCommandLibs = $(HOST_NETWORK_LIBS) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||||
|
UseHeaders [ FDirName $(HAIKU_TOP) headers build os ] : true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
UsePrivateHeaders shared storage fs_shell ;
|
||||||
|
UseHeaders [ FDirName $(HAIKU_TOP) headers private ] : true ;
|
||||||
|
UseHeaders [ FDirName $(HAIKU_TOP) src tools fs_shell ] ;
|
||||||
|
|
||||||
|
local btrfsSources =
|
||||||
|
Attribute.cpp
|
||||||
|
AttributeIterator.cpp
|
||||||
|
BPlusTree.cpp
|
||||||
|
Chunk.cpp
|
||||||
|
CRCTable.cpp
|
||||||
|
DirectoryIterator.cpp
|
||||||
|
Inode.cpp
|
||||||
|
Volume.cpp
|
||||||
|
kernel_interface.cpp
|
||||||
|
;
|
||||||
|
|
||||||
|
BuildPlatformMergeObject <build>btrfs.o : $(btrfsSources) ;
|
||||||
|
|
||||||
|
BuildPlatformMain <build>btrfs_shell
|
||||||
|
:
|
||||||
|
:
|
||||||
|
<build>btrfs.o
|
||||||
|
<build>fs_shell.a $(libHaikuCompat) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++)
|
||||||
|
$(HOST_LIBROOT) $(fsShellCommandLibs)
|
||||||
|
;
|
||||||
Reference in New Issue
Block a user