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 "system_dependencies.h"
10
11
12const char sAcceptable[]="!#$%&'()-0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`{}~";
13const char sIllegal[] = "\\/:*?\"<>|";
14
15
16// debugging functions
17#ifndef ASSERT
18#ifndef DEBUG
19#define ASSERT(c) ((void)0)
20#else
21int _assert_(char *,int,char *);
22#define ASSERT(c) (!(c) ? _assert_(__FILE__,__LINE__,#c) : 0)
23#endif
24#endif
25
26void	dump_bytes(uint8 *buffer, uint32 count);
27void	dump_directory(uint8 *buffer);
28
29// time
30time_t	dos2time_t(uint32 t);
31uint32	time_t2dos(time_t s);
32
33uint8	hash_msdos_name(const char *name);
34void	sanitize_name(char *name, int length);
35
36#if 0
37#define read32(buffer,off) \
38	(((uint8 *)buffer)[(off)] + (((uint8 *)buffer)[(off)+1] << 8) + \
39	 (((uint8 *)buffer)[(off)+2] << 16) + (((uint8 *)buffer)[(off)+3] << 24))
40
41#define read16(buffer,off) \
42	(((uint8 *)buffer)[(off)] + (((uint8 *)buffer)[(off)+1] << 8))
43#endif
44
45#define read32(buffer,off) \
46	B_LENDIAN_TO_HOST_INT32(*(uint32 *)&buffer[off])
47
48#define read16(buffer,off) \
49	B_LENDIAN_TO_HOST_INT16(*(uint16 *)&buffer[off])
50
51#endif	/* _DOSFS_UTIL_H_ */
52