1/* 2 Copyright 1999-2001, Be Incorporated. All Rights Reserved. 3 This file may be used under the terms of the Be Sample Code License. 4*/ 5#ifndef _DOSFS_UTIL_H_ 6#define _DOSFS_UTIL_H_ 7 8 9#include <ByteOrder.h> 10 11 12// debugging functions 13#ifndef ASSERT 14#ifndef DEBUG 15#define ASSERT(c) ((void)0) 16#else 17int _assert_(char *,int,char *); 18#define ASSERT(c) (!(c) ? _assert_(__FILE__,__LINE__,#c) : 0) 19#endif 20#endif 21 22void dump_bytes(uint8 *buffer, uint32 count); 23void dump_directory(uint8 *buffer); 24 25// time 26time_t dos2time_t(uint32 t); 27uint32 time_t2dos(time_t s); 28 29uint8 hash_msdos_name(const char *name); 30void sanitize_name(char *name, int length); 31 32#if 0 33#define read32(buffer,off) \ 34 (((uint8 *)buffer)[(off)] + (((uint8 *)buffer)[(off)+1] << 8) + \ 35 (((uint8 *)buffer)[(off)+2] << 16) + (((uint8 *)buffer)[(off)+3] << 24)) 36 37#define read16(buffer,off) \ 38 (((uint8 *)buffer)[(off)] + (((uint8 *)buffer)[(off)+1] << 8)) 39#endif 40 41#define read32(buffer,off) \ 42 B_LENDIAN_TO_HOST_INT32(*(uint32 *)&buffer[off]) 43 44#define read16(buffer,off) \ 45 B_LENDIAN_TO_HOST_INT16(*(uint16 *)&buffer[off]) 46 47#endif /* _DOSFS_UTIL_H_ */ 48