libvolume_id: add parameter 'size' to all probe functions

This commit is contained in:
Kay Sievers 2006-07-25 14:59:50 +02:00
parent b437ec958a
commit cdf1894863
28 changed files with 106 additions and 106 deletions

View File

@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_LIB = ${INSTALL} -m 755
SHLIB_CUR = 0
SHLIB_REV = 67
SHLIB_REV = 68
SHLIB_AGE = 0
SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)

View File

@ -41,7 +41,7 @@ struct cramfs_super {
uint8_t name[16];
} PACKED;
int volume_id_probe_cramfs(struct volume_id *id, uint64_t off)
int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct cramfs_super *cs;

View File

@ -70,7 +70,7 @@ struct ext2_super_block {
#define EXT3_MIN_BLOCK_SIZE 0x400
#define EXT3_MAX_BLOCK_SIZE 0x1000
int volume_id_probe_ext(struct volume_id *id, uint64_t off)
int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size)
{
struct ext2_super_block *es;
size_t bsize;

View File

@ -133,7 +133,7 @@ static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int coun
return NULL;
}
int volume_id_probe_vfat(struct volume_id *id, uint64_t off)
int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size)
{
struct vfat_super_block *vs;
struct vfat_dir_entry *dir;

View File

@ -109,12 +109,12 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v
return -1;
}
int volume_id_probe_gfs(struct volume_id *id, uint64_t off)
int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size)
{
return volume_id_probe_gfs_generic(id, off, 1);
}
int volume_id_probe_gfs2(struct volume_id *id, uint64_t off)
int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size)
{
return volume_id_probe_gfs_generic(id, off, 2);
}

View File

@ -137,7 +137,7 @@ static struct hfsplus_vol_header {
#define HFS_NODE_LEAF 0xff
#define HFSPLUS_POR_CNID 1
int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off)
int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size)
{
unsigned int blocksize;
unsigned int cat_block;

View File

@ -43,7 +43,7 @@ struct hpt45x_meta {
#define HPT45X_MAGIC_BAD 0x5a7816fd
int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off)
int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size)
{
const uint8_t *buf;
struct hpt37x_meta *hpt;

View File

@ -34,7 +34,7 @@ struct hpfs_super
#define HPFS_SUPERBLOCK_OFFSET 0x2000
int volume_id_probe_hpfs(struct volume_id *id, uint64_t off)
int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct hpfs_super *hs;

View File

@ -53,7 +53,7 @@ struct high_sierra_volume_descriptor {
uint8_t version;
} PACKED;
int volume_id_probe_iso9660(struct volume_id *id, uint64_t off)
int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size)
{
uint8_t *buf;
struct iso_volume_descriptor *is;

View File

@ -41,7 +41,7 @@ struct jfs_super_block {
#define JFS_SUPERBLOCK_OFFSET 0x8000
int volume_id_probe_jfs(struct volume_id *id, uint64_t off)
int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct jfs_super_block *js;

View File

@ -69,41 +69,41 @@ extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t siz
extern void volume_id_close(struct volume_id *id);
/* filesystems */
extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ext(struct volume_id *id, uint64_t off);
extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off);
extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off);
extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off);
extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_minix(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off);
extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off);
extern int volume_id_probe_udf(struct volume_id *id, uint64_t off);
extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_netware(struct volume_id *id, uint64_t off);
extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off);
extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off);
extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size);
/* special formats */
extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off);
extern int volume_id_probe_luks(struct volume_id *id, uint64_t off);
extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size);
/* raid */
extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off);
extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off);
extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size);
/* bios raid */
extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off);
extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);

View File

