dasdfmt: Check disk type before prompting for blocksize

Move check_disk() call before user input to fail fast
on unsupported or unavailable devices (FBA, read-only,
in-use, raw-track mode).

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Volkan Unal <vunal@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Volkan Unal
2026-06-26 19:07:55 +01:00
committed by Jan Höppner
parent c66495888d
commit e4a03c6f71

View File

@@ -1566,6 +1566,8 @@ int main(int argc, char *argv[])
g.ese = dasd_sys_ese(g.dev_node);
eval_format_mode();
check_disk();
/* Either let the user specify the blksize or get it from the kernel */
if (!g.blksize_specified) {
if (!(mode == FULL ||
@@ -1587,8 +1589,6 @@ int main(int argc, char *argv[])
error("VOLSER not found on device %s", g.dev_path);
}
check_disk();
if (check_param(str, ERR_LENGTH, &format_params) < 0)
error("%s", str);