1 | .TH INT64 3
|
---|
2 | .SH NAME
|
---|
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
|
---|
4 | .SH SYNOPSIS
|
---|
5 | .ft B
|
---|
6 | .nf
|
---|
7 | #include <minix/u64.h>
|
---|
8 |
|
---|
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)
|
---|
29 | .fi
|
---|
30 | .ft P
|
---|
31 | .SH DESCRIPTION
|
---|
32 | .de SP
|
---|
33 | .if t .sp 0.4
|
---|
34 | .if n .sp
|
---|
35 | ..
|
---|
36 | The
|
---|
37 | .B int64
|
---|
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
|
---|
40 | .B long
|
---|
41 | is 32 bits. The <minix/u64.h> include file defines a 64 bit data
|
---|
42 | type,
|
---|
43 | .BR u64_t ,
|
---|
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:
|
---|
47 | .PP
|
---|
48 | .TP
|
---|
49 | .B "u64_t add64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
---|
50 | Add the 64 bit numbers
|
---|
51 | .I i
|
---|
52 | and
|
---|
53 | .I j
|
---|
54 | forming a 64 bit result.
|
---|
55 | .TP
|
---|
56 | .B "u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
---|
57 | Add an unsigned
|
---|
58 | .I j
|
---|
59 | to a 64 bit number
|
---|
60 | .I i
|
---|
61 | forming a 64 bit result.
|
---|
62 | .TP
|
---|
63 | .B "u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
|
---|
64 | Add an unsigned long
|
---|
65 | .I j
|
---|
66 | to a 64 bit number
|
---|
67 | .I i
|
---|
68 | forming a 64 bit result.
|
---|
69 | .TP
|
---|
70 | .B "u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
---|
71 | Subtract the 64 bit number
|
---|
72 | .I j
|
---|
73 | from the 64 bit number
|
---|
74 | .I i
|
---|
75 | forming a 64 bit result.
|
---|
76 | .TP
|
---|
77 | .B "u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
---|
78 | Subtract the unsigned
|
---|
79 | .I j
|
---|
80 | from the 64 bit number
|
---|
81 | .I i
|
---|
82 | forming a 64 bit result.
|
---|
83 | .TP
|
---|
84 | .B "u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
|
---|
85 | Subtract the unsigned long
|
---|
86 | .I j
|
---|
87 | from the 64 bit number
|
---|
88 | .I i
|
---|
89 | forming a 64 bit result.
|
---|
90 | .TP
|
---|
91 | .B "unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
---|
92 | Subtract the 64 bit number
|
---|
93 | .I j
|
---|
94 | from the 64 bit number
|
---|
95 | .I i
|
---|
96 | forming an unsigned. Overflow is not checked.
|
---|
97 | .TP
|
---|
98 | .B "u64_t cvu64(unsigned \fIi\fP)"
|
---|
99 | Convert an unsigned to a 64 bit number.
|
---|
100 | .TP
|
---|
101 | .B "u64_t cvul64(unsigned long \fIi\fP)"
|
---|
102 | Convert an unsigned long to a 64 bit number.
|
---|
103 | .TP
|
---|
104 | .B "unsigned cv64u(u64_t \fIi\fP)"
|
---|
105 | Convert a 64 bit number to an unsigned if it fits, otherwise return
|
---|
106 | .BR UINT_MAX .
|
---|
107 | .TP
|
---|
108 | .B "unsigned long cv64ul(u64_t \fIi\fP)"
|
---|
109 | Convert a 64 bit number to an unsigned long if it fits, otherwise return
|
---|
110 | .BR ULONG_MAX .
|
---|
111 | .TP
|
---|
112 | .B "unsigned long div64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
---|
113 | Divide the 64 bit number
|
---|
114 | .I i
|
---|
115 | by the unsigned
|
---|
116 | .I j
|
---|
117 | giving an unsigned long. Overflow is not checked. (Typical "byte offset to
|
---|
118 | block number" conversion.)
|
---|
119 | .TP
|
---|
120 | .B "unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
---|
121 | Compute the remainder of the division of the 64 bit number
|
---|
122 | .I i
|
---|
123 | by the unsigned
|
---|
124 | .I j
|
---|
125 | as an unsigned. (Typical "byte offset within a block" computation.)
|
---|
126 | .TP
|
---|
127 | .B "u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)"
|
---|
128 | Multiply the unsigned long
|
---|
129 | .I i
|
---|
130 | by the unsigned
|
---|
131 | .I j
|
---|
132 | giving a 64 bit number. (Typical "block number to byte offset" conversion.)
|
---|
133 | .TP
|
---|
134 | .B "int cmp64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
---|
135 | Compare two 64 bit numbers.
|
---|
136 | Returns
|
---|
137 | .B -1
|
---|
138 | if
|
---|
139 | .I i
|
---|
140 | <
|
---|
141 | .IR j ,
|
---|
142 | .B 0
|
---|
143 | if
|
---|
144 | .I i
|
---|
145 | ==
|
---|
146 | .IR j ,
|
---|
147 | and
|
---|
148 | .B 1
|
---|
149 | if
|
---|
150 | .I i
|
---|
151 | >
|
---|
152 | .IR j .
|
---|
153 | .TP
|
---|
154 | .B "int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
---|
155 | Likewise compare a 64 bit number with an unsigned.
|
---|
156 | .TP
|
---|
157 | .B "int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
|
---|
158 | Likewise compare a 64 bit number with an unsigned long.
|
---|
159 | .TP
|
---|
160 | .B "unsigned long ex64lo(u64_t \fIi\fP)"
|
---|
161 | Extract the low 32 bits of a 64 bit number.
|
---|
162 | .TP
|
---|
163 | .B "unsigned long ex64hi(u64_t \fIi\fP)"
|
---|
164 | Extract the high 32 bits of a 64 bit number.
|
---|
165 | .TP
|
---|
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.)
|
---|
170 | .SH "SEE ALSO"
|
---|
171 | .BR fcntl (2),
|
---|
172 | .BR controller (4).
|
---|
173 | .SH NOTES
|
---|
174 | With the usual disk block size of 512 bytes the maximum disk size is 512
|
---|
175 | \(** 4 gigabytes = 2 terabytes.
|
---|
176 | .PP
|
---|
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.
|
---|
180 | .PP
|
---|
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
|
---|
184 | .B lseek
|
---|
185 | system call is still limited to a 32 bit offset. One needs to use
|
---|
186 | .PP
|
---|
187 | .RS
|
---|
188 | .BI "fcntl(" fd ", F_SEEK, u64_t " offset ")"
|
---|
189 | .RE
|
---|
190 | .PP
|
---|
191 | to seek to a 64 bit position.
|
---|
192 | .SH AUTHOR
|
---|
193 | Kees J. Bot <kjb@cs.vu.nl>
|
---|