int fd;
struct stat st;
struct mtop op;
+ struct mtpos pos;
myname = argv[0];
/* tell block count */
else if (!strcmp (cmd, "tell"))
{
- op.mt_op = MTTELL;
- if (ioctl (fd, MTIOCTOP, &op) < 0)
+ /* Don't use MTTELL call. It's non-standarized and returns the block
+ number as an int, which breaks 64 bit block numbers on 64 bit systems.
+ Unfortunately, following the Linux definitions, the return type in
+ struct mtpos is long, which restricts it to 32 bit on 32 bit systems
+ as well. */
+ if (ioctl (fd, MTIOCPOS, &pos) < 0)
ret = errprintf (2, "%s: %s", path, strerror (errno));
else
- printf ("At block %d.\n", op.mt_count);
+ printf ("At block %d.\n", pos.mt_blkno);
}
/* write densities */
else if (!strcmp (cmd, "densities"))