NAMEint64, add64, add64u, add64ul, sub64, sub64u, sub64ul, diff64, cvu64, cvul64, cv64u, cv64ul, div64u, rem64u, mul64u, cmp64, cmp64u, cmp64ul, ex64lo, ex64hi, make64 - 64 bit disk offset computationsSYNOPSIS#include<minix/u64.h>u64_tadd64(u64_ti,u64_tj)u64_tadd64u(u64_ti,unsignedj)u64_tadd64ul(u64_ti,unsignedlongj)u64_tsub64(u64_ti,u64_tj)u64_tsub64u(u64_ti,unsignedj)u64_tsub64ul(u64_ti,unsignedlongj)unsigneddiff64(u64_ti,u64_tj)u64_tcvu64(unsignedi)u64_tcvul64(unsignedlongi)unsignedcv64u(u64_ti)unsignedlongcv64ul(u64_ti)unsignedlongdiv64u(u64_ti,unsignedj)unsignedrem64u(u64_ti,unsignedj)u64_tmul64u(unsignedlongi,unsignedj)intcmp64(u64_ti,u64_tj)intcmp64u(u64_ti,unsignedj)intcmp64ul(u64_ti,unsignedlongj)unsignedlongex64lo(u64_ti)unsignedlongex64hi(u64_ti)u64_tmake64(unsignedlonglo,unsignedlonghi)DESCRIPTIONTheint64family of functions allow Minix to handle disks of up to 4 terabytes using 32 bit sector numbers and 64 bit byte offsets on a machine where the C typelongis 32 bits. The <minix/u64.h> include file defines a 64 bit data type,u64_t, and a number of functions to operate on them. Note that these functions are geared towards common disk offset and block computations, and do not provide a full set of 64 bit operations. They are:u64_tadd64(u64_ti,u64_tj)Add the 64 bit numbersiandjforming a 64 bit result.u64_tadd64u(u64_ti,unsignedj)Add an unsignedjto a 64 bit numberiforming a 64 bit result.u64_tadd64ul(u64_ti,unsignedlongj)Add an unsigned longjto a 64 bit numberiforming a 64 bit result.u64_tsub64(u64_ti,u64_tj)Subtract the 64 bit numberjfrom the 64 bit numberiforming a 64 bit result.u64_tsub64u(u64_ti,unsignedj)Subtract the unsignedjfrom the 64 bit numberiforming a 64 bit result.u64_tsub64ul(u64_ti,unsignedlongj)Subtract the unsigned longjfrom the 64 bit numberiforming a 64 bit result.unsigneddiff64(u64_ti,u64_tj)Subtract the 64 bit numberjfrom the 64 bit numberiforming an unsigned. Overflow is not checked.u64_tcvu64(unsignedi)Convert an unsigned to a 64 bit number.u64_tcvul64(unsignedlongi)Convert an unsigned long to a 64 bit number.unsignedcv64u(u64_ti)Convert a 64 bit number to an unsigned if it fits, otherwise returnUINT_MAX.unsignedlongcv64ul(u64_ti)Convert a 64 bit number to an unsigned long if it fits, otherwise returnULONG_MAX.unsignedlongdiv64u(u64_ti,unsignedj)Divide the 64 bit numberiby the unsignedjgiving an unsigned long. Overflow is not checked. (Typical "byte offset to block number" conversion.)unsignedrem64u(u64_ti,unsignedj)Compute the remainder of the division of the 64 bit numberiby the unsignedjas an unsigned. (Typical "byte offset within a block" computation.)u64_tmul64u(unsignedlongi,unsignedj)Multiply the unsigned longiby the unsignedjgiving a 64 bit number. (Typical "block number to byte offset" conversion.)intcmp64(u64_ti,u64_tj)Compare two 64 bit numbers. Returns-1ifi<j,0ifi==j, and1ifi>j.intcmp64u(u64_ti,unsignedj)Likewise compare a 64 bit number with an unsigned.intcmp64ul(u64_ti,unsignedlongj)Likewise compare a 64 bit number with an unsigned long.unsignedlongex64lo(u64_ti)Extract the low 32 bits of a 64 bit number.unsignedlongex64hi(u64_ti)Extract the high 32 bits of a 64 bit number.u64_tmake64(unsignedlonglo,unsignedlonghi)Combine the low and high parts of a 64 bit number to a 64 bit number. (The last three functions are used to pass 64 bit numbers in messages within the kernel. They should not be used for anything else.)SEEALSOfcntl(2),controller(4).NOTESWith the usual disk block size of 512 bytes the maximum disk size is 512 * 4 gigabytes = 2 terabytes. Standard Minix only uses 64 bit computations withing the disk drivers, so individual partitions are still limited to 4 gigabytes. Minix-vmd has 64 bit computations also in the file system code. Special care must be taken when accessing disk devices. For Minix one may have to temporarily change the start of the partition to go beyond 4 G. Minix-vmd can go beyond 4 G, but thelseeksystem call is still limited to a 32 bit offset. One needs to usefcntl(fd,F_SEEK,u64_toffset)to seek to a 64 bit position.AUTHORKees J. Bot (kjb@cs.vu.nl)