0

:( Hi friends,
I have one question, if anybody can answer it.
Question :
(I am performing operations on tape drive using st driver)
While performing read operation on tape (using read()), EOD occured.
After EOD occured, i m firing MTIOCGET request and getting the tape status.
After getting tape status, i am checking for the GMT_EOD. But GMT_EOD is not getting set.

Can anybody tell the reason why GMT_EOD is not getting set even if read() fails because of EOD occured ??

3
Contributors
3
Replies
5
Views
10 Years
Discussion Span
Last Post by harish_s
0

these things are very easy to do with tar/mt or cpio
maybe you should have a look in their source code, if you're trying to write something of your own?

0

Problem is not in Write/Read operation. I am able to perform both Write as well as Read operation on tape. My concern is that while performing Read operation when EOD occured, why GMT_EOD of structure mtget is not getting set.
Here is the code :

memset ((struct mtget *) &st_Magtape_Get, 0, sizeof(struct mtget));
if (ioctl (iMtuFd, MTIOCGET, &st_Magtape_Get) < 0)
{
printf("ioctl MTIOCGET Failed. ERROR : %s",strerror(errno));
return -1;
}
else
{
printf("Got drive status");
}


if (GMT_EOD(st_Magtape_Get.mt_gstat))
{
printf("MTIOCGET : GMT_EOD");
}
else
{
printf("EOD not found");
}

When EOD occures, first i am taking the tape status, which will set all the bits of structure mtget according to the status of tape and then i am checking for the EOD bit and the output i am getting is :

EOD not found

Edited by happygeek: fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.