database,sql,query,table
Just to the record: I've written a small program too, and it reports
correct sizes for normal disk devices under both linux 2.2 and 2.4,
as long as the partition sizes don't exceed the 2GB limit (I don't
have large file support, since I use debian potato with just the
necessary packages upraded for running 2.4). I've NOT tried with
*unbuffered raw* partitions, however (linux 2.4 supports both
partition access with and without buffering), I don't know yet how to
setup these.
lseek returns 0 if there's no partition on the disk for the device
being opened.
#include <iostream>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int main(int argn, char * args[]) {
for (int i=1;i<argn;i++) {
int fd= open (args[i], O_RDONLY);
if (fd!=-1) {
off_t eof = lseek (fd, 0, SEEK_END);
if (eof != -1)
cout << "Eof of `" << args[i] << "' is at: "<< eof <<"\n";
else
cerr<<"Could not lseek `"<<args[i]<<"': "<<strerror(errno)<<"\n";
if (close (fd)==-1)
cerr <<"??\n";
} else {
cerr<<"Could not open `"<<args[i]<<"': "<<strerror(errno)<<"\n";
}
}
}
./lseektest /dev/hda*
Could not lseek `/dev/hda': Value too large for defined data type
Could not lseek `/dev/hda1': Value too large for defined data type
Eof of `/dev/hda10' is at: 0
Eof of `/dev/hda11' is at: 0
Eof of `/dev/hda12' is at: 0
Eof of `/dev/hda13' is at: 0
Eof of `/dev/hda14' is at: 0
Eof of `/dev/hda15' is at: 0
Eof of `/dev/hda16' is at: 0
Eof of `/dev/hda17' is at: 0
Eof of `/dev/hda18' is at: 0
Eof of `/dev/hda19' is at: 0
Eof of `/dev/hda2' is at: 1024
Eof of `/dev/hda20' is at: 0
Eof of `/dev/hda3' is at: 197406720
Could not lseek `/dev/hda4': Value too large for defined data type
Could not lseek `/dev/hda5': Value too large for defined data type
Could not lseek `/dev/hda6': Value too large for defined data type
Eof of `/dev/hda7' is at: 682665984
Could not lseek `/dev/hda8': Value too large for defined data type
Eof of `/dev/hda9' is at: 0
root@pflanze raw\ partitions# fdisk -l /dev/hda
Disk /dev/hda: 255 heads, 63 sectors, 2110 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 383 3076416 b Win95 FAT32
/dev/hda2 384 1659 10249470 f Win95 Ext'd (LBA)
/dev/hda3 1660 1683 192780 82 Linux swap
/dev/hda4 1684 2110 3429877+ 83 Linux
/dev/hda5 384 766 3076416 b Win95 FAT32
/dev/hda6 767 1149 3076416 b Win95 FAT32
/dev/hda7 1150 1232 666666 b Win95 FAT32
/dev/hda8 1233 1659 3429846 b Win95 FAT32
root@pflanze raw\ partitions#
Cheers,
Christian.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php