:( 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 ??

Why not try this in the programming section?

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?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.