* [PATCH] volume_id: HPFS code clean up
@ 2008-12-03 10:49 Karel Zak
2008-12-03 14:35 ` Kay Sievers
2008-12-03 14:55 ` Karel Zak
0 siblings, 2 replies; 3+ messages in thread
From: Karel Zak @ 2008-12-03 10:49 UTC (permalink / raw)
To: linux-hotplug
* fix typo (hs vs. hbb)
* set id->{version,usage,type} when all tests pass
* be paranoid and don't use hs->version when "hs" source buffer was
possibly modified by next volume_id_get_buffer() call.
Signed-off-by: Karel Zak <kzak@redhat.com>
---
| 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
--git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c
index ce9118d..0f0770f 100644
--- a/extras/volume_id/lib/hpfs.c
+++ b/extras/volume_id/lib/hpfs.c
@@ -79,6 +79,7 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size)
struct hpfs_super *hs;
struct hpfs_spare_super *hss;
struct hpfs_boot_block *hbb;
+ uint8_t version;
info("probing at offset 0x%" PRIx64 "\n", off);
@@ -94,13 +95,11 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size)
if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0)
return -1;
- sprintf(id->type_version, "%u", hs->version);
- volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
- id->type = "hpfs";
+ version = hs->version;
/* if boot block looks valid, read label and uuid from there */
hbb = (struct hpfs_boot_block *) volume_id_get_buffer(id, off, 0x200);
- if (hs = NULL)
+ if (hbb = NULL)
return -1;
if (memcmp(hbb->magic, "\x55\xaa", 2) = 0 &&
memcmp(hbb->sig_hpfs, "HPFS", 4) = 0 &&
@@ -109,6 +108,9 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size)
volume_id_set_label_string(id, hbb->vol_label, 11);
volume_id_set_uuid(id, hbb->vol_serno, 0, UUID_DOS);
}
+ sprintf(id->type_version, "%u", version);
+ volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+ id->type = "hpfs";
return 0;
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] volume_id: HPFS code clean up
2008-12-03 10:49 [PATCH] volume_id: HPFS code clean up Karel Zak
@ 2008-12-03 14:35 ` Kay Sievers
2008-12-03 14:55 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Kay Sievers @ 2008-12-03 14:35 UTC (permalink / raw)
To: linux-hotplug
On Wed, Dec 3, 2008 at 11:49, Karel Zak <kzak@redhat.com> wrote:
> * fix typo (hs vs. hbb)
>
> * set id->{version,usage,type} when all tests pass
>
> * be paranoid and don't use hs->version when "hs" source buffer was
> possibly modified by next volume_id_get_buffer() call.
Applied. And I sent you a small HPFS image for your collection. :)
Thanks,
Kay
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] volume_id: HPFS code clean up
2008-12-03 10:49 [PATCH] volume_id: HPFS code clean up Karel Zak
2008-12-03 14:35 ` Kay Sievers
@ 2008-12-03 14:55 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2008-12-03 14:55 UTC (permalink / raw)
To: linux-hotplug
On Wed, Dec 03, 2008 at 03:35:24PM +0100, Kay Sievers wrote:
> On Wed, Dec 3, 2008 at 11:49, Karel Zak <kzak@redhat.com> wrote:
> > * fix typo (hs vs. hbb)
> >
> > * set id->{version,usage,type} when all tests pass
> >
> > * be paranoid and don't use hs->version when "hs" source buffer was
> > possibly modified by next volume_id_get_buffer() call.
>
> Applied. And I sent you a small HPFS image for your collection. :)
...and netware. I love it. Thanks! :-)
Karel
--
Karel Zak <kzak@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-03 14:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 10:49 [PATCH] volume_id: HPFS code clean up Karel Zak
2008-12-03 14:35 ` Kay Sievers
2008-12-03 14:55 ` Karel Zak
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).