* fhandler_tape.cc (mtinfo_drive::create_partitions): Fix long-standing

bug disabling creation of two partitions on drives supporting initiator
	partitions.
	(mtinfo_drive::set_blocksize): Update media information after setting
	blocksize succeeded.
	(mtinfo_drive::get_status): Fetch fresh media information.
This commit is contained in:
Corinna Vinschen 2013-08-20 20:17:14 +00:00
parent f9268dfd7a
commit 30990eaa27
3 changed files with 31 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2013-08-20 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tape.cc (mtinfo_drive::create_partitions): Fix long-standing
bug disabling creation of two partitions on drives supporting initiator
partitions.
(mtinfo_drive::set_blocksize): Update media information after setting
blocksize succeeded.
(mtinfo_drive::get_status): Fetch fresh media information.
2013-08-19 Corinna Vinschen <corinna@vinschen.de> 2013-08-19 Corinna Vinschen <corinna@vinschen.de>
* lc_msg.h: Regenerate. * lc_msg.h: Regenerate.

View File

@ -557,9 +557,8 @@ mtinfo_drive::create_partitions (HANDLE mt, int32_t count)
debug_printf ("Format tape with %s partition(s)", count <= 0 ? "one" : "two"); debug_printf ("Format tape with %s partition(s)", count <= 0 ? "one" : "two");
if (get_feature (TAPE_DRIVE_INITIATOR)) if (get_feature (TAPE_DRIVE_INITIATOR))
{ {
if (count <= 0) TAPE_FUNC (CreateTapePartition (mt, TAPE_INITIATOR_PARTITIONS,
TAPE_FUNC (CreateTapePartition (mt, TAPE_INITIATOR_PARTITIONS, count <= 0 ? 0 : 2, (DWORD) count));
count <= 0 ? 0 : 2, (DWORD) count));
} }
else if (get_feature (TAPE_DRIVE_FIXED)) else if (get_feature (TAPE_DRIVE_FIXED))
{ {
@ -741,7 +740,8 @@ mtinfo_drive::set_blocksize (HANDLE mt, DWORD count)
{ {
TAPE_SET_MEDIA_PARAMETERS smp = {count}; TAPE_SET_MEDIA_PARAMETERS smp = {count};
TAPE_FUNC (SetTapeParameters (mt, SET_TAPE_MEDIA_INFORMATION, &smp)); TAPE_FUNC (SetTapeParameters (mt, SET_TAPE_MEDIA_INFORMATION, &smp));
return error ("set_blocksize"); /* Make sure to update blocksize info! */
return lasterr ? error ("set_blocksize") : get_mp (mt);
} }
int int
@ -756,6 +756,9 @@ mtinfo_drive::get_status (HANDLE mt, struct mtget *get)
if ((tstat = GetTapeStatus (mt)) == ERROR_NO_MEDIA_IN_DRIVE) if ((tstat = GetTapeStatus (mt)) == ERROR_NO_MEDIA_IN_DRIVE)
notape = 1; notape = 1;
if (get_mp (mt))
return lasterr;
memset (get, 0, sizeof *get); memset (get, 0, sizeof *get);
get->mt_type = MT_ISUNKNOWN; get->mt_type = MT_ISUNKNOWN;

View File

@ -0,0 +1,15 @@
What's new:
-----------
What changed:
-------------
Bug fixes:
----------
- Fix creating two partitions on tape drives supporting initiator partitions.
- Update the internally used blocksize after setting a new blocksize for the
current tape.