00001 #ifndef MTOOLS_LLONG_H
00002 #define MTOOLS_LLONG_H
00003
00004 #if 1
00005
00006
00007 #ifdef HAVE_OFF_T_64
00008
00009
00010 #define MT_OFF_T off_t
00011 #endif
00012
00013 #ifndef MT_OFF_T
00014 # ifdef HAVE_LLSEEK
00015
00016 # ifdef HAVE_LOFF_T
00017 # define MT_OFF_T loff_t
00018 # else
00019 # ifdef HAVE_OFFSET_T
00020 # define MT_OFF_T offset_t
00021 # endif
00022 # endif
00023 # endif
00024 #endif
00025
00026 #ifndef MT_OFF_T
00027
00028 # ifdef HAVE_LONG_LONG
00029
00030 # define MT_OFF_T long long
00031 # else
00032
00033 # define MT_OFF_T off_t
00034 # endif
00035 #endif
00036
00037 typedef MT_OFF_T mt_off_t;
00038
00039 #else
00040
00041
00042 typedef struct {
00043 int lo;
00044 int high;
00045 } *mt_off_t;
00046
00047
00048 #endif
00049
00050 typedef mt_off_t mt_size_t;
00051
00052 #define min(a,b) ((a) < (b) ? (a) : (b))
00053 #define MAX_OFF_T_B(bits) \
00054 (((mt_off_t) 1 << min(bits, sizeof(mt_off_t)*8 - 1)) - 1)
00055
00056 #ifdef HAVE_LLSEEK
00057 # define SEEK_BITS 63
00058 #else
00059 # define SEEK_BITS (sizeof(off_t) * 8 - 1)
00060 #endif
00061
00062 extern const mt_off_t max_off_t_31;
00063 extern const mt_off_t max_off_t_41;
00064 extern const mt_off_t max_off_t_seek;
00065
00066 extern off_t truncBytes32(mt_off_t off);
00067 mt_off_t sectorsToBytes(Stream_t *This, off_t off);
00068
00069 mt_size_t getfree(Stream_t *Stream);
00070 int getfreeMinBytes(Stream_t *Stream, mt_size_t ref);
00071
00072 Stream_t *find_device(char *drive, int mode, struct device *out_dev,
00073 struct bootsector *boot,
00074 char *name, int *media, mt_size_t *maxSize);
00075
00076 int mt_lseek(int fd, mt_off_t where, int whence);
00077
00078
00079 int log_2(int);
00080
00081 #endif