LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: oakad@exemail.com.au To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, Alex Dubov <oakad@yahoo.com> Subject: [PATCH 08/11] memstick: add support for decoding "specfile" media attributes Date: Wed, 5 Mar 2008 03:02:25 +1100 [thread overview] Message-ID: <1204646548-27466-9-git-send-email-oakad@exemail.com.au> (raw) In-Reply-To: <1204646548-27466-8-git-send-email-oakad@exemail.com.au> From: Alex Dubov <oakad@yahoo.com> Signed-off-by: Alex Dubov <oakad@yahoo.com> --- 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 00e74ea..2381c5d 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c @@ -109,6 +109,17 @@ struct mspro_mbr { unsigned int sectors_per_partition; } __attribute__((packed)); +struct mspro_specfile { + char name[8]; + char ext[3]; + unsigned char attr; + unsigned char reserved[10]; + unsigned short time; + unsigned short date; + unsigned short cluster; + unsigned int size; +} __attribute__((packed)); + struct mspro_devinfo { unsigned short cylinders; unsigned short heads; @@ -397,6 +408,41 @@ static ssize_t mspro_block_attr_show_mbr(struct device *dev, return rc; } +static ssize_t mspro_block_attr_show_specfile(struct device *dev, + struct device_attribute *attr, + char *buffer) +{ + struct mspro_sys_attr *x_attr = container_of(attr, + struct mspro_sys_attr, + dev_attr); + struct mspro_specfile *x_spfile = x_attr->data; + char name[9], ext[4]; + ssize_t rc = 0; + + memcpy(name, x_spfile->name, 8); + name[8] = 0; + memcpy(ext, x_spfile->ext, 3); + ext[3] = 0; + + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "name: %s\n", name); + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "ext: %s\n", ext); + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "attribute: %x\n", + x_spfile->attr); + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "time: %d:%d:%d\n", + x_spfile->time >> 11, + (x_spfile->time >> 5) & 0x3f, + (x_spfile->time & 0x1f) * 2); + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "date: %d-%d-%d\n", + (x_spfile->date >> 9) + 1980, + (x_spfile->date >> 5) & 0xf, + x_spfile->date & 0x1f); + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start cluster: %x\n", + x_spfile->cluster); + rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "size: %x\n", + x_spfile->size); + return rc; +} + static ssize_t mspro_block_attr_show_devinfo(struct device *dev, struct device_attribute *attr, char *buffer) @@ -429,6 +475,9 @@ static sysfs_show_t mspro_block_attr_show(unsigned char tag) return mspro_block_attr_show_modelname; case MSPRO_BLOCK_ID_MBR: return mspro_block_attr_show_mbr; + case MSPRO_BLOCK_ID_SPECFILEVALUES1: + case MSPRO_BLOCK_ID_SPECFILEVALUES2: + return mspro_block_attr_show_specfile; case MSPRO_BLOCK_ID_DEVINFO: return mspro_block_attr_show_devinfo; default: -- 1.5.3.6
next prev parent reply other threads:[~2008-03-04 16:33 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-03-04 16:02 MemoryStick driver updates oakad 2008-03-04 16:02 ` [PATCH 01/11] memstick: introduce correct definitions in the header oakad 2008-03-04 16:02 ` [PATCH 02/11] memstick: add memstick_suspend/resume_host methods oakad 2008-03-04 16:02 ` [PATCH 03/11] memstick: make sure number of command retries is exactly as specified oakad 2008-03-04 16:02 ` [PATCH 04/11] memstick: drop DRIVER_VERSION numbers as meaningless oakad 2008-03-04 16:02 ` [PATCH 05/11] tifm: fix the MemoryStick host fifo handling code oakad 2008-03-04 16:02 ` [PATCH 06/11] tifm: fix memorystick host initialization code oakad 2008-03-04 16:02 ` [PATCH 07/11] tifm: clear interrupt mask bits before setting them on adapter init oakad 2008-03-04 16:02 ` oakad [this message] 2008-03-04 16:02 ` [PATCH 09/11] memstick: fix parsing of "assembly_date" attribute field oakad 2008-03-04 16:02 ` [PATCH 10/11] memstick: try harder to recover from unsuccessful interface mode switch oakad 2008-03-04 16:02 ` [PATCH 11/11] memstick: add support for JMicron jmb38x MemoryStick host controller oakad 2008-03-05 23:17 ` Andrew Morton 2008-03-05 22:59 ` [PATCH 05/11] tifm: fix the MemoryStick host fifo handling code Andrew Morton 2008-03-05 23:21 ` MemoryStick driver updates Andrew Morton
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1204646548-27466-9-git-send-email-oakad@exemail.com.au \ --to=oakad@exemail.com.au \ --cc=akpm@linux-foundation.org \ --cc=linux-kernel@vger.kernel.org \ --cc=oakad@yahoo.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).