Browse Source

[S390] kernel: Convert upper case scpdata to lower case

If the CP SET LOADDEV on the 3215 console has been used to specify
SCPdata, all data is converted to upper case letters.

When scpdata contains upper case letters only, convert all letters
to lower case.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Hendrik Brueckner 15 years ago
parent
commit
18d00acfe2
1 changed files with 11 additions and 2 deletions
  1. 11 2
      arch/s390/kernel/ipl.c

+ 11 - 2
arch/s390/kernel/ipl.c

@@ -340,19 +340,28 @@ size_t reipl_append_ascii_scpdata(char *dest, size_t size,
 {
 {
 	size_t count;
 	size_t count;
 	size_t i;
 	size_t i;
+	int has_lowercase;
 
 
 	count = min(size - 1, scpdata_length(ipb->ipl_info.fcp.scp_data,
 	count = min(size - 1, scpdata_length(ipb->ipl_info.fcp.scp_data,
 					     ipb->ipl_info.fcp.scp_data_len));
 					     ipb->ipl_info.fcp.scp_data_len));
 	if (!count)
 	if (!count)
 		goto out;
 		goto out;
 
 
-	for (i = 0; i < count; i++)
+	has_lowercase = 0;
+	for (i = 0; i < count; i++) {
 		if (!isascii(ipb->ipl_info.fcp.scp_data[i])) {
 		if (!isascii(ipb->ipl_info.fcp.scp_data[i])) {
 			count = 0;
 			count = 0;
 			goto out;
 			goto out;
 		}
 		}
+		if (!has_lowercase && islower(ipb->ipl_info.fcp.scp_data[i]))
+			has_lowercase = 1;
+	}
 
 
-	memcpy(dest, ipb->ipl_info.fcp.scp_data, count);
+	if (has_lowercase)
+		memcpy(dest, ipb->ipl_info.fcp.scp_data, count);
+	else
+		for (i = 0; i < count; i++)
+			dest[i] = tolower(ipb->ipl_info.fcp.scp_data[i]);
 out:
 out:
 	dest[count] = '\0';
 	dest[count] = '\0';
 	return count;
 	return count;