5 * ata_id_string - Convert IDENTIFY DEVICE page into string
6 * @id: IDENTIFY DEVICE results we will examine
7 * @s: string into which data is output
8 * @ofs: offset into identify device page
9 * @len: length of string to return. must be an even number.
11 * The strings in the IDENTIFY DEVICE page are broken up into
12 * 16-bit chunks. Run through the string, and output each
13 * 8-bit chunk linearly, regardless of platform.
18 void ata_id_string(const uint16_t * id
, unsigned char *s
,
19 unsigned int ofs
, unsigned int len
)
38 * ata_id_c_string - Convert IDENTIFY DEVICE page into C string
39 * @id: IDENTIFY DEVICE results we will examine
40 * @s: string into which data is output
41 * @ofs: offset into identify device page
42 * @len: length of string to return. must be an odd number.
44 * This function is identical to ata_id_string except that it
45 * trims trailing spaces and terminates the resulting string with
46 * null. @len must be actual maximum length (even number) + 1.
51 void ata_id_c_string(const uint16_t * id
, unsigned char *s
,
52 unsigned int ofs
, unsigned int len
)
56 ata_id_string(id
, s
, ofs
, len
- 1);
58 p
= s
+ strnlen((const char *)s
, len
- 1);
59 while (p
> s
&& p
[-1] == ' ')