@ -37,7 +37,7 @@ static struct swap_header_v1_2 {
#define LARGEST_PAGESIZE 0x4000
int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off)
int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size)
{
const uint8_t *buf;
unsigned int page;

View File

@ -62,7 +62,7 @@ struct luks_phdr {
} keyblock[LUKS_NUMKEYS];
};
int volume_id_probe_luks(struct volume_id *id, uint64_t off)
int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size)
{
struct luks_phdr *header;

View File

@ -41,7 +41,7 @@ struct lvm2_super_block {
#define LVM1_SB_OFF 0x400
#define LVM1_MAGIC "HM"
int volume_id_probe_lvm1(struct volume_id *id, uint64_t off)
int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size)
{
const uint8_t *buf;
struct lvm1_super_block *lvm;
@ -66,7 +66,7 @@ int volume_id_probe_lvm1(struct volume_id *id, uint64_t off)
#define LVM2_LABEL_ID "LABELONE"
#define LVM2LABEL_SCAN_SECTORS 4
int volume_id_probe_lvm2(struct volume_id *id, uint64_t off)
int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size)
{
const uint8_t *buf;
unsigned int soff;

View File

@ -42,7 +42,7 @@ struct minix_super_block
#define MINIX_SUPERBLOCK_OFFSET 0x400
int volume_id_probe_minix(struct volume_id *id, uint64_t off)
int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size)
{
struct minix_super_block *ms;

View File

@ -78,7 +78,7 @@ struct netware_super_block {
uint32_t reserved2[64-(2+46)];
} PACKED;
int volume_id_probe_netware(struct volume_id *id, uint64_t off)
int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size)
{
struct netware_super_block *nw;

View File

@ -90,7 +90,7 @@ static struct volume_info {
#define MFT_RECORD_ATTR_OBJECT_ID 0x40
#define MFT_RECORD_ATTR_END 0xffffffffu
int volume_id_probe_ntfs(struct volume_id *id, uint64_t off)
int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
{
unsigned int sector_size;
unsigned int cluster_size;

View File

@ -126,7 +126,7 @@ struct ocfs2_super_block {
uint8_t s_uuid[16];
} PACKED;
int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off)
int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size)
{
const uint8_t *buf;
struct ocfs1_super_block_header *osh;
@ -164,7 +164,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off)
#define OCFS2_MAX_BLOCKSIZE 0x1000
#define OCFS2_SUPER_BLOCK_BLKNO 2
int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off)
int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size)
{
const uint8_t *buf;
struct ocfs2_super_block *os;

View File

@ -54,7 +54,7 @@ struct reiser4_super_block {
#define REISERFS1_SUPERBLOCK_OFFSET 0x2000
#define REISERFS_SUPERBLOCK_OFFSET 0x10000
int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off)
int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct reiserfs_super_block *rs;
struct reiser4_super_block *rs4;

View File

@ -33,7 +33,7 @@ struct romfs_super {
uint8_t name[0];
} PACKED;
int volume_id_probe_romfs(struct volume_id *id, uint64_t off)
int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct romfs_super *rfs;

View File

@ -32,7 +32,7 @@ struct squashfs_super {
uint32_t s_magic;
} PACKED;
int volume_id_probe_squashfs(struct volume_id *id, uint64_t off)
int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct squashfs_super *sqs;

View File

@ -89,7 +89,7 @@ struct xenix_super {
#define XENIX_MAGIC 0x2b5544
#define SYSV_MAX_BLOCKSIZE 0x800
int volume_id_probe_sysv(struct volume_id *id, uint64_t off)
int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size)
{
struct sysv_super *vs;
struct xenix_super *xs;

View File

@ -61,7 +61,7 @@ struct volume_structure_descriptor {
#define UDF_VSD_OFFSET 0x8000
int volume_id_probe_udf(struct volume_id *id, uint64_t off)
int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size)
{
struct volume_descriptor *vd;
struct volume_structure_descriptor *vsd;

View File

@ -168,7 +168,7 @@ struct ufs_super_block {
#define UFS_MAGIC_FEA 0x00195612
#define UFS_MAGIC_LFN 0x00095014
int volume_id_probe_ufs(struct volume_id *id, uint64_t off)
int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size)
{
uint32_t magic;
int i;

View File

@ -77,13 +77,13 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
goto found;
}
if (volume_id_probe_lvm1(id, off) == 0)
if (volume_id_probe_lvm1(id, off, size) == 0)
goto found;
if (volume_id_probe_lvm2(id, off) == 0)
if (volume_id_probe_lvm2(id, off, size) == 0)
goto found;
if (volume_id_probe_highpoint_37x_raid(id, off) == 0)
if (volume_id_probe_highpoint_37x_raid(id, off, size) == 0)
goto found;
return -1;
@ -102,79 +102,79 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size
info("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
if (volume_id_probe_vfat(id, off) == 0)
if (volume_id_probe_vfat(id, off, size) == 0)
goto found;
/* fill buffer with maximum */
volume_id_get_buffer(id, 0, SB_BUFFER_SIZE);
if (volume_id_probe_linux_swap(id, off) == 0)
if (volume_id_probe_linux_swap(id, off, size) == 0)
goto found;
if (volume_id_probe_luks(id, off) == 0)
if (volume_id_probe_luks(id, off, size) == 0)
goto found;
if (volume_id_probe_xfs(id, off) == 0)
if (volume_id_probe_xfs(id, off, size) == 0)
goto found;
if (volume_id_probe_ext(id, off) == 0)
if (volume_id_probe_ext(id, off, size) == 0)
goto found;
if (volume_id_probe_reiserfs(id, off) == 0)
if (volume_id_probe_reiserfs(id, off, size) == 0)
goto found;
if (volume_id_probe_jfs(id, off) == 0)
if (volume_id_probe_jfs(id, off, size) == 0)
goto found;
if (volume_id_probe_udf(id, off) == 0)
if (volume_id_probe_udf(id, off, size) == 0)
goto found;
if (volume_id_probe_iso9660(id, off) == 0)
if (volume_id_probe_iso9660(id, off, size) == 0)
goto found;
if (volume_id_probe_hfs_hfsplus(id, off) == 0)
if (volume_id_probe_hfs_hfsplus(id, off, size) == 0)
goto found;
if (volume_id_probe_ufs(id, off) == 0)
if (volume_id_probe_ufs(id, off, size) == 0)
goto found;
if (volume_id_probe_ntfs(id, off) == 0)
if (volume_id_probe_ntfs(id, off, size) == 0)
goto found;
if (volume_id_probe_cramfs(id, off) == 0)
if (volume_id_probe_cramfs(id, off, size) == 0)
goto found;
if (volume_id_probe_romfs(id, off) == 0)
if (volume_id_probe_romfs(id, off, size) == 0)
goto found;
if (volume_id_probe_hpfs(id, off) == 0)
if (volume_id_probe_hpfs(id, off, size) == 0)
goto found;
if (volume_id_probe_sysv(id, off) == 0)
if (volume_id_probe_sysv(id, off, size) == 0)
goto found;
if (volume_id_probe_minix(id, off) == 0)
if (volume_id_probe_minix(id, off, size) == 0)
goto found;
if (volume_id_probe_ocfs1(id, off) == 0)
if (volume_id_probe_ocfs1(id, off, size) == 0)
goto found;
if (volume_id_probe_ocfs2(id, off) == 0)
if (volume_id_probe_ocfs2(id, off, size) == 0)
goto found;
if (volume_id_probe_vxfs(id, off) == 0)
if (volume_id_probe_vxfs(id, off, size) == 0)
goto found;
if (volume_id_probe_squashfs(id, off) == 0)
if (volume_id_probe_squashfs(id, off, size) == 0)
goto found;
if (volume_id_probe_netware(id, off) == 0)
if (volume_id_probe_netware(id, off, size) == 0)
goto found;
if (volume_id_probe_gfs(id, off) == 0)
if (volume_id_probe_gfs(id, off, size) == 0)
goto found;
if (volume_id_probe_gfs2(id, off) == 0)
if (volume_id_probe_gfs2(id, off, size) == 0)
goto found;
return -1;

View File

@ -33,7 +33,7 @@ struct vxfs_super {
int32_t vs_version;
} PACKED;
int volume_id_probe_vxfs(struct volume_id *id, uint64_t off)
int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct vxfs_super *vxs;

View File

@ -41,7 +41,7 @@ struct xfs_super_block {
uint64_t fdblocks;
} PACKED;
int volume_id_probe_xfs(struct volume_id *id, uint64_t off)
int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size)
{
struct xfs_super_block *xs;

View File

@ -213,53 +213,53 @@ int main(int argc, char *argv[])
printf("%s\n", vid->type);
if (volume_id_probe_jmicron_raid(vid, 0, size) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_vfat(vid, 0) == 0)
if (volume_id_probe_vfat(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_linux_swap(vid, 0) == 0)
if (volume_id_probe_linux_swap(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_luks(vid, 0) == 0)
if (volume_id_probe_luks(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_xfs(vid, 0) == 0)
if (volume_id_probe_xfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_ext(vid, 0) == 0)
if (volume_id_probe_ext(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_reiserfs(vid, 0) == 0)
if (volume_id_probe_reiserfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_jfs(vid, 0) == 0)
if (volume_id_probe_jfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_udf(vid, 0) == 0)
if (volume_id_probe_udf(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_iso9660(vid, 0) == 0)
if (volume_id_probe_iso9660(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_hfs_hfsplus(vid, 0) == 0)
if (volume_id_probe_hfs_hfsplus(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_ufs(vid, 0) == 0)
if (volume_id_probe_ufs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_ntfs(vid, 0) == 0)
if (volume_id_probe_ntfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_cramfs(vid, 0) == 0)
if (volume_id_probe_cramfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_romfs(vid, 0) == 0)
if (volume_id_probe_romfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_hpfs(vid, 0) == 0)
if (volume_id_probe_hpfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_sysv(vid, 0) == 0)
if (volume_id_probe_sysv(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_minix(vid, 0) == 0)
if (volume_id_probe_minix(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_ocfs1(vid, 0) == 0)
if (volume_id_probe_ocfs1(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_ocfs2(vid, 0) == 0)
if (volume_id_probe_ocfs2(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_vxfs(vid, 0) == 0)
if (volume_id_probe_vxfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_squashfs(vid, 0) == 0)
if (volume_id_probe_squashfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_netware(vid, 0) == 0)
if (volume_id_probe_netware(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_gfs(vid, 0) == 0)
if (volume_id_probe_gfs(vid, 0, 0) == 0)
printf("%s\n", vid->type);
if (volume_id_probe_gfs2(vid, 0) == 0)
if (volume_id_probe_gfs2(vid, 0, 0) == 0)
printf("%s\n", vid->type);
goto exit;