* fhandler_tape.cc (mtinfo_drive::get_pos): Only set partition if
GetTapePosition returned a non-zero partition number. (mtinfo_drive::create_partitions): Reinitialize to partition 0. Support TAPE_DRIVE_INITIATOR and TAPE_DRIVE_FIXED partitioning. (mtinfo_drive::set_partition): Initialize new partition. (mtinfo_drive::status): Readd accidentally dropped setting of mt_resid. * net.cc (wsock_event::prepare): Always print debug output in case of error.
This commit is contained in:
parent
93ba120429
commit
decd3e5d72
@ -1,3 +1,15 @@
|
|||||||
|
2004-03-31 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_tape.cc (mtinfo_drive::get_pos): Only set partition if
|
||||||
|
GetTapePosition returned a non-zero partition number.
|
||||||
|
(mtinfo_drive::create_partitions): Reinitialize to partition 0.
|
||||||
|
Support TAPE_DRIVE_INITIATOR and TAPE_DRIVE_FIXED partitioning.
|
||||||
|
(mtinfo_drive::set_partition): Initialize new partition.
|
||||||
|
(mtinfo_drive::status): Readd accidentally dropped setting of mt_resid.
|
||||||
|
|
||||||
|
* net.cc (wsock_event::prepare): Always print debug output in case
|
||||||
|
of error.
|
||||||
|
|
||||||
2004-03-31 Corinna Vinschen <corinna@vinschen.de>
|
2004-03-31 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling.
|
* fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling.
|
||||||
|
@ -324,7 +324,8 @@ mtinfo_drive::get_pos (HANDLE mt, long *ppartition, long *pblock)
|
|||||||
TAPE_FUNC (GetTapePosition (mt, TAPE_ABSOLUTE_POSITION, &p, &low, &high));
|
TAPE_FUNC (GetTapePosition (mt, TAPE_ABSOLUTE_POSITION, &p, &low, &high));
|
||||||
if (!lasterr)
|
if (!lasterr)
|
||||||
{
|
{
|
||||||
partition = (long) (p > 0 ? p - 1 : p);
|
if (p > 0)
|
||||||
|
partition = (long) p - 1;
|
||||||
block = (long) low;
|
block = (long) low;
|
||||||
if (ppartition)
|
if (ppartition)
|
||||||
*ppartition= partition;
|
*ppartition= partition;
|
||||||
@ -511,9 +512,26 @@ mtinfo_drive::create_partitions (HANDLE mt, long count)
|
|||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
if (set_pos (mt, TAPE_REWIND, 0, false))
|
if (set_pos (mt, TAPE_REWIND, 0, false))
|
||||||
goto out;
|
goto out;
|
||||||
|
partition = 0;
|
||||||
|
part (partition)->initialize (0);
|
||||||
debug_printf ("Format tape with %s partition(s)", count <= 0 ? "one" : "two");
|
debug_printf ("Format tape with %s partition(s)", count <= 0 ? "one" : "two");
|
||||||
TAPE_FUNC (CreateTapePartition (mt, TAPE_SELECT_PARTITIONS,
|
if (get_feature (TAPE_DRIVE_INITIATOR))
|
||||||
count <= 0 ? 1 : 2, 0));
|
{
|
||||||
|
if (count <= 0)
|
||||||
|
TAPE_FUNC (CreateTapePartition (mt, TAPE_INITIATOR_PARTITIONS,
|
||||||
|
count <= 0 ? 0 : 2, (DWORD) count));
|
||||||
|
}
|
||||||
|
else if (get_feature (TAPE_DRIVE_FIXED))
|
||||||
|
{
|
||||||
|
/* This is supposed to work for Tandberg SLR drivers up to version
|
||||||
|
1.6 which missed to set the TAPE_DRIVE_INITIATOR flag. According
|
||||||
|
to Tandberg, CreateTapePartition(TAPE_FIXED_PARTITIONS) apparently
|
||||||
|
does not ignore the dwCount parameter. Go figure! */
|
||||||
|
TAPE_FUNC (CreateTapePartition (mt, TAPE_FIXED_PARTITIONS,
|
||||||
|
count <= 0 ? 0 : 2, (DWORD) count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lasterr = ERROR_INVALID_PARAMETER;
|
||||||
out:
|
out:
|
||||||
return error ("partition");
|
return error ("partition");
|
||||||
}
|
}
|
||||||
@ -545,7 +563,11 @@ mtinfo_drive::set_partition (HANDLE mt, long count)
|
|||||||
lasterr = err;
|
lasterr = err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
partition = count;
|
partition = count;
|
||||||
|
if (part (partition)->block == -1)
|
||||||
|
part (partition)->initialize (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return error ("set_partition");
|
return error ("set_partition");
|
||||||
}
|
}
|
||||||
@ -727,6 +749,7 @@ mtinfo_drive::status (HANDLE mt, struct mtget *get)
|
|||||||
|
|
||||||
if (!notape)
|
if (!notape)
|
||||||
{
|
{
|
||||||
|
get->mt_resid = partition;
|
||||||
get->mt_fileno = part (partition)->file;
|
get->mt_fileno = part (partition)->file;
|
||||||
get->mt_blkno = part (partition)->fblock;
|
get->mt_blkno = part (partition)->fblock;
|
||||||
|
|
||||||
|
@ -54,8 +54,9 @@ bool
|
|||||||
wsock_event::prepare (int sock, long event_mask)
|
wsock_event::prepare (int sock, long event_mask)
|
||||||
{
|
{
|
||||||
WSASetLastError (0);
|
WSASetLastError (0);
|
||||||
if ((event = WSACreateEvent ()) != WSA_INVALID_EVENT
|
if ((event = WSACreateEvent ()) == WSA_INVALID_EVENT)
|
||||||
&& WSAEventSelect (sock, event, event_mask) == SOCKET_ERROR)
|
debug_printf ("WSACreateEvent: %E");
|
||||||
|
else if (WSAEventSelect (sock, event, event_mask) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
debug_printf ("WSAEventSelect: %E");
|
debug_printf ("WSAEventSelect: %E");
|
||||||
WSACloseEvent (event);
|
WSACloseEvent (event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user