Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions messages/tape_linux_sg/root.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ root:table {
30295I:string { "Have unstable TUR response, start over (Cur = %d, Prev = %d)." }
30296I:string { "Capturing a stable TUR at line %d." }
30297W:string { "Cannot retrieve drive dump: failed to communicate with drive. Tried (%d) times." }
30298I:string { "Sense data returned unknown cart type, compat: assume_cart_type from density code (%x %x) " }

30392D:string { "Backend %s %s." }
30393D:string { "Backend %s: %d %s." }
Expand Down
6 changes: 6 additions & 0 deletions src/tape_drivers/linux/sg/sg_tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,12 @@ int sg_load(void *device, struct tc_position *pos)
priv->cart_type = buf[2];
}

ret = is_known_tape_type(priv->cart_type);
if (ret == -LTFS_UNSUPPORTED_CART) {
priv->cart_type = assume_cart_type(priv->density_code);
ltfsmsg(LTFS_INFO, 30298I, priv->cart_type, priv->density_code);
}

if (priv->cart_type == 0x00) {
ltfsmsg(LTFS_WARN, 30265W);
ltfs_profiler_add_entry(priv->profiler, NULL, TAPEBEND_REQ_EXIT(REQ_TC_LOAD));
Expand Down
31 changes: 31 additions & 0 deletions src/tape_drivers/vendor_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,37 @@ int is_supported_tape(unsigned char type, unsigned char density, bool *is_worm)
return ret;
}

int is_known_tape_type(unsigned char type)
{
// Thought about using supported_cart[] here, but it does not contain
// all known tape types. Different use case.
switch (type) {
case TC_MP_LTO1D_CART:
case TC_MP_LTO2D_CART:
case TC_MP_LTO3D_CART:
case TC_MP_LTO4D_CART:
case TC_MP_LTO5D_CART:
case TC_MP_LTO6D_CART:
case TC_MP_LTO7D_CART:
case TC_MP_LTO8D_CART:
case TC_MP_LTO9D_CART:
case TC_MP_LTO10D_CART:
case TC_MP_LTOP10D_CART:
case TC_MP_LTO3W_CART:
case TC_MP_LTO4W_CART:
case TC_MP_LTO5W_CART:
case TC_MP_LTO6W_CART:
case TC_MP_LTO7W_CART:
case TC_MP_LTO8W_CART:
case TC_MP_LTO9W_CART:
case TC_MP_LTO10W_CART:
return 0;
default:
return -LTFS_UNSUPPORTED_CART;
}
return 0;
}

void init_error_table(int vendor,
struct error_table **standard_table,
struct error_table **vendor_table)
Expand Down
1 change: 1 addition & 0 deletions src/tape_drivers/vendor_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct supported_device **get_supported_devs(int vendor);
bool drive_has_supported_fw(int vendor, int drive_type, const unsigned char * const revision);
unsigned char assume_cart_type(const unsigned char dc);
int is_supported_tape(unsigned char type, unsigned char density, bool *is_worm);
int is_known_tape_type(unsigned char type);

void init_error_table(int vendor,
struct error_table **standard_table,
Expand Down