source: trunk/minix/commands/i386/mtools-3.9.7/llong.h@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.7 KB
Line 
1#ifndef MTOOLS_LLONG_H
2#define MTOOLS_LLONG_H
3
4#if 1
5
6
7#ifdef HAVE_OFF_T_64
8/* if off_t is already 64 bits, be happy, and don't worry about the
9 * loff_t and llseek stuff */
10#define MT_OFF_T off_t
11#endif
12
13#ifndef MT_OFF_T
14# ifdef HAVE_LLSEEK
15/* we have llseek. Now, what's its type called? loff_t or offset_t ? */
16# ifdef HAVE_LOFF_T
17# define MT_OFF_T loff_t
18# else
19# ifdef HAVE_OFFSET_T
20# define MT_OFF_T offset_t
21# endif
22# endif
23# endif
24#endif
25
26#ifndef MT_OFF_T
27/* we still don't have a suitable mt_off_t type...*/
28# ifdef HAVE_LONG_LONG
29/* ... first try long long ... */
30# define MT_OFF_T long long
31# else
32/* ... and if that fails, fall back on good ole' off_t */
33# define MT_OFF_T off_t
34# endif
35#endif
36
37typedef MT_OFF_T mt_off_t;
38
39#else
40/* testing: meant to flag dubious assignments between 32 bit length types
41 * and 64 bit ones */
42typedef struct {
43 int lo;
44 int high;
45} *mt_off_t;
46
47
48#endif
49
50typedef mt_off_t mt_size_t;
51
52#define min(a,b) ((a) < (b) ? (a) : (b))
53#define MAX_OFF_T_B(bits) \
54 (((mt_off_t) 1 << min(bits, sizeof(mt_off_t)*8 - 1)) - 1)
55
56#ifdef HAVE_LLSEEK
57# define SEEK_BITS 63
58#else
59# define SEEK_BITS (sizeof(off_t) * 8 - 1)
60#endif
61
62extern const mt_off_t max_off_t_31;
63extern const mt_off_t max_off_t_41;
64extern const mt_off_t max_off_t_seek;
65
66extern off_t truncBytes32(mt_off_t off);
67mt_off_t sectorsToBytes(Stream_t *This, off_t off);
68
69mt_size_t getfree(Stream_t *Stream);
70int getfreeMinBytes(Stream_t *Stream, mt_size_t ref);
71
72Stream_t *find_device(char *drive, int mode, struct device *out_dev,
73 struct bootsector *boot,
74 char *name, int *media, mt_size_t *maxSize);
75
76int mt_lseek(int fd, mt_off_t where, int whence);
77
78
79int log_2(int);
80
81#endif
Note: See TracBrowser for help on using the repository browser.