diff options
Diffstat (limited to 'drivers/memstick')
-rw-r--r-- | drivers/memstick/core/mspro_block.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 00e74ea4dd51..2381c5d7275b 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -109,6 +109,17 @@ struct mspro_mbr { | |||
109 | unsigned int sectors_per_partition; | 109 | unsigned int sectors_per_partition; |
110 | } __attribute__((packed)); | 110 | } __attribute__((packed)); |
111 | 111 | ||
112 | struct mspro_specfile { | ||
113 | char name[8]; | ||
114 | char ext[3]; | ||
115 | unsigned char attr; | ||
116 | unsigned char reserved[10]; | ||
117 | unsigned short time; | ||
118 | unsigned short date; | ||
119 | unsigned short cluster; | ||
120 | unsigned int size; | ||
121 | } __attribute__((packed)); | ||
122 | |||
112 | struct mspro_devinfo { | 123 | struct mspro_devinfo { |
113 | unsigned short cylinders; | 124 | unsigned short cylinders; |
114 | unsigned short heads; | 125 | unsigned short heads; |
@@ -397,6 +408,41 @@ static ssize_t mspro_block_attr_show_mbr(struct device *dev, | |||
397 | return rc; | 408 | return rc; |
398 | } | 409 | } |
399 | 410 | ||
411 | static ssize_t mspro_block_attr_show_specfile(struct device *dev, | ||
412 | struct device_attribute *attr, | ||
413 | char *buffer) | ||
414 | { | ||
415 | struct mspro_sys_attr *x_attr = container_of(attr, | ||
416 | struct mspro_sys_attr, | ||
417 | dev_attr); | ||
418 | struct mspro_specfile *x_spfile = x_attr->data; | ||
419 | char name[9], ext[4]; | ||
420 | ssize_t rc = 0; | ||
421 | |||
422 | memcpy(name, x_spfile->name, 8); | ||
423 | name[8] = 0; | ||
424 | memcpy(ext, x_spfile->ext, 3); | ||
425 | ext[3] = 0; | ||
426 | |||
427 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "name: %s\n", name); | ||
428 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "ext: %s\n", ext); | ||
429 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "attribute: %x\n", | ||
430 | x_spfile->attr); | ||
431 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "time: %d:%d:%d\n", | ||
432 | x_spfile->time >> 11, | ||
433 | (x_spfile->time >> 5) & 0x3f, | ||
434 | (x_spfile->time & 0x1f) * 2); | ||
435 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "date: %d-%d-%d\n", | ||
436 | (x_spfile->date >> 9) + 1980, | ||
437 | (x_spfile->date >> 5) & 0xf, | ||
438 | x_spfile->date & 0x1f); | ||
439 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start cluster: %x\n", | ||
440 | x_spfile->cluster); | ||
441 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "size: %x\n", | ||
442 | x_spfile->size); | ||
443 | return rc; | ||
444 | } | ||
445 | |||
400 | static ssize_t mspro_block_attr_show_devinfo(struct device *dev, | 446 | static ssize_t mspro_block_attr_show_devinfo(struct device *dev, |
401 | struct device_attribute *attr, | 447 | struct device_attribute *attr, |
402 | char *buffer) | 448 | char *buffer) |
@@ -429,6 +475,9 @@ static sysfs_show_t mspro_block_attr_show(unsigned char tag) | |||
429 | return mspro_block_attr_show_modelname; | 475 | return mspro_block_attr_show_modelname; |
430 | case MSPRO_BLOCK_ID_MBR: | 476 | case MSPRO_BLOCK_ID_MBR: |
431 | return mspro_block_attr_show_mbr; | 477 | return mspro_block_attr_show_mbr; |
478 | case MSPRO_BLOCK_ID_SPECFILEVALUES1: | ||
479 | case MSPRO_BLOCK_ID_SPECFILEVALUES2: | ||
480 | return mspro_block_attr_show_specfile; | ||
432 | case MSPRO_BLOCK_ID_DEVINFO: | 481 | case MSPRO_BLOCK_ID_DEVINFO: |
433 | return mspro_block_attr_show_devinfo; | 482 | return mspro_block_attr_show_devinfo; |
434 | default: | 483 | default: |