I should have been clearer; I tried this techniqe
on FreeBSD; I've not tried it on Linux yet.
(I don't have a Linux machine with a tape drive
at the moment.)

It doesn't work on FreeBSD; I was questioning
whether anyone else had tested it on Linux.

If Juergen's technique doesn't work, I'll try
the BLKGETSIZE ioctl.

Tim

Jung-uk Kim wrote:
On Saturday 20 February 2010 12:20 am, Tim Kientzle wrote:
Juergen,

I was looking at your Linux code here and thought
the technique of trying lseek(SEEK_END) might work.
Unfortunately, it doesn't: lseek(fd, 0, SEEK_END) gives
zero for both /dev/sa0 (a tape drive) and /dev/cd0
(an optical drive).  Are you sure it works on Linux?

Can you please try ioctl(fd, BLKGETSIZE64, &some_uint64_var) or ioctl(fd, BLKGETSIZE, &some_u_long_var)?

Jung-uk Kim


_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to