hal/volume_id Makefile.am, 1.4, 1.5 cramfs.c, 1.1, 1.2 ext.c, 1.2,
1.3 fat.c, 1.3, 1.4 hfs.c, 1.2, 1.3 highpoint.c, 1.2,
1.3 hpfs.c, 1.1, 1.2 iso9660.c, 1.2, 1.3 jfs.c, 1.2,
1.3 linux_raid.c, 1.2, 1.3 linux_swap.c, 1.2, 1.3 luks.c, 1.3,
1.4 lvm.c, 1.2, 1.3 mac.c, 1.2, 1.3 minix.c, NONE, 1.1 minix.h,
NONE, 1.1 msdos.c, 1.2, 1.3 ntfs.c, 1.2, 1.3 reiserfs.c, 1.3,
1.4 romfs.c, 1.1, 1.2 sysv.c, 1.1, 1.2 udf.c, 1.2, 1.3 ufs.c,
1.2, 1.3 util.c, 1.3, 1.4 util.h, 1.3, 1.4 volume_id.c, 1.5,
1.6 volume_id.h, 1.6, 1.7 xfs.c, 1.2, 1.3
Kay Sievers
kay at freedesktop.org
Thu Mar 10 15:18:35 PST 2005
Update of /cvs/hal/hal/volume_id
In directory gabe:/tmp/cvs-serv28422/volume_id
Modified Files:
Makefile.am cramfs.c ext.c fat.c hfs.c highpoint.c hpfs.c
iso9660.c jfs.c linux_raid.c linux_swap.c luks.c lvm.c mac.c
msdos.c ntfs.c reiserfs.c romfs.c sysv.c udf.c ufs.c util.c
util.h volume_id.c volume_id.h xfs.c
Added Files:
minix.c minix.h
Log Message:
2005-03-11 Kay Sievers <kay.sievers at vrfy.org>
* volume_id/Makefile.am: add minix probing code
* volume_id/luks.c:
* volume_id/minix.c: New file.
* volume_id/minix.h: New file.
* volume_id/util.c: (volume_id_set_unicode16),
(volume_id_set_label_unicode16): Export unicode converter.
* volume_id/util.h: Export unicode converter.
* volume_id/volume_id.c: (volume_id_probe_all): Add minix.
* volume_id/volume_id.h: Version 41.
Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/volume_id/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 16 Feb 2005 22:40:47 -0000 1.4
+++ Makefile.am 10 Mar 2005 23:18:33 -0000 1.5
@@ -26,6 +26,7 @@
romfs.h romfs.c \
sysv.h sysv.c \
cramfs.h cramfs.c \
+ minix.h minix.c \
logging.h \
util.h util.c \
volume_id.h volume_id.c
Index: cramfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/cramfs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cramfs.c 16 Feb 2005 22:40:47 -0000 1.1
+++ cramfs.c 10 Mar 2005 23:18:33 -0000 1.2
@@ -58,7 +58,7 @@
{
struct cramfs_super *cs;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200);
if (cs == NULL)
Index: ext.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ext.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ext.c 16 Feb 2005 22:40:47 -0000 1.2
+++ ext.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -66,7 +66,7 @@
{
struct ext2_super_block *es;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200);
if (es == NULL)
Index: fat.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/fat.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fat.c 16 Feb 2005 22:40:47 -0000 1.3
+++ fat.c 10 Mar 2005 23:18:33 -0000 1.4
@@ -159,7 +159,7 @@
__u32 next;
int maxloop;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
if (vs == NULL)
@@ -257,7 +257,7 @@
/* the label may be an attribute in the root directory */
root_start = (reserved + fat_size) * sector_size;
- dbg("root dir start 0x%llx", root_start);
+ dbg("root dir start 0x%llx", (unsigned long long) root_start);
root_dir_entries = le16_to_cpu(vs->dir_entries);
dbg("expected entries 0x%x", root_dir_entries);
@@ -302,7 +302,7 @@
dbg("next cluster %u", next);
next_sect_off = (next - 2) * vs->sectors_per_cluster;
next_off = (start_data_sect + next_sect_off) * sector_size;
- dbg("cluster offset 0x%llx", next_off);
+ dbg("cluster offset 0x%llx", (unsigned long long) next_off);
/* get cluster */
buf = volume_id_get_buffer(id, off + next_off, buf_size);
Index: hfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/hfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hfs.c 16 Feb 2005 22:40:47 -0000 1.2
+++ hfs.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -173,7 +173,7 @@
struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
const __u8 *buf;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200);
if (buf == NULL)
@@ -196,7 +196,7 @@
off += (alloc_first_block * 512) +
(embed_first_block * alloc_block_size);
- dbg("hfs wrapped hfs+ found at offset 0x%llx", off);
+ dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200);
if (buf == NULL)
Index: highpoint.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/highpoint.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- highpoint.c 16 Feb 2005 22:40:47 -0000 1.2
+++ highpoint.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -54,7 +54,7 @@
{
const __u8 *buf;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200);
if (buf == NULL)
Index: hpfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/hpfs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hpfs.c 16 Feb 2005 22:40:47 -0000 1.1
+++ hpfs.c 10 Mar 2005 23:18:33 -0000 1.2
@@ -51,14 +51,14 @@
{
struct hpfs_super *hs;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200);
if (hs == NULL)
return -1;
if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) {
- snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u", hs->version);
+ sprintf(id->type_version, "%u", hs->version);
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
id->type = "hpfs";
Index: iso9660.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/iso9660.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- iso9660.c 16 Feb 2005 22:40:47 -0000 1.2
+++ iso9660.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -47,68 +47,86 @@
#define ISO_VD_END 0xff
#define ISO_VD_MAX 16
-union iso_super_block {
- struct iso_header {
- __u8 type;
- __u8 id[5];
- __u8 version;
- __u8 unused1;
- __u8 system_id[32];
- __u8 volume_id[32];
- } __attribute__((__packed__)) iso;
- struct hs_header {
- __u8 foo[8];
- __u8 type;
- __u8 id[4];
- __u8 version;
- } __attribute__((__packed__)) hs;
+struct iso_volume_descriptor {
+ __u8 vd_type;
+ __u8 vd_id[5];
+ __u8 vd_version;
+ __u8 flags;
+ __u8 system_id[32];
+ __u8 volume_id[32];
+ __u8 unused[8];
+ __u8 space_size[8];
+ __u8 escape_sequences[8];
+} __attribute__((__packed__));
+
+struct high_sierra_volume_descriptor {
+ __u8 foo[8];
+ __u8 type;
+ __u8 id[4];
+ __u8 version;
} __attribute__((__packed__));
int volume_id_probe_iso9660(struct volume_id *id, __u64 off)
{
- union iso_super_block *is;
+ __u8 *buf;
+ struct iso_volume_descriptor *is;
+ struct high_sierra_volume_descriptor *hs;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
- is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200);
- if (is == NULL)
+ buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200);
+ if (buf == NULL)
return -1;
- if (memcmp(is->iso.id, "CD001", 5) == 0) {
- char root_label[VOLUME_ID_LABEL_SIZE+1];
+ is = (struct iso_volume_descriptor *) buf;
+
+ if (memcmp(is->vd_id, "CD001", 5) == 0) {
int vd_offset;
int i;
- int found_svd;
- memset(root_label, 0, sizeof(root_label));
- strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1);
+ dbg("read label from PVD");
+ volume_id_set_label_raw(id, is->volume_id, 32);
+ volume_id_set_label_string(id, is->volume_id, 32);
- found_svd = 0;
+ dbg("looking for SVDs");
vd_offset = ISO_VD_OFFSET;
for (i = 0; i < ISO_VD_MAX; i++) {
- is = (union iso_super_block *) volume_id_get_buffer(id, off + vd_offset, 0x200);
- if (is == NULL || is->iso.type == ISO_VD_END)
- break;
- if (is->iso.type == ISO_VD_SUPPLEMENTARY) {
- dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset);
- volume_id_set_label_raw(id, is->iso.volume_id, 32);
- volume_id_set_label_unicode16(id, is->iso.volume_id, BE, 32);
- found_svd = 1;
+ char svd_label[64];
+
+ is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200);
+ if (is == NULL || is->vd_type == ISO_VD_END)
break;
+ if (is->vd_type != ISO_VD_SUPPLEMENTARY)
+ continue;
+
+ dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset));
+ if (memcmp(is->escape_sequences, "%/@", 3) == 0||
+ memcmp(is->escape_sequences, "%/C", 3) == 0||
+ memcmp(is->escape_sequences, "%/E", 3) == 0) {
+ dbg("Joliet extension found");
+ volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32);
+ if (memcmp(id->label, svd_label, 16) == 0) {
+ dbg("SVD label is identical, use the possibly longer PVD one");
+ break;
+ }
+
+ volume_id_set_label_raw(id, is->volume_id, 32);
+ volume_id_set_label_string(id, svd_label, 32);
+ strcpy(id->type_version, "Joliet Extension");
+ goto found;
}
vd_offset += ISO_SECTOR_SIZE;
}
-
- if (!found_svd ||
- (found_svd && !memcmp(root_label, id->label, 16)))
- {
- volume_id_set_label_raw(id, root_label, 32);
- volume_id_set_label_string(id, root_label, 32);
- }
goto found;
}
- if (memcmp(is->hs.id, "CDROM", 5) == 0)
+
+ hs = (struct high_sierra_volume_descriptor *) buf;
+
+ if (memcmp(hs->id, "CDROM", 5) == 0) {
+ strcpy(id->type_version, "High Sierra");
goto found;
+ }
+
return -1;
found:
Index: jfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/jfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- jfs.c 16 Feb 2005 22:40:47 -0000 1.2
+++ jfs.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -58,7 +58,7 @@
{
struct jfs_super_block *js;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200);
if (js == NULL)
Index: linux_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/linux_raid.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- linux_raid.c 16 Feb 2005 22:40:47 -0000 1.2
+++ linux_raid.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -67,7 +67,7 @@
__u64 sboff;
__u8 uuid[16];
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
if (size < 0x10000)
return -1;
Index: linux_swap.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/linux_swap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- linux_swap.c 16 Feb 2005 22:40:47 -0000 1.2
+++ linux_swap.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -55,7 +55,7 @@
const __u8 *buf;
unsigned int page;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
/* the swap signature is at the end of the PAGE_SIZE */
for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) {
Index: luks.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/luks.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- luks.c 4 Mar 2005 00:42:00 -0000 1.3
+++ luks.c 10 Mar 2005 23:18:33 -0000 1.4
@@ -26,7 +26,6 @@
# include <config.h>
#endif
-#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -50,29 +49,29 @@
#define LUKS_SALTSIZE 32
#define LUKS_NUMKEYS 8
-const unsigned char LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
+const __u8 LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
#define LUKS_MAGIC_L 6
#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1)
#define UUID_STRING_L 40
struct luks_phdr {
- char magic[LUKS_MAGIC_L];
- uint16_t version;
- char cipherName[LUKS_CIPHERNAME_L];
- char cipherMode[LUKS_CIPHERMODE_L];
- char hashSpec[LUKS_HASHSPEC_L];
- uint32_t payloadOffset;
- uint32_t keyBytes;
- char mkDigest[LUKS_DIGESTSIZE];
- char mkDigestSalt[LUKS_SALTSIZE];
- uint32_t mkDigestIterations;
- char uuid[UUID_STRING_L];
+ __u8 magic[LUKS_MAGIC_L];
+ __u16 version;
+ __u8 cipherName[LUKS_CIPHERNAME_L];
+ __u8 cipherMode[LUKS_CIPHERMODE_L];
+ __u8 hashSpec[LUKS_HASHSPEC_L];
+ __u32 payloadOffset;
+ __u32 keyBytes;
+ __u8 mkDigest[LUKS_DIGESTSIZE];
+ __u8 mkDigestSalt[LUKS_SALTSIZE];
+ __u32 mkDigestIterations;
+ __u8 uuid[UUID_STRING_L];
struct {
- uint32_t active;
- uint32_t passwordIterations;
- char passwordSalt[LUKS_SALTSIZE];
- uint32_t keyMaterialOffset;
- uint32_t stripes;
+ __u32 active;
+ __u32 passwordIterations;
+ __u8 passwordSalt[LUKS_SALTSIZE];
+ __u32 keyMaterialOffset;
+ __u32 stripes;
} keyblock[LUKS_NUMKEYS];
};
Index: lvm.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/lvm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- lvm.c 16 Feb 2005 22:40:47 -0000 1.2
+++ lvm.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -59,7 +59,7 @@
const __u8 *buf;
struct lvm1_super_block *lvm;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800);
if (buf == NULL)
@@ -85,7 +85,7 @@
unsigned int soff;
struct lvm2_super_block *lvm;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200);
if (buf == NULL)
Index: mac.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/mac.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mac.c 16 Feb 2005 22:40:47 -0000 1.2
+++ mac.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -61,7 +61,7 @@
struct mac_driver_desc *driver;
struct mac_partition *part;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off, 0x200);
if (buf == NULL)
@@ -122,7 +122,7 @@
poff = be32_to_cpu(part->start_block) * bsize;
plen = be32_to_cpu(part->block_count) * bsize;
dbg("found '%s' partition entry at 0x%llx, len 0x%llx",
- part->type, poff, plen);
+ part->type, (unsigned long long) poff, (unsigned long long) plen);
id->partitions[i].off = poff;
id->partitions[i].len = plen;
--- NEW FILE: minix.c ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <asm/types.h>
#include "volume_id.h"
#include "logging.h"
#include "util.h"
#include "minix.h"
struct minix_super_block
{
__u16 s_ninodes;
__u16 s_nzones;
__u16 s_imap_blocks;
__u16 s_zmap_blocks;
__u16 s_firstdatazone;
__u16 s_log_zone_size;
__u32 s_max_size;
__u16 s_magic;
__u16 s_state;
__u32 s_zones;
} __attribute__((__packed__));
#define MINIX_SUPERBLOCK_OFFSET 0x400
int volume_id_probe_minix(struct volume_id *id, __u64 off)
{
struct minix_super_block *ms;
dbg("probing at offset 0x%llx", (unsigned long long) off);
ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200);
if (ms == NULL)
return -1;
if (le16_to_cpu(ms->s_magic) == 0x137f) {
strcpy(id->type_version, "1");
goto found;
}
if (le16_to_cpu(ms->s_magic) == 0x1387) {
strcpy(id->type_version, "1");
goto found;
}
if (le16_to_cpu(ms->s_magic) == 0x2468) {
strcpy(id->type_version, "2");
goto found;
}
if (le16_to_cpu(ms->s_magic) == 0x2478) {
strcpy(id->type_version, "2");
goto found;
}
goto exit;
found:
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
id->type = "minix";
return 0;
exit:
return -1;
}
--- NEW FILE: minix.h ---
/*
* volume_id - reads filesystem label and uuid
*
* Copyright (C) 2005 Kay Sievers <kay.sievers at vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _VOLUME_ID_MINIX_
#define _VOLUME_ID_MINIX_
extern int volume_id_probe_minix(struct volume_id *id, __u64 off);
#endif
Index: msdos.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/msdos.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- msdos.c 16 Feb 2005 22:40:47 -0000 1.2
+++ msdos.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -81,7 +81,7 @@
struct msdos_partition_entry *part;
struct volume_id_partition *p;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off, 0x200);
if (buf == NULL)
@@ -124,14 +124,14 @@
p->partition_type_raw = part[i].sys_ind;
if (is_extended(part[i].sys_ind)) {
- dbg("found extended partition at 0x%llx", poff);
+ dbg("found extended partition at 0x%llx", (unsigned long long) poff);
volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE);
p->type = "msdos_extended_partition";
if (extended == 0)
extended = off + poff;
} else {
dbg("found 0x%x data partition at 0x%llx, len 0x%llx",
- part[i].sys_ind, poff, plen);
+ part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen);
if (is_raid(part[i].sys_ind))
volume_id_set_usage_part(p, VOLUME_ID_RAID);
@@ -174,12 +174,12 @@
continue;
if (is_extended(part[i].sys_ind)) {
- dbg("found extended partition at 0x%llx", poff);
+ dbg("found extended partition at 0x%llx", (unsigned long long) poff);
if (next == 0)
next = extended + poff;
} else {
dbg("found 0x%x data partition at 0x%llx, len 0x%llx",
- part[i].sys_ind, poff, plen);
+ part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen);
/* we always start at the 5th entry */
while (id->partition_count < 4)
Index: ntfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ntfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ntfs.c 16 Feb 2005 22:40:47 -0000 1.2
+++ ntfs.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -118,7 +118,7 @@
const __u8 *buf;
const __u8 *val;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200);
if (ns == NULL)
@@ -142,8 +142,8 @@
dbg("sectorsize 0x%x", sector_size);
dbg("clustersize 0x%x", cluster_size);
- dbg("mftcluster %lli", mft_cluster);
- dbg("mftoffset 0x%llx", mft_off);
+ dbg("mftcluster %llu", (unsigned long long) mft_cluster);
+ dbg("mftoffset 0x%llx", (unsigned long long) mft_off);
dbg("cluster per mft_record %i", ns->cluster_per_mft_record);
dbg("mft record size %i", mft_record_size);
Index: reiserfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/reiserfs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- reiserfs.c 25 Feb 2005 17:21:48 -0000 1.3
+++ reiserfs.c 10 Mar 2005 23:18:33 -0000 1.4
@@ -73,7 +73,7 @@
struct reiser4_super_block *rs4;
__u8 *buf;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
if (buf == NULL)
Index: romfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/romfs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- romfs.c 16 Feb 2005 22:40:47 -0000 1.1
+++ romfs.c 10 Mar 2005 23:18:33 -0000 1.2
@@ -50,7 +50,7 @@
{
struct romfs_super *rfs;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200);
if (rfs == NULL)
Index: sysv.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/sysv.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- sysv.c 16 Feb 2005 22:40:47 -0000 1.1
+++ sysv.c 10 Mar 2005 23:18:33 -0000 1.2
@@ -108,7 +108,7 @@
struct xenix_super *xs;
unsigned int boff;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) {
vs = (struct sysv_super *)
Index: udf.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/udf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- udf.c 16 Feb 2005 22:40:47 -0000 1.2
+++ udf.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -85,7 +85,7 @@
unsigned int loc;
unsigned int clen;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200);
if (vsd == NULL)
Index: ufs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ufs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ufs.c 16 Feb 2005 22:40:47 -0000 1.2
+++ ufs.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -188,7 +188,7 @@
struct ufs_super_block *ufs;
int offsets[] = {0, 8, 64, 256, -1};
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
for (i = 0; offsets[i] >= 0; i++) {
ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800);
Index: util.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/util.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- util.c 4 Mar 2005 00:42:00 -0000 1.3
+++ util.c 10 Mar 2005 23:18:33 -0000 1.4
@@ -40,6 +40,40 @@
#include "logging.h"
#include "util.h"
+void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum endian endianess, unsigned int count)
+{
+ unsigned int i, j;
+ __u16 c;
+
+ j = 0;
+ for (i = 0; i + 2 <= count; i += 2) {
+ if (endianess == LE)
+ c = (buf[i+1] << 8) | buf[i];
+ else
+ c = (buf[i] << 8) | buf[i+1];
+ if (c == 0) {
+ str[j] = '\0';
+ break;
+ } else if (c < 0x80) {
+ if (j+1 >= len)
+ break;
+ str[j++] = (__u8) c;
+ } else if (c < 0x800) {
+ if (j+2 >= len)
+ break;
+ str[j++] = (__u8) (0xc0 | (c >> 6));
+ str[j++] = (__u8) (0x80 | (c & 0x3f));
+ } else {
+ if (j+3 >= len)
+ break;
+ str[j++] = (__u8) (0xe0 | (c >> 12));
+ str[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f));
+ str[j++] = (__u8) (0x80 | (c & 0x3f));
+ }
+ }
+ str[j] = '\0';
+}
+
static char *usage_to_string(enum volume_id_usage usage_id)
{
switch (usage_id) {
@@ -98,29 +132,7 @@
void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count)
{
- unsigned int i, j;
- __u16 c;
-
- j = 0;
- for (i = 0; i + 2 <= count; i += 2) {
- if (endianess == LE)
- c = (buf[i+1] << 8) | buf[i];
- else
- c = (buf[i] << 8) | buf[i+1];
- if (c == 0) {
- id->label[j] = '\0';
- break;
- } else if (c < 0x80) {
- id->label[j++] = (__u8) c;
- } else if (c < 0x800) {
- id->label[j++] = (__u8) (0xc0 | (c >> 6));
- id->label[j++] = (__u8) (0x80 | (c & 0x3f));
- } else {
- id->label[j++] = (__u8) (0xe0 | (c >> 12));
- id->label[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f));
- id->label[j++] = (__u8) (0x80 | (c & 0x3f));
- }
- }
+ volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count);
}
void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format)
@@ -188,7 +200,7 @@
{
unsigned int buf_len;
- dbg("get buffer off 0x%llx(%llu), len 0x%x", off, off, len);
+ dbg("get buffer off 0x%llx(%llu), len 0x%x", (unsigned long long) off, (unsigned long long) off, len);
/* check if requested area fits in superblock buffer */
if (off + len <= SB_BUFFER_SIZE) {
if (id->sbbuf == NULL) {
@@ -199,7 +211,7 @@
/* check if we need to read */
if ((off + len) > id->sbbuf_len) {
- dbg("read sbbuf len:0x%llx", off + len);
+ dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len));
lseek(id->fd, 0, SEEK_SET);
buf_len = read(id->fd, id->sbbuf, off + len);
dbg("got 0x%x (%i) bytes", buf_len, buf_len);
@@ -224,7 +236,7 @@
/* check if we need to read */
if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) {
- dbg("read seekbuf off:0x%llx len:0x%x", off, len);
+ dbg("read seekbuf off:0x%llx len:0x%x", (unsigned long long) off, len);
if (lseek(id->fd, off, SEEK_SET) == -1)
return NULL;
buf_len = read(id->fd, id->seekbuf, len);
Index: util.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/util.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- util.h 4 Mar 2005 00:42:00 -0000 1.3
+++ util.h 10 Mar 2005 23:18:33 -0000 1.4
@@ -83,6 +83,7 @@
BE = 1
};
+extern void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum endian endianess, unsigned int count);
extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id);
extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id);
extern void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count);
Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- volume_id.c 4 Mar 2005 00:42:00 -0000 1.5
+++ volume_id.c 10 Mar 2005 23:18:33 -0000 1.6
@@ -60,6 +60,7 @@
#include "hpfs.h"
#include "romfs.h"
#include "sysv.h"
+#include "minix.h"
#include "mac.h"
#include "msdos.h"
@@ -136,6 +137,9 @@
if (volume_id_probe_sysv(id, off) == 0)
goto exit;
+ if (volume_id_probe_minix(id, off) == 0)
+ goto exit;
+
return -1;
exit:
Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- volume_id.h 4 Mar 2005 00:42:00 -0000 1.6
+++ volume_id.h 10 Mar 2005 23:18:33 -0000 1.7
@@ -21,7 +21,7 @@
#ifndef _VOLUME_ID_H_
#define _VOLUME_ID_H_
-#define VOLUME_ID_VERSION 37
+#define VOLUME_ID_VERSION 41
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 36
Index: xfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/xfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xfs.c 16 Feb 2005 22:40:47 -0000 1.2
+++ xfs.c 10 Mar 2005 23:18:33 -0000 1.3
@@ -58,7 +58,7 @@
{
struct xfs_super_block *xs;
- dbg("probing at offset %llu", off);
+ dbg("probing at offset 0x%llx", (unsigned long long) off);
xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200);
if (xs == NULL)
More information about the hal-commit
mailing list