27 |
|
#ifdef __linux__ |
28 |
|
#include <linux/cdrom.h> |
29 |
|
#include <linux/fd.h> |
30 |
+ |
#include <linux/fs.h> |
31 |
|
#include <linux/major.h> |
32 |
|
#include <linux/kdev_t.h> |
33 |
|
#include <linux/unistd.h> |
429 |
|
return fh->file_size; |
430 |
|
else { |
431 |
|
#if defined(__linux__) |
432 |
< |
loff_t pos = 0; |
433 |
< |
_llseek(fh->fd, 0, 0, &pos, SEEK_END); |
434 |
< |
return pos - fh->start_byte; |
432 |
> |
long blocks; |
433 |
> |
if (ioctl(fh->fd, BLKGETSIZE, &blocks) < 0) |
434 |
> |
return 0; |
435 |
> |
D(bug(" BLKGETSIZE returns %d blocks\n", blocks)); |
436 |
> |
return (loff_t)blocks * 512; |
437 |
|
#else |
438 |
|
return lseek(fh->fd, 0, SEEK_END) - fh->start_byte; |
439 |
|
#endif |