DiskTool - Fixing build errors from recent kernel changes
[tpg/acess2.git] / Tools / DiskTool / src / include / acess.h
index deb1834..6b74dfc 100644 (file)
 #define STR(x) #x
 #define EXPAND_STR(x) STR(x)
 
+#define ASSERT(x)      do{}while(0)
+
 extern char    __buildnum[];
 #define BUILD_NUM      ((int)(Uint)&__buildnum)
 extern const char gsGitHash[];
+extern const char gsBuildInfo[];
 
 #define BITS   32
 #define NULL   ((void*)0)
 #include <stdint.h>
 
 typedef uintptr_t      Uint;
-typedef unsigned int   size_t;
+//typedef unsigned int size_t;
+#include <stddef.h>
 typedef uint64_t       off_t;
 typedef char   BOOL;
 
@@ -49,6 +53,9 @@ typedef char  tMutex;
 typedef char   tShortSpinlock;
 
 typedef int64_t        tTime;
+extern tTime   now(void);
+extern int64_t timestamp(int sec, int min, int hr, int day, int month, int year);
+extern void    format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms);
 
 #define PACKED __attribute__((packed))
 #define DEPRECATED
@@ -64,7 +71,6 @@ extern void   *realloc(void *oldptr, size_t bytes);
 extern void    free(void *buffer);
 
 #include <errno.h>
-
 #include <acess_logging.h>
 
 // Threads
@@ -78,24 +84,48 @@ extern tGID Threads_GetGID(void);
 // Kinda hacky way of not colliding with native errno
 #define errno  (*(Threads_GetErrno()))
 
+/**
+ * \name Endianness Swapping
+ * \{
+ */
+#ifdef __BIG_ENDIAN__
+#define        LittleEndian16(_val)    SwapEndian16(_val)
+#define        LittleEndian32(_val)    SwapEndian32(_val)
+#define        LittleEndian64(_val)    SwapEndian32(_val)
+#define        BigEndian16(_val)       (_val)
+#define        BigEndian32(_val)       (_val)
+#define        BigEndian64(_val)       (_val)
+#else
+#define        LittleEndian16(_val)    (_val)
+#define        LittleEndian32(_val)    (_val)
+#define        LittleEndian64(_val)    (_val)
+#define        BigEndian16(_val)       SwapEndian16(_val)
+#define        BigEndian32(_val)       SwapEndian32(_val)
+#define        BigEndian64(_val)       SwapEndian64(_val)
+#endif
+extern Uint16  SwapEndian16(Uint16 Val);
+extern Uint32  SwapEndian32(Uint32 Val);
+extern Uint64  SwapEndian64(Uint64 Val);
+/**
+ * \}
+ */
+
+
 #include <string.h>
+extern int     strucmp(const char *s1, const char *s2);
 extern int     strpos(const char *Str, char Ch);
 extern void    itoa(char *buf, uint64_t num, int base, int minLength, char pad);
+extern int     snprintf(char *buf, size_t len, const char *fmt, ...);
+extern int     sprintf(char *buf, const char *fmt, ...);
+extern int     ReadUTF8(const Uint8 *str, Uint32 *Val);
+extern int     WriteUTF8(Uint8 *str, Uint32 Val);
+#define CheckString(str)       (1)
+#define CheckMem(mem,sz)       (1)
+#include <ctype.h>
 
 // TODO: Move out?
-extern int64_t DivUp(int64_t value, int64_t divisor);
-
-#if DEBUG
-# define ENTER(str, v...)      Log("%s:%i: ENTER "str, __func__, __LINE__)
-# define LOG(fmt, v...)        Log("%s:%i: "fmt, __func__, __LINE__, ##v)
-# define LEAVE(...)    do{}while(0)
-# define LEAVE_RET(t,v)        return v;
-#else
-# define ENTER(...)    do{}while(0)
-# define LOG(...)      do{}while(0)
-# define LEAVE(...)    do{}while(0)
-# define LEAVE_RET(t,v)        return v;
-#endif
+extern int     DivUp(int value, int divisor);
+extern uint64_t        DivMod64U(uint64_t Num, uint64_t Den, uint64_t *Rem);
 
 static inline int Mutex_Acquire(tMutex *m) {
        if(*m)  Log_KernelPanic("---", "Double mutex lock");

UCC git Repository :: git.ucc.asn.au