From e75bed97075edaa1cca648f58f79d8764a3c13b8 Mon Sep 17 00:00:00 2001 From: Tyler Dauwalder Date: Mon, 28 Apr 2003 22:45:11 +0000 Subject: [PATCH] Initial checkin. Inherited from bfs, then stripped bfs specific stuff. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3111 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/udf/Debug.cpp | 18 ++++ src/add-ons/kernel/file_systems/udf/Debug.h | 101 ++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 src/add-ons/kernel/file_systems/udf/Debug.cpp create mode 100644 src/add-ons/kernel/file_systems/udf/Debug.h diff --git a/src/add-ons/kernel/file_systems/udf/Debug.cpp b/src/add-ons/kernel/file_systems/udf/Debug.cpp new file mode 100644 index 0000000000..4ac3f5f3a2 --- /dev/null +++ b/src/add-ons/kernel/file_systems/udf/Debug.cpp @@ -0,0 +1,18 @@ +/* Debug - debug stuff +** +** UDF modifications by Tyler Dauwalder, tyler@dauwalder.net +** Initial version by Axel Dörfler, axeld@pinc-software.de +** Some code is based on work previously done by Marcus Overhagen +** +** This file may be used under the terms of the OpenBeOS License. +*/ + +#include "Debug.h" +//#include "BPlusTree.h" + +#include + +#include + +#define Print __out + diff --git a/src/add-ons/kernel/file_systems/udf/Debug.h b/src/add-ons/kernel/file_systems/udf/Debug.h new file mode 100644 index 0000000000..bf1d8f9fcc --- /dev/null +++ b/src/add-ons/kernel/file_systems/udf/Debug.h @@ -0,0 +1,101 @@ +#ifndef DEBUG_H +#define DEBUG_H +/* Debug - debug stuff +** +** UDF modifications by Tyler Dauwalder, tyler@dauwalder.net +** Initial version by Axel Dörfler, axeld@pinc-software.de +** This file may be used under the terms of the OpenBeOS License. +*/ + +#include + +#ifdef DEBUG +# include +#endif + +#ifdef USER +# include +# define __out printf +#else +# include +# define __out dprintf +#endif + +// Which debugger should be used when? +// The DEBUGGER() macro actually has no effect if DEBUG is not defined, +// use the DIE() macro if you really want to die. +#ifdef DEBUG +# ifdef USER +# define DEBUGGER(x) debugger x +# else +# define DEBUGGER(x) kernel_debugger x +# endif +#else +# define DEBUGGER(x) ; +#endif + +#ifdef USER +# define DIE(x) debugger x +#else +# define DIE(x) kernel_debugger x +#endif + +// Short overview over the debug output macros: +// PRINT() +// is for general messages that very unlikely should appear in a release build +// FATAL() +// this is for fatal messages, when something has really gone wrong +// INFORM() +// general information, as disk size, etc. +// REPORT_ERROR(status_t) +// prints out error information +// RETURN_ERROR(status_t) +// calls REPORT_ERROR() and return the value +// D() +// the statements in D() are only included if DEBUG is defined + +#ifdef DEBUG + #define PRINT(x) { __out("udf: "); __out x; } + #define REPORT_ERROR(status) \ + __out("udf: %s:%d: %s\n", __FUNCTION__, __LINE__, strerror(status)); + #define RETURN_ERROR(err) { status_t _status = err; if (_status < B_OK) REPORT_ERROR(_status); return _status;} + #define FATAL(x) { __out("udf: "); __out x; } + #define INFORM(x) { __out("udf: "); __out x; } + #define FUNCTION() __out("udf: %s()\n",__FUNCTION__); + #define FUNCTION_START(x) { __out("udf: %s() ",__FUNCTION__); __out x; } +// #define FUNCTION() ; +// #define FUNCTION_START(x) ; + #define D(x) {x;}; + #define ASSERT(x) { if (!(x)) DEBUGGER(("udf: assert failed: " #x "\n")); } +#else + #define PRINT(x) ; + #define REPORT_ERROR(status) ; + #define RETURN_ERROR(status) return status; + #define FATAL(x) { __out("udf: "); __out x; } + #define INFORM(x) { __out("udf: "); __out x; } + #define FUNCTION() ; + #define FUNCTION_START(x) ; + #define D(x) ; + #define ASSERT(x) ; +#endif + +#ifdef DEBUG +// struct block_run; +// struct bplustree_header; +// struct bplustree_node; +// struct data_stream; +// struct udf_inode; +// struct disk_super_block; +// class Volume; + + // some structure dump functions +// extern void dump_block_run(const char *prefix, block_run &run); +// extern void dump_super_block(disk_super_block *superBlock); +// extern void dump_data_stream(data_stream *stream); +// extern void dump_inode(bfs_inode *inode); +// extern void dump_bplustree_header(bplustree_header *header); +// extern void dump_bplustree_node(bplustree_node *node,bplustree_header *header = NULL,Volume *volume = NULL); +// extern void dump_block(const char *buffer, int size); +#endif + +#endif /* DEBUG_H */