3 int64, add64, add64u, add64ul, sub64, sub64u, sub64ul, diff64, cvu64, cvul64, cv64u, cv64ul, div64u, rem64u, mul64u, cmp64, cmp64u, cmp64ul, ex64lo, ex64hi, make64 \- 64 bit disk offset computations
9 u64_t add64(u64_t \fIi\fP, u64_t \fIj\fP)
10 u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)
11 u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
12 u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)
13 u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)
14 u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
15 unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)
16 u64_t cvu64(unsigned \fIi\fP)
17 u64_t cvul64(unsigned long \fIi\fP)
18 unsigned cv64u(u64_t \fIi\fP)
19 unsigned long cv64ul(u64_t \fIi\fP)
20 unsigned long div64u(u64_t \fIi\fP, unsigned \fIj\fP)
21 unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)
22 u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)
23 int cmp64(u64_t \fIi\fP, u64_t \fIj\fP)
24 int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)
25 int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
26 unsigned long ex64lo(u64_t \fIi\fP)
27 unsigned long ex64hi(u64_t \fIi\fP)
28 u64_t make64(unsigned long \fIlo\fP, unsigned long \fIhi\fP)
38 family of functions allow MINIX 3 to handle disks of up to 4 terabytes using
39 32 bit sector numbers and 64 bit byte offsets on a machine where the C type
41 is 32 bits. The <minix/u64.h> include file defines a 64 bit data
44 and a number of functions to operate on them. Note that these functions are
45 geared towards common disk offset and block computations, and do not provide
46 a full set of 64 bit operations. They are:
49 .B "u64_t add64(u64_t \fIi\fP, u64_t \fIj\fP)"
50 Add the 64 bit numbers
54 forming a 64 bit result.
56 .B "u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)"
61 forming a 64 bit result.
63 .B "u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
68 forming a 64 bit result.
70 .B "u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)"
71 Subtract the 64 bit number
73 from the 64 bit number
75 forming a 64 bit result.
77 .B "u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)"
80 from the 64 bit number
82 forming a 64 bit result.
84 .B "u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
85 Subtract the unsigned long
87 from the 64 bit number
89 forming a 64 bit result.
91 .B "unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)"
92 Subtract the 64 bit number
94 from the 64 bit number
96 forming an unsigned. Overflow is not checked.
98 .B "u64_t cvu64(unsigned \fIi\fP)"
99 Convert an unsigned to a 64 bit number.
101 .B "u64_t cvul64(unsigned long \fIi\fP)"
102 Convert an unsigned long to a 64 bit number.
104 .B "unsigned cv64u(u64_t \fIi\fP)"
105 Convert a 64 bit number to an unsigned if it fits, otherwise return
108 .B "unsigned long cv64ul(u64_t \fIi\fP)"
109 Convert a 64 bit number to an unsigned long if it fits, otherwise return
112 .B "unsigned long div64u(u64_t \fIi\fP, unsigned \fIj\fP)"
113 Divide the 64 bit number
117 giving an unsigned long. Overflow is not checked. (Typical "byte offset to
118 block number" conversion.)
120 .B "unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)"
121 Compute the remainder of the division of the 64 bit number
125 as an unsigned. (Typical "byte offset within a block" computation.)
127 .B "u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)"
128 Multiply the unsigned long
132 giving a 64 bit number. (Typical "block number to byte offset" conversion.)
134 .B "int cmp64(u64_t \fIi\fP, u64_t \fIj\fP)"
135 Compare two 64 bit numbers.
154 .B "int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)"
155 Likewise compare a 64 bit number with an unsigned.
157 .B "int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
158 Likewise compare a 64 bit number with an unsigned long.
160 .B "unsigned long ex64lo(u64_t \fIi\fP)"
161 Extract the low 32 bits of a 64 bit number.
163 .B "unsigned long ex64hi(u64_t \fIi\fP)"
164 Extract the high 32 bits of a 64 bit number.
166 .B "u64_t make64(unsigned long \fIlo\fP, unsigned long \fIhi\fP)"
167 Combine the low and high parts of a 64 bit number to a 64 bit number. (The
168 last three functions are used to pass 64 bit numbers in messages within the
169 kernel. They should not be used for anything else.)
174 With the usual disk block size of 512 bytes the maximum disk size is 512
175 \(** 4 gigabytes = 2 terabytes.
177 Standard MINIX 3 only uses 64 bit computations within the disk drivers, so
178 individual partitions are still limited to 4 gigabytes. Minix-vmd has 64
179 bit computations also in the file system code.
181 Special care must be taken when accessing disk devices. For MINIX 3 one may
182 have to temporarily change the start of the partition to go beyond 4 G.
183 Minix-vmd can go beyond 4 G, but the
185 system call is still limited to a 32 bit offset. One needs to use
188 .BI "fcntl(" fd ", F_SEEK, u64_t " offset ")"
191 to seek to a 64 bit position.
193 Kees J. Bot <kjb@cs.vu.nl>