kern
diff src/ata.c @ 83:4ef83db5f4cd
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 06 Dec 2011 15:53:57 +0200 |
parents | 8b92b0c1c220 |
children | 379332fc1667 |
line diff
1.1 --- a/src/ata.c Tue Dec 06 13:45:32 2011 +0200 1.2 +++ b/src/ata.c Tue Dec 06 15:53:57 2011 +0200 1.3 @@ -1,6 +1,7 @@ 1.4 #include <stdio.h> 1.5 #include <stdlib.h> 1.6 #include <string.h> 1.7 +#include <ctype.h> 1.8 #include <inttypes.h> 1.9 #include <assert.h> 1.10 #include "ata.h" 1.11 @@ -126,8 +127,8 @@ 1.12 read_data(dev, info); 1.13 1.14 /* print model and serial */ 1.15 - printf("- found ata drive (%d,%d): %s\n", dev->iface, dev->id, atastr(textbuf, info + 27, 40)); 1.16 - printf(" s/n: %s\n", atastr(textbuf, info + 10, 20)); 1.17 + printf("ata%d: %s", (dev->iface << 1) | dev->id, atastr(textbuf, info + 27, 40)); 1.18 + printf(" [s/n: %s]", atastr(textbuf, info + 10, 20)); 1.19 1.20 dev->nsect_lba = *(uint32_t*)(info + 60); 1.21 dev->nsect_lba48 = *(uint64_t*)(info + 100) & 0xffffffffffffull; 1.22 @@ -143,7 +144,7 @@ 1.23 } else { 1.24 size_str(dev->nsect_lba, textbuf); 1.25 } 1.26 - printf(" size: %s\n", textbuf); 1.27 + printf(" size: %s\n", textbuf); 1.28 1.29 free(info); 1.30 return 0; 1.31 @@ -237,7 +238,9 @@ 1.32 *dptr++ = (*sptr & 0xff00) >> 8; 1.33 *dptr++ = *sptr++ & 0xff; 1.34 } 1.35 - *dptr = 0; 1.36 + 1.37 + while(isspace(*--dptr)); 1.38 + *++dptr = 0; 1.39 return res; 1.40 } 1.41