source: trunk/minix/man/man3/int64.3@ 10

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

Minix 3.1.2a

File size: 5.1 KB
RevLine 
[9]1.TH INT64 3
2.SH NAME
3int64, 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
9u64_t add64(u64_t \fIi\fP, u64_t \fIj\fP)
10u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)
11u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
12u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)
13u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)
14u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
15unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)
16u64_t cvu64(unsigned \fIi\fP)
17u64_t cvul64(unsigned long \fIi\fP)
18unsigned cv64u(u64_t \fIi\fP)
19unsigned long cv64ul(u64_t \fIi\fP)
20unsigned long div64u(u64_t \fIi\fP, unsigned \fIj\fP)
21unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)
22u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)
23int cmp64(u64_t \fIi\fP, u64_t \fIj\fP)
24int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)
25int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
26unsigned long ex64lo(u64_t \fIi\fP)
27unsigned long ex64hi(u64_t \fIi\fP)
28u64_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..
36The
37.B int64
38family of functions allow MINIX 3 to handle disks of up to 4 terabytes using
3932 bit sector numbers and 64 bit byte offsets on a machine where the C type
40.B long
41is 32 bits. The <minix/u64.h> include file defines a 64 bit data
42type,
43.BR u64_t ,
44and a number of functions to operate on them. Note that these functions are
45geared towards common disk offset and block computations, and do not provide
46a 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)"
50Add the 64 bit numbers
51.I i
52and
53.I j
54forming a 64 bit result.
55.TP
56.B "u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)"
57Add an unsigned
58.I j
59to a 64 bit number
60.I i
61forming a 64 bit result.
62.TP
63.B "u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
64Add an unsigned long
65.I j
66to a 64 bit number
67.I i
68forming a 64 bit result.
69.TP
70.B "u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)"
71Subtract the 64 bit number
72.I j
73from the 64 bit number
74.I i
75forming a 64 bit result.
76.TP
77.B "u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)"
78Subtract the unsigned
79.I j
80from the 64 bit number
81.I i
82forming a 64 bit result.
83.TP
84.B "u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
85Subtract the unsigned long
86.I j
87from the 64 bit number
88.I i
89forming a 64 bit result.
90.TP
91.B "unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)"
92Subtract the 64 bit number
93.I j
94from the 64 bit number
95.I i
96forming an unsigned. Overflow is not checked.
97.TP
98.B "u64_t cvu64(unsigned \fIi\fP)"
99Convert an unsigned to a 64 bit number.
100.TP
101.B "u64_t cvul64(unsigned long \fIi\fP)"
102Convert an unsigned long to a 64 bit number.
103.TP
104.B "unsigned cv64u(u64_t \fIi\fP)"
105Convert 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)"
109Convert 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)"
113Divide the 64 bit number
114.I i
115by the unsigned
116.I j
117giving an unsigned long. Overflow is not checked. (Typical "byte offset to
118block number" conversion.)
119.TP
120.B "unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)"
121Compute the remainder of the division of the 64 bit number
122.I i
123by the unsigned
124.I j
125as an unsigned. (Typical "byte offset within a block" computation.)
126.TP
127.B "u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)"
128Multiply the unsigned long
129.I i
130by the unsigned
131.I j
132giving 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)"
135Compare two 64 bit numbers.
136Returns
137.B -1
138if
139.I i
140<
141.IR j ,
142.B 0
143if
144.I i
145==
146.IR j ,
147and
148.B 1
149if
150.I i
151>
152.IR j .
153.TP
154.B "int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)"
155Likewise compare a 64 bit number with an unsigned.
156.TP
157.B "int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
158Likewise compare a 64 bit number with an unsigned long.
159.TP
160.B "unsigned long ex64lo(u64_t \fIi\fP)"
161Extract the low 32 bits of a 64 bit number.
162.TP
163.B "unsigned long ex64hi(u64_t \fIi\fP)"
164Extract the high 32 bits of a 64 bit number.
165.TP
166.B "u64_t make64(unsigned long \fIlo\fP, unsigned long \fIhi\fP)"
167Combine the low and high parts of a 64 bit number to a 64 bit number. (The
168last three functions are used to pass 64 bit numbers in messages within the
169kernel. They should not be used for anything else.)
170.SH "SEE ALSO"
171.BR fcntl (2),
172.BR controller (4).
173.SH NOTES
174With the usual disk block size of 512 bytes the maximum disk size is 512
175\(** 4 gigabytes = 2 terabytes.
176.PP
177Standard MINIX 3 only uses 64 bit computations within the disk drivers, so
178individual partitions are still limited to 4 gigabytes. Minix-vmd has 64
179bit computations also in the file system code.
180.PP
181Special care must be taken when accessing disk devices. For MINIX 3 one may
182have to temporarily change the start of the partition to go beyond 4 G.
183Minix-vmd can go beyond 4 G, but the
184.B lseek
185system 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
191to seek to a 64 bit position.
192.SH AUTHOR
193Kees J. Bot <kjb@cs.vu.nl>
Note: See TracBrowser for help on using the repository browser.