diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-08-01 01:33:36 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-08-01 01:33:36 +0200 |
commit | 70721db6d7ba0d4f3ac5c17f2cedac056065ad8a (patch) | |
tree | f029523e975639453dcd027ee43a7bc742d0845c /extras | |
parent | 62a22c8d75550d5720019468c7a881a573bff22b (diff) |
fix GGC signed pointer warnings and switch volume_id to stdint
Solaris uses volume_id now and they fiddled around with configure scripts
to map the linux kernel int types. Adding the types locally to volume_id
breaks the klibc build, so just switch to these ugly types and forget it. :)
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'extras')
75 files changed, 828 insertions, 858 deletions
diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index a19c4b2289..fb45bcca64 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = ata_id.o ../../udev.a $(OBJS): $(HEADERS) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 1e99b9df9c..2840e91457 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -62,10 +62,9 @@ void log_message(int priority, const char *format, ...) } #endif -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; /* strip trailing whitespace */ len = strnlen(from, count); @@ -139,9 +138,9 @@ int main(int argc, char *argv[]) goto close; } - set_str(model, id.model, 40); - set_str(serial, id.serial_no, 20); - set_str(revision, id.fw_rev, 8); + set_str(model, (char *) id.model, 40); + set_str(serial, (char *) id.serial_no, 20); + set_str(revision, (char *) id.fw_rev, 8); if (export) { if ((id.config >> 8) & 0x80) { diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 33bb6965cd..3b0a35f75f 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = dasd_id.o ../../udev.a $(OBJS): $(HEADERS) diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c index e2df65d6ec..a6f2de0db7 100644 --- a/extras/dasd_id/dasd_id.c +++ b/extras/dasd_id/dasd_id.c @@ -33,7 +33,6 @@ #include <fcntl.h> #include <errno.h> #include <sys/ioctl.h> -#include <asm/types.h> #include "../../logging.h" #include "../../udev_utils.h" @@ -140,7 +139,7 @@ static unsigned char EBCtoASC[256] = 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 }; -static void vtoc_ebcdic_dec (const unsigned char *source, char *target, int l) +static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) { int i; @@ -183,8 +182,8 @@ static int dasd_id(int fd) { int blocksize; dasd_information_t info; - __u8 *data; - __u8 *label_raw; + unsigned char *data; + unsigned char *label_raw; if (ioctl(fd, BIODASDINFO, &info) != 0) { dbg("not a dasd"); diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 2601eeeb55..ab0cd17e58 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = $(PROG).o ../../udev.a $(OBJS): $(HEADERS) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 0562073c8f..14b4725dae 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -29,8 +29,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = ../../udev.a ../../libsysfs/sysfs.a .c.o: diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 7aa3e83470..24c1b32128 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -28,7 +28,7 @@ INSTALL_DATA = ${INSTALL} -m 644 # Note some of the variables used here are set when built under udev, and # otherwise might not be set. -override CFLAGS+=-Wall -fno-builtin +CFLAGS+=-Wall -fno-builtin PROG=scsi_id SYSFS=-lsysfs @@ -77,3 +77,4 @@ spotless: clean $(PROG): $(OBJS) $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 1b4234a40e..8e5172f93c 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -101,10 +101,9 @@ void log_message (int level, const char *format, ...) return; } -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; /* strip trailing whitespace */ len = strnlen(from, count); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 7bfa9d1812..73d66ee615 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -294,9 +294,9 @@ static int scsi_dump(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) return -1; } -static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned - char evpd, unsigned char page, unsigned char *buf, - unsigned int buflen) +static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, + unsigned char evpd, unsigned char page, + unsigned char *buf, unsigned int buflen) { unsigned char inq_cmd[INQUIRY_CMDLEN] = { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; @@ -367,7 +367,7 @@ error: /* Get list of supported EVPD pages */ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, - char *buffer, int len) + unsigned char *buffer, unsigned int len) { int retval; struct sysfs_attribute *vendor; @@ -407,7 +407,7 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, scsi_dev->name); return 1; } - if (!strncmp(&buffer[VENDOR_LENGTH], vendor->value, + if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor->value, VENDOR_LENGTH)) { log_message(LOG_WARNING, "%s: invalid page0 data\n", scsi_dev->name); @@ -470,8 +470,9 @@ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * serial number. **/ -static int check_fill_0x83_id(struct sysfs_device *scsi_dev, char - *page_83, const struct scsi_id_search_values +static int check_fill_0x83_id(struct sysfs_device *scsi_dev, + unsigned char *page_83, + const struct scsi_id_search_values *id_search, char *serial, int max_len) { int i, j, len; diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index e319a4fee8..0635e91cc5 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a HEADERS = diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 720a0f5df7..37db6d14db 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -76,10 +76,9 @@ static int use_num_info; static int export; static int debug; -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; /* strip trailing whitespace */ len = strnlen(from, count); diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 014bf8713d..0fadbf5b0e 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 - VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index a4a866cfcf..6a9d1120e0 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -60,31 +60,34 @@ void log_message(int priority, const char *format, ...) } #endif -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; + /* strip trailing whitespace */ len = strnlen(from, count); while (isspace(from[len-1])) len--; + /* strip leading whitespace */ i = 0; while (isspace(from[i]) && (i < len)) i++; j = 0; while (i < len) { - switch(from[i]) { - case '/': - break; - case ' ': + /* substitute multiple whitespace */ + if (isspace(from[i])) { + while (isspace(from[i])) + i++; to[j++] = '_'; - break; - default: - to[j++] = from[i]; } - i++; + /* skip chars */ + if (from[i] == '/') { + i++; + continue; + } + to[j++] = from[i++]; } to[j] = '\0'; } @@ -106,7 +109,7 @@ int main(int argc, char *argv[]) struct volume_id *vid = NULL; static char name[VOLUME_ID_LABEL_SIZE]; int i; - unsigned long long size; + uint64_t size; const char *node = NULL; int rc = 0; diff --git a/extras/volume_id/volume_id/cramfs.c b/extras/volume_id/volume_id/cramfs.c index 0c76860013..9a71b0265c 100644 --- a/extras/volume_id/volume_id/cramfs.c +++ b/extras/volume_id/volume_id/cramfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,21 +39,21 @@ #include "cramfs.h" struct cramfs_super { - __u8 magic[4]; - __u32 size; - __u32 flags; - __u32 future; - __u8 signature[16]; + uint8_t magic[4]; + uint32_t size; + uint32_t flags; + uint32_t future; + uint8_t signature[16]; struct cramfs_info { - __u32 crc; - __u32 edition; - __u32 blocks; - __u32 files; + uint32_t crc; + uint32_t edition; + uint32_t blocks; + uint32_t files; } __attribute__((__packed__)) info; - __u8 name[16]; + uint8_t name[16]; } __attribute__((__packed__)); -int volume_id_probe_cramfs(struct volume_id *id, __u64 off) +int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) { struct cramfs_super *cs; diff --git a/extras/volume_id/volume_id/cramfs.h b/extras/volume_id/volume_id/cramfs.h index b94445b8b7..a40cec199d 100644 --- a/extras/volume_id/volume_id/cramfs.h +++ b/extras/volume_id/volume_id/cramfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_CRAMFS_ #define _VOLUME_ID_CRAMFS_ -extern int volume_id_probe_cramfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index 4783642114..64e5ff7cbf 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "util.h" @@ -40,29 +39,29 @@ #include "ext.h" struct ext2_super_block { - __u32 inodes_count; - __u32 blocks_count; - __u32 r_blocks_count; - __u32 free_blocks_count; - __u32 free_inodes_count; - __u32 first_data_block; - __u32 log_block_size; - __u32 dummy3[7]; - __u8 magic[2]; - __u16 state; - __u32 dummy5[8]; - __u32 feature_compat; - __u32 feature_incompat; - __u32 feature_ro_compat; - __u8 uuid[16]; - __u8 volume_name[16]; + uint32_t inodes_count; + uint32_t blocks_count; + uint32_t r_blocks_count; + uint32_t free_blocks_count; + uint32_t free_inodes_count; + uint32_t first_data_block; + uint32_t log_block_size; + uint32_t dummy3[7]; + uint8_t magic[2]; + uint16_t state; + uint32_t dummy5[8]; + uint32_t feature_compat; + uint32_t feature_incompat; + uint32_t feature_ro_compat; + uint8_t uuid[16]; + uint8_t volume_name[16]; } __attribute__((__packed__)); #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 #define EXT_SUPERBLOCK_OFFSET 0x400 -int volume_id_probe_ext(struct volume_id *id, __u64 off) +int volume_id_probe_ext(struct volume_id *id, uint64_t off) { struct ext2_super_block *es; diff --git a/extras/volume_id/volume_id/ext.h b/extras/volume_id/volume_id/ext.h index 6b9b85876b..aa931a02a8 100644 --- a/extras/volume_id/volume_id/ext.h +++ b/extras/volume_id/volume_id/ext.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_EXT_ #define _VOLUME_ID_EXT_ -extern int volume_id_probe_ext(struct volume_id *id, __u64 off); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c index f6d3699758..9fa0387afe 100644 --- a/extras/volume_id/volume_id/fat.c +++ b/extras/volume_id/volume_id/fat.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -48,62 +47,62 @@ #define FAT_ENTRY_FREE 0xe5 struct vfat_super_block { - __u8 boot_jump[3]; - __u8 sysid[8]; - __u16 sector_size; - __u8 sectors_per_cluster; - __u16 reserved; - __u8 fats; - __u16 dir_entries; - __u16 sectors; - __u8 media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; + uint8_t boot_jump[3]; + uint8_t sysid[8]; + uint16_t sector_size; + uint8_t sectors_per_cluster; + uint16_t reserved; + uint8_t fats; + uint16_t dir_entries; + uint16_t sectors; + uint8_t media; + uint16_t fat_length; + uint16_t secs_track; + uint16_t heads; + uint32_t hidden; + uint32_t total_sect; union { struct fat_super_block { - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[192]; - __u8 pmagic[2]; + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[192]; + uint8_t pmagic[2]; } __attribute__((__packed__)) fat; struct fat32_super_block { - __u32 fat32_length; - __u16 flags; - __u8 version[2]; - __u32 root_cluster; - __u16 insfo_sector; - __u16 backup_boot; - __u16 reserved2[6]; - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[164]; - __u8 pmagic[2]; + uint32_t fat32_length; + uint16_t flags; + uint8_t version[2]; + uint32_t root_cluster; + uint16_t insfo_sector; + uint16_t backup_boot; + uint16_t reserved2[6]; + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[164]; + uint8_t pmagic[2]; } __attribute__((__packed__)) fat32; } __attribute__((__packed__)) type; } __attribute__((__packed__)); struct vfat_dir_entry { - __u8 name[11]; - __u8 attr; - __u16 time_creat; - __u16 date_creat; - __u16 time_acc; - __u16 date_acc; - __u16 cluster_high; - __u16 time_write; - __u16 date_write; - __u16 cluster_low; - __u32 size; + uint8_t name[11]; + uint8_t attr; + uint16_t time_creat; + uint16_t date_creat; + uint16_t time_acc; + uint16_t date_acc; + uint16_t cluster_high; + uint16_t time_write; + uint16_t date_write; + uint16_t cluster_low; + uint32_t size; } __attribute__((__packed__)); -static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) +static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) { unsigned int i; @@ -137,26 +136,26 @@ static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) return NULL; } -int volume_id_probe_vfat(struct volume_id *id, __u64 off) +int volume_id_probe_vfat(struct volume_id *id, uint64_t off) { struct vfat_super_block *vs; struct vfat_dir_entry *dir; - __u16 sector_size; - __u16 dir_entries; - __u32 sect_count; - __u16 reserved; - __u32 fat_size; - __u32 root_cluster; - __u32 dir_size; - __u32 cluster_count; - __u32 fat_length; - __u64 root_start; - __u32 start_data_sect; - __u16 root_dir_entries; - __u8 *buf; - __u32 buf_size; - __u8 *label = NULL; - __u32 next; + uint16_t sector_size; + uint16_t dir_entries; + uint32_t sect_count; + uint16_t reserved; + uint32_t fat_size; + uint32_t root_cluster; + uint32_t dir_size; + uint32_t cluster_count; + uint32_t fat_length; + uint64_t root_start; + uint32_t start_data_sect; + uint16_t root_dir_entries; + uint8_t *buf; + uint32_t buf_size; + uint8_t *label = NULL; + uint32_t next; int maxloop; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -294,9 +293,9 @@ fat32: next = root_cluster; maxloop = 100; while (--maxloop) { - __u32 next_sect_off; - __u64 next_off; - __u64 fat_entry_off; + uint32_t next_sect_off; + uint64_t next_off; + uint64_t fat_entry_off; int count; dbg("next cluster %u", next); @@ -318,13 +317,13 @@ fat32: break; /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); + fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); if (buf == NULL) goto found; /* set next cluster */ - next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); + next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); if (next == 0) break; } diff --git a/extras/volume_id/volume_id/fat.h b/extras/volume_id/volume_id/fat.h index 51ad94df85..0043210d5a 100644 --- a/extras/volume_id/volume_id/fat.h +++ b/extras/volume_id/volume_id/fat.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_FAT_ #define _VOLUME_ID_FAT_ -extern int volume_id_probe_vfat(struct volume_id *id, __u64 off); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/hfs.c b/extras/volume_id/volume_id/hfs.c index 8c40975036..ab1bc2ec39 100644 --- a/extras/volume_id/volume_id/hfs.c +++ b/extras/volume_id/volume_id/hfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,104 +39,104 @@ #include "hfs.h" struct hfs_finder_info{ - __u32 boot_folder; - __u32 start_app; - __u32 open_folder; - __u32 os9_folder; - __u32 reserved; - __u32 osx_folder; - __u8 id[8]; + uint32_t boot_folder; + uint32_t start_app; + uint32_t open_folder; + uint32_t os9_folder; + uint32_t reserved; + uint32_t osx_folder; + uint8_t id[8]; } __attribute__((__packed__)); struct hfs_mdb { - __u8 signature[2]; - __u32 cr_date; - __u32 ls_Mod; - __u16 atrb; - __u16 nm_fls; - __u16 vbm_st; - __u16 alloc_ptr; - __u16 nm_al_blks; - __u32 al_blk_size; - __u32 clp_size; - __u16 al_bl_st; - __u32 nxt_cnid; - __u16 free_bks; - __u8 label_len; - __u8 label[27]; - __u32 vol_bkup; - __u16 vol_seq_num; - __u32 wr_cnt; - __u32 xt_clump_size; - __u32 ct_clump_size; - __u16 num_root_dirs; - __u32 file_count; - __u32 dir_count; + uint8_t signature[2]; + uint32_t cr_date; + uint32_t ls_Mod; + uint16_t atrb; + uint16_t nm_fls; + uint16_t vbm_st; + uint16_t alloc_ptr; + uint16_t nm_al_blks; + uint32_t al_blk_size; + uint32_t clp_size; + uint16_t al_bl_st; + uint32_t nxt_cnid; + uint16_t free_bks; + uint8_t label_len; + uint8_t label[27]; + uint32_t vol_bkup; + uint16_t vol_seq_num; + uint32_t wr_cnt; + uint32_t xt_clump_size; + uint32_t ct_clump_size; + uint16_t num_root_dirs; + uint32_t file_count; + uint32_t dir_count; struct hfs_finder_info finder_info; - __u8 embed_sig[2]; - __u16 embed_startblock; - __u16 embed_blockcount; + uint8_t embed_sig[2]; + uint16_t embed_startblock; + uint16_t embed_blockcount; } __attribute__((__packed__)) *hfs; struct hfsplus_bnode_descriptor { - __u32 next; - __u32 prev; - __u8 type; - __u8 height; - __u16 num_recs; - __u16 reserved; + uint32_t next; + uint32_t prev; + uint8_t type; + uint8_t height; + uint16_t num_recs; + uint16_t reserved; } __attribute__((__packed__)); struct hfsplus_bheader_record { - __u16 depth; - __u32 root; - __u32 leaf_count; - __u32 leaf_head; - __u32 leaf_tail; - __u16 node_size; + uint16_t depth; + uint32_t root; + uint32_t leaf_count; + uint32_t leaf_head; + uint32_t leaf_tail; + uint16_t node_size; } __attribute__((__packed__)); struct hfsplus_catalog_key { - __u16 key_len; - __u32 parent_id; - __u16 unicode_len; - __u8 unicode[255 * 2]; + uint16_t key_len; + uint32_t parent_id; + uint16_t unicode_len; + uint8_t unicode[255 * 2]; } __attribute__((__packed__)); struct hfsplus_extent { - __u32 start_block; - __u32 block_count; + uint32_t start_block; + uint32_t block_count; } __attribute__((__packed__)); #define HFSPLUS_EXTENT_COUNT 8 struct hfsplus_fork { - __u64 total_size; - __u32 clump_size; - __u32 total_blocks; + uint64_t total_size; + uint32_t clump_size; + uint32_t total_blocks; struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; } __attribute__((__packed__)); struct hfsplus_vol_header { - __u8 signature[2]; - __u16 version; - __u32 attributes; - __u32 last_mount_vers; - __u32 reserved; - __u32 create_date; - __u32 modify_date; - __u32 backup_date; - __u32 checked_date; - __u32 file_count; - __u32 folder_count; - __u32 blocksize; - __u32 total_blocks; - __u32 free_blocks; - __u32 next_alloc; - __u32 rsrc_clump_sz; - __u32 data_clump_sz; - __u32 next_cnid; - __u32 write_count; - __u64 encodings_bmp; + uint8_t signature[2]; + uint16_t version; + uint32_t attributes; + uint32_t last_mount_vers; + uint32_t reserved; + uint32_t create_date; + uint32_t modify_date; + uint32_t backup_date; + uint32_t checked_date; + uint32_t file_count; + uint32_t folder_count; + uint32_t blocksize; + uint32_t total_blocks; + uint32_t free_blocks; + uint32_t next_alloc; + uint32_t rsrc_clump_sz; + uint32_t data_clump_sz; + uint32_t next_cnid; + uint32_t write_count; + uint64_t encodings_bmp; struct hfs_finder_info finder_info; struct hfsplus_fork alloc_file; struct hfsplus_fork ext_file; @@ -150,7 +149,7 @@ struct hfsplus_vol_header { #define HFS_NODE_LEAF 0xff #define HFSPLUS_POR_CNID 1 -int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) +int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) { unsigned int blocksize; unsigned int cat_block; @@ -161,7 +160,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) unsigned int leaf_node_count; unsigned int leaf_node_size; unsigned int leaf_block; - __u64 leaf_off; + uint64_t leaf_off; unsigned int alloc_block_size; unsigned int alloc_first_block; unsigned int embed_first_block; @@ -169,9 +168,9 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) struct hfsplus_bnode_descriptor *descr; struct hfsplus_bheader_record *bnode; struct hfsplus_catalog_key *key; - unsigned int label_len; + unsigned int label_len; struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const __u8 *buf; + const uint8_t *buf; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/hfs.h b/extras/volume_id/volume_id/hfs.h index b23ccd30c8..42dc449e29 100644 --- a/extras/volume_id/volume_id/hfs.h +++ b/extras/volume_id/volume_id/hfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_HFS_ #define _VOLUME_ID_HFS_ -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c index 938a8934e5..baa278ba80 100644 --- a/extras/volume_id/volume_id/highpoint.c +++ b/extras/volume_id/volume_id/highpoint.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,12 +39,12 @@ #include "highpoint.h" struct hpt37x_meta { - __u8 filler1[32]; - __u32 magic; + uint8_t filler1[32]; + uint32_t magic; } __attribute__((packed)); struct hpt45x_meta { - __u32 magic; + uint32_t magic; } __attribute__((packed)); #define HPT37X_CONFIG_OFF 0x1200 @@ -56,11 +55,11 @@ struct hpt45x_meta { #define HPT45X_MAGIC_BAD 0x5a7816fd -int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off) +int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; struct hpt37x_meta *hpt; - __u32 magic; + uint32_t magic; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -79,12 +78,12 @@ int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off) return 0; } -int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; + const uint8_t *buf; struct hpt45x_meta *hpt; - __u64 meta_off; - __u32 magic; + uint64_t meta_off; + uint32_t magic; dbg("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); diff --git a/extras/volume_id/volume_id/highpoint.h b/extras/volume_id/volume_id/highpoint.h index 7cc2ac0cb8..b0462f0525 100644 --- a/extras/volume_id/volume_id/highpoint.h +++ b/extras/volume_id/volume_id/highpoint.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_HIGHPOINT_ #define _VOLUME_ID_HIGHPOINT_ -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c index 96c63d5e1d..8cd65cd6e9 100644 --- a/extras/volume_id/volume_id/hpfs.c +++ b/extras/volume_id/volume_id/hpfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -41,13 +40,13 @@ struct hpfs_super { - __u8 magic[4]; - __u8 version; + uint8_t magic[4]; + uint8_t version; } __attribute__((__packed__)); #define HPFS_SUPERBLOCK_OFFSET 0x2000 -int volume_id_probe_hpfs(struct volume_id *id, __u64 off) +int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) { struct hpfs_super *hs; diff --git a/extras/volume_id/volume_id/hpfs.h b/extras/volume_id/volume_id/hpfs.h index bd8d4c90c9..d496829033 100644 --- a/extras/volume_id/volume_id/hpfs.h +++ b/extras/volume_id/volume_id/hpfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_HPFS_ #define _VOLUME_ID_HPFS_ -extern int volume_id_probe_hpfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c index 5d4ab92a79..8811ffbc03 100644 --- a/extras/volume_id/volume_id/iso9660.c +++ b/extras/volume_id/volume_id/iso9660.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -48,27 +47,27 @@ #define ISO_VD_MAX 16 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]; + uint8_t vd_type; + uint8_t vd_id[5]; + uint8_t vd_version; + uint8_t flags; + uint8_t system_id[32]; + uint8_t volume_id[32]; + uint8_t unused[8]; + uint8_t space_size[8]; + uint8_t escape_sequences[8]; } __attribute__((__packed__)); struct high_sierra_volume_descriptor { - __u8 foo[8]; - __u8 type; - __u8 id[4]; - __u8 version; + uint8_t foo[8]; + uint8_t type; + uint8_t id[4]; + uint8_t version; } __attribute__((__packed__)); -int volume_id_probe_iso9660(struct volume_id *id, __u64 off) +int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) { - __u8 *buf; + uint8_t *buf; struct iso_volume_descriptor *is; struct high_sierra_volume_descriptor *hs; @@ -91,7 +90,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) dbg("looking for SVDs"); vd_offset = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { - char svd_label[64]; + uint8_t 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) @@ -104,7 +103,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) 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); + volume_id_set_unicode16((char *)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; diff --git a/extras/volume_id/volume_id/iso9660.h b/extras/volume_id/volume_id/iso9660.h index c187e25f94..0119acac6c 100644 --- a/extras/volume_id/volume_id/iso9660.h +++ b/extras/volume_id/volume_id/iso9660.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_ISO9660_ #define _VOLUME_ID_ISO9660_ -extern int volume_id_probe_iso9660(struct volume_id *id, __u64 off); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/isw_raid.c b/extras/volume_id/volume_id/isw_raid.c index c703f3fe27..9c3082dbbf 100644 --- a/extras/volume_id/volume_id/isw_raid.c +++ b/extras/volume_id/volume_id/isw_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,20 +39,20 @@ #include "isw_raid.h" struct isw_meta { - __u8 sig[32]; - __u32 check_sum; - __u32 mpb_size; - __u32 family_num; - __u32 generation_num; + uint8_t sig[32]; + uint32_t check_sum; + uint32_t mpb_size; + uint32_t family_num; + uint32_t generation_num; } __attribute__((packed)); #define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " -int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct isw_meta *isw; dbg("probing at offset 0x%llx, size 0x%llx", @@ -72,7 +71,7 @@ int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 s return -1; volume_id_set_usage(id, VOLUME_ID_RAID); - strncpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); + memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); id->type = "isw_raid_member"; return 0; diff --git a/extras/volume_id/volume_id/isw_raid.h b/extras/volume_id/volume_id/isw_raid.h index 4bfd3bb529..7f48b0196f 100644 --- a/extras/volume_id/volume_id/isw_raid.h +++ b/extras/volume_id/volume_id/isw_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_ISW_RAID_ #define _VOLUME_ID_ISW_RAID_ -extern int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/jfs.c b/extras/volume_id/volume_id/jfs.c index 77fa095357..6899e939ac 100644 --- a/extras/volume_id/volume_id/jfs.c +++ b/extras/volume_id/volume_id/jfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,21 +39,21 @@ #include "jfs.h" struct jfs_super_block { - __u8 magic[4]; - __u32 version; - __u64 size; - __u32 bsize; - __u32 dummy1; - __u32 pbsize; - __u32 dummy2[27]; - __u8 uuid[16]; - __u8 label[16]; - __u8 loguuid[16]; + uint8_t magic[4]; + uint32_t version; + uint64_t size; + uint32_t bsize; + uint32_t dummy1; + uint32_t pbsize; + uint32_t dummy2[27]; + uint8_t uuid[16]; + uint8_t label[16]; + uint8_t loguuid[16]; } __attribute__((__packed__)); #define JFS_SUPERBLOCK_OFFSET 0x8000 -int volume_id_probe_jfs(struct volume_id *id, __u64 off) +int volume_id_probe_jfs(struct volume_id *id, uint64_t off) { struct jfs_super_block *js; diff --git a/extras/volume_id/volume_id/jfs.h b/extras/volume_id/volume_id/jfs.h index 28c48ffe53..e979eb740c 100644 --- a/extras/volume_id/volume_id/jfs.h +++ b/extras/volume_id/volume_id/jfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_JFS_ #define _VOLUME_ID_JFS_ -extern int volume_id_probe_jfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c index 598002ec4f..ece3e46f6d 100644 --- a/extras/volume_id/volume_id/linux_raid.c +++ b/extras/volume_id/volume_id/linux_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,32 +39,32 @@ #include "linux_raid.h" struct mdp_super_block { - __u32 md_magic; - __u32 major_version; - __u32 minor_version; - __u32 patch_version; - __u32 gvalid_words; - __u32 set_uuid0; - __u32 ctime; - __u32 level; - __u32 size; - __u32 nr_disks; - __u32 raid_disks; - __u32 md_minor; - __u32 not_persistent; - __u32 set_uuid1; - __u32 set_uuid2; - __u32 set_uuid3; + uint32_t md_magic; + uint32_t major_version; + uint32_t minor_version; + uint32_t patch_version; + uint32_t gvalid_words; + uint32_t set_uuid0; + uint32_t ctime; + uint32_t level; + uint32_t size; + uint32_t nr_disks; + uint32_t raid_disks; + uint32_t md_minor; + uint32_t not_persistent; + uint32_t set_uuid1; + uint32_t set_uuid2; + uint32_t set_uuid3; } __attribute__((packed)) *mdp; #define MD_RESERVED_BYTES 0x10000 #define MD_MAGIC 0xa92b4efc -int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 sboff; - __u8 uuid[16]; + const uint8_t *buf; + uint64_t sboff; + uint8_t uuid[16]; dbg("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); diff --git a/extras/volume_id/volume_id/linux_raid.h b/extras/volume_id/volume_id/linux_raid.h index 0aaaaa6ade..adf6ebaacd 100644 --- a/extras/volume_id/volume_id/linux_raid.h +++ b/extras/volume_id/volume_id/linux_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LINUX_RAID_ #define _VOLUME_ID_LINUX_RAID_ -extern int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/linux_swap.c b/extras/volume_id/volume_id/linux_swap.c index e37a79be86..1ffc2a8cb5 100644 --- a/extras/volume_id/volume_id/linux_swap.c +++ b/extras/volume_id/volume_id/linux_swap.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,19 +39,19 @@ #include "linux_swap.h" struct swap_header_v1_2 { - __u8 bootbits[1024]; - __u32 version; - __u32 last_page; - __u32 nr_badpages; - __u8 uuid[16]; - __u8 volume_name[16]; + uint8_t bootbits[1024]; + uint32_t version; + uint32_t last_page; + uint32_t nr_badpages; + uint8_t uuid[16]; + uint8_t volume_name[16]; } __attribute__((__packed__)) *sw; #define LARGEST_PAGESIZE 0x4000 -int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) +int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; unsigned int page; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/linux_swap.h b/extras/volume_id/volume_id/linux_swap.h index 5de0f93849..c8fa90d5c5 100644 --- a/extras/volume_id/volume_id/linux_swap.h +++ b/extras/volume_id/volume_id/linux_swap.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LINUX_SWAP_ #define _VOLUME_ID_LINUX_SWAP_ -extern int volume_id_probe_linux_swap(struct volume_id *id, __u64 off); +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/lsi_raid.c b/extras/volume_id/volume_id/lsi_raid.c index e411fbc264..bb2ac7f9c5 100644 --- a/extras/volume_id/volume_id/lsi_raid.c +++ b/extras/volume_id/volume_id/lsi_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,15 +39,15 @@ #include "lsi_raid.h" struct lsi_meta { - __u8 sig[6]; + uint8_t sig[6]; } __attribute__((packed)); #define LSI_SIGNATURE "$XIDE$" -int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct lsi_meta *lsi; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/lsi_raid.h b/extras/volume_id/volume_id/lsi_raid.h index b3ee0bb7fb..2c2758bdb4 100644 --- a/extras/volume_id/volume_id/lsi_raid.h +++ b/extras/volume_id/volume_id/lsi_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LSI_RAID_ #define _VOLUME_ID_LSI_RAID_ -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c index a00bf4041b..22d2a94ac7 100644 --- a/extras/volume_id/volume_id/luks.c +++ b/extras/volume_id/volume_id/luks.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "util.h" @@ -49,33 +48,33 @@ #define LUKS_SALTSIZE 32 #define LUKS_NUMKEYS 8 -const __u8 LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +const uint8_t 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 { - __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]; + uint8_t magic[LUKS_MAGIC_L]; + uint16_t version; + uint8_t cipherName[LUKS_CIPHERNAME_L]; + uint8_t cipherMode[LUKS_CIPHERMODE_L]; + uint8_t hashSpec[LUKS_HASHSPEC_L]; + uint32_t payloadOffset; + uint32_t keyBytes; + uint8_t mkDigest[LUKS_DIGESTSIZE]; + uint8_t mkDigestSalt[LUKS_SALTSIZE]; + uint32_t mkDigestIterations; + uint8_t uuid[UUID_STRING_L]; struct { - __u32 active; - __u32 passwordIterations; - __u8 passwordSalt[LUKS_SALTSIZE]; - __u32 keyMaterialOffset; - __u32 stripes; + uint32_t active; + uint32_t passwordIterations; + uint8_t passwordSalt[LUKS_SALTSIZE]; + uint32_t keyMaterialOffset; + uint32_t stripes; } keyblock[LUKS_NUMKEYS]; }; -int volume_id_probe_luks(struct volume_id *id, __u64 off) +int volume_id_probe_luks(struct volume_id *id, uint64_t off) { struct luks_phdr *header; diff --git a/extras/volume_id/volume_id/luks.h b/extras/volume_id/volume_id/luks.h index 180336f573..f53a1558ec 100644 --- a/extras/volume_id/volume_id/luks.h +++ b/extras/volume_id/volume_id/luks.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LUKS_ #define _VOLUME_ID_LUKS_ -extern int volume_id_probe_luks(struct volume_id *id, __u64 off); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/lvm.c b/extras/volume_id/volume_id/lvm.c index d1e337dc35..b2e2e421d0 100644 --- a/extras/volume_id/volume_id/lvm.c +++ b/extras/volume_id/volume_id/lvm.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,23 +39,23 @@ #include "lvm.h" struct lvm1_super_block { - __u8 id[2]; + uint8_t id[2]; } __attribute__((packed)); struct lvm2_super_block { - __u8 id[8]; - __u64 sector_xl; - __u32 crc_xl; - __u32 offset_xl; - __u8 type[8]; + uint8_t id[8]; + uint64_t sector_xl; + uint32_t crc_xl; + uint32_t offset_xl; + uint8_t type[8]; } __attribute__((packed)); #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" -int volume_id_probe_lvm1(struct volume_id *id, __u64 off) +int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; struct lvm1_super_block *lvm; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -79,9 +78,9 @@ int volume_id_probe_lvm1(struct volume_id *id, __u64 off) #define LVM2_LABEL_ID "LABELONE" #define LVM2LABEL_SCAN_SECTORS 4 -int volume_id_probe_lvm2(struct volume_id *id, __u64 off) +int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; unsigned int soff; struct lvm2_super_block *lvm; @@ -102,7 +101,7 @@ int volume_id_probe_lvm2(struct volume_id *id, __u64 off) return -1; found: - strncpy(id->type_version, lvm->type, 8); + memcpy(id->type_version, lvm->type, 8); volume_id_set_usage(id, VOLUME_ID_RAID); id->type = "LVM2_member"; diff --git a/extras/volume_id/volume_id/lvm.h b/extras/volume_id/volume_id/lvm.h index 2e44cda75b..555f18d904 100644 --- a/extras/volume_id/volume_id/lvm.h +++ b/extras/volume_id/volume_id/lvm.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_LVM_ #define _VOLUME_ID_LVM_ -extern int volume_id_probe_lvm1(struct volume_id *id, __u64 off); -extern int volume_id_probe_lvm2(struct volume_id *id, __u64 off); +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); #endif diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c index dcfacc2a69..7ebd749e4f 100644 --- a/extras/volume_id/volume_id/mac.c +++ b/extras/volume_id/volume_id/mac.c @@ -40,24 +40,24 @@ #include "mac.h" struct mac_driver_desc { - __u8 signature[2]; - __u16 block_size; - __u32 block_count; + uint8_t signature[2]; + uint16_t block_size; + uint32_t block_count; } __attribute__((__packed__)); struct mac_partition { - __u8 signature[2]; - __u16 res1; - __u32 map_count; - __u32 start_block; - __u32 block_count; - __u8 name[32]; - __u8 type[32]; + uint8_t signature[2]; + uint16_t res1; + uint32_t map_count; + uint32_t start_block; + uint32_t block_count; + uint8_t name[32]; + uint8_t type[32]; } __attribute__((__packed__)); -int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) +int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; struct mac_driver_desc *driver; struct mac_partition *part; @@ -108,8 +108,8 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) id->partition_count = part_count; for (i = 0; i < part_count; i++) { - __u64 poff; - __u64 plen; + uint64_t poff; + uint64_t plen; buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/mac.h b/extras/volume_id/volume_id/mac.h index 888c1c527d..0ab0d4489d 100644 --- a/extras/volume_id/volume_id/mac.h +++ b/extras/volume_id/volume_id/mac.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_MAC_ #define _VOLUME_ID_MAC_ -extern int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off); +extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/minix.c b/extras/volume_id/volume_id/minix.c index d2f2a336d4..97aa83a3dc 100644 --- a/extras/volume_id/volume_id/minix.c +++ b/extras/volume_id/volume_id/minix.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -41,21 +40,21 @@ 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; + uint16_t s_ninodes; + uint16_t s_nzones; + uint16_t s_imap_blocks; + uint16_t s_zmap_blocks; + uint16_t s_firstdatazone; + uint16_t s_log_zone_size; + uint32_t s_max_size; + uint16_t s_magic; + uint16_t s_state; + uint32_t s_zones; } __attribute__((__packed__)); #define MINIX_SUPERBLOCK_OFFSET 0x400 -int volume_id_probe_minix(struct volume_id *id, __u64 off) +int volume_id_probe_minix(struct volume_id *id, uint64_t off) { struct minix_super_block *ms; diff --git a/extras/volume_id/volume_id/minix.h b/extras/volume_id/volume_id/minix.h index 7a9d97ada2..2a3fd7292b 100644 --- a/extras/volume_id/volume_id/minix.h +++ b/extras/volume_id/volume_id/minix.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_MINIX_ #define _VOLUME_ID_MINIX_ -extern int volume_id_probe_minix(struct volume_id *id, __u64 off); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/msdos.c b/extras/volume_id/volume_id/msdos.c index 47c94456e4..0b8dbbeaec 100644 --- a/extras/volume_id/volume_id/msdos.c +++ b/extras/volume_id/volume_id/msdos.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,16 +39,16 @@ #include "msdos.h" struct msdos_partition_entry { - __u8 boot_ind; - __u8 head; - __u8 sector; - __u8 cyl; - __u8 sys_ind; - __u8 end_head; - __u8 end_sector; - __u8 end_cyl; - __u32 start_sect; - __u32 nr_sects; + uint8_t boot_ind; + uint8_t head; + uint8_t sector; + uint8_t cyl; + uint8_t sys_ind; + uint8_t end_head; + uint8_t end_sector; + uint8_t end_cyl; + uint32_t start_sect; + uint32_t nr_sects; } __attribute__((packed)); #define MSDOS_MAGIC "\x55\xaa" @@ -67,15 +66,15 @@ struct msdos_partition_entry { #define is_raid(type) \ (type == LINUX_RAID_PARTITION) -int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) +int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; int i; - __u64 poff; - __u64 plen; - __u64 extended = 0; - __u64 current; - __u64 next; + uint64_t poff; + uint64_t plen; + uint64_t extended = 0; + uint64_t current; + uint64_t next; int limit; int empty = 1; struct msdos_partition_entry *part; @@ -113,8 +112,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; if (plen == 0) continue; @@ -167,8 +166,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) next = 0; for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; if (plen == 0) continue; diff --git a/extras/volume_id/volume_id/msdos.h b/extras/volume_id/volume_id/msdos.h index 55185c006b..29be629845 100644 --- a/extras/volume_id/volume_id/msdos.h +++ b/extras/volume_id/volume_id/msdos.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_MSDOS_ #define _VOLUME_ID_MSDOS_ -extern int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off); +extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c index f9df0e9cc3..f59da48165 100644 --- a/extras/volume_id/volume_id/ntfs.c +++ b/extras/volume_id/volume_id/ntfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,61 +39,61 @@ #include "ntfs.h" struct ntfs_super_block { - __u8 jump[3]; - __u8 oem_id[8]; - __u16 bytes_per_sector; - __u8 sectors_per_cluster; - __u16 reserved_sectors; - __u8 fats; - __u16 root_entries; - __u16 sectors; - __u8 media_type; - __u16 sectors_per_fat; - __u16 sectors_per_track; - __u16 heads; - __u32 hidden_sectors; - __u32 large_sectors; - __u16 unused[2]; - __u64 number_of_sectors; - __u64 mft_cluster_location; - __u64 mft_mirror_cluster_location; - __s8 cluster_per_mft_record; - __u8 reserved1[3]; - __s8 cluster_per_index_record; - __u8 reserved2[3]; - __u8 volume_serial[8]; - __u16 checksum; + uint8_t jump[3]; + uint8_t oem_id[8]; + uint16_t bytes_per_sector; + uint8_t sectors_per_cluster; + uint16_t reserved_sectors; + uint8_t fats; + uint16_t root_entries; + uint16_t sectors; + uint8_t media_type; + uint16_t sectors_per_fat; + uint16_t sectors_per_track; + uint16_t heads; + uint32_t hidden_sectors; + uint32_t large_sectors; + uint16_t unused[2]; + uint64_t number_of_sectors; + uint64_t mft_cluster_location; + uint64_t mft_mirror_cluster_location; + int8_t cluster_per_mft_record; + uint8_t reserved1[3]; + int8_t cluster_per_index_record; + uint8_t reserved2[3]; + uint8_t volume_serial[8]; + uint16_t checksum; } __attribute__((__packed__)) *ns; struct master_file_table_record { - __u8 magic[4]; - __u16 usa_ofs; - __u16 usa_count; - __u64 lsn; - __u16 sequence_number; - __u16 link_count; - __u16 attrs_offset; - __u16 flags; - __u32 bytes_in_use; - __u32 bytes_allocated; + uint8_t magic[4]; + uint16_t usa_ofs; + uint16_t usa_count; + uint64_t lsn; + uint16_t sequence_number; + uint16_t link_count; + uint16_t attrs_offset; + uint16_t flags; + uint32_t bytes_in_use; + uint32_t bytes_allocated; } __attribute__((__packed__)) *mftr; struct file_attribute { - __u32 type; - __u32 len; - __u8 non_resident; - __u8 name_len; - __u16 name_offset; - __u16 flags; - __u16 instance; - __u32 value_len; - __u16 value_offset; + uint32_t type; + uint32_t len; + uint8_t non_resident; + uint8_t name_len; + uint16_t name_offset; + uint16_t flags; + uint16_t instance; + uint32_t value_len; + uint16_t value_offset; } __attribute__((__packed__)) *attr; struct volume_info { - __u64 reserved; - __u8 major_ver; - __u8 minor_ver; + uint64_t reserved; + uint8_t major_ver; + uint8_t minor_ver; } __attribute__((__packed__)) *info; #define MFT_RECORD_VOLUME 3 @@ -103,20 +102,20 @@ 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, __u64 off) +int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) { unsigned int sector_size; unsigned int cluster_size; - __u64 mft_cluster; - __u64 mft_off; + uint64_t mft_cluster; + uint64_t mft_off; unsigned int mft_record_size; unsigned int attr_type; unsigned int attr_off; unsigned int attr_len; unsigned int val_off; unsigned int val_len; - const __u8 *buf; - const __u8 *val; + const uint8_t *buf; + const uint8_t *val; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -183,7 +182,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { dbg("found info, len %i", val_len); - info = (struct volume_info*) (((__u8 *) attr) + val_off); + info = (struct volume_info*) (((uint8_t *) attr) + val_off); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", info->major_ver, info->minor_ver); } @@ -193,7 +192,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) if (val_len > VOLUME_ID_LABEL_SIZE) val_len = VOLUME_ID_LABEL_SIZE; - val = ((__u8 *) attr) + val_off; + val = ((uint8_t *) attr) + val_off; volume_id_set_label_raw(id, val, val_len); volume_id_set_label_unicode16(id, val, LE, val_len); } diff --git a/extras/volume_id/volume_id/ntfs.h b/extras/volume_id/volume_id/ntfs.h index 63b1161d51..2a84db3653 100644 --- a/extras/volume_id/volume_id/ntfs.h +++ b/extras/volume_id/volume_id/ntfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_NTFS_ #define _VOLUME_ID_NTFS_ -extern int volume_id_probe_ntfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/nvidia_raid.c b/extras/volume_id/volume_id/nvidia_raid.c index ad76631799..d49ffe3010 100644 --- a/extras/volume_id/volume_id/nvidia_raid.c +++ b/extras/volume_id/volume_id/nvidia_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,18 +39,18 @@ #include "nvidia_raid.h" struct nvidia_meta { - __u8 vendor[8]; - __u32 size; - __u32 chksum; - __u16 version; + uint8_t vendor[8]; + uint32_t size; + uint32_t chksum; + uint16_t version; } __attribute__((packed)); #define NVIDIA_SIGNATURE "NVIDIA" -int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct nvidia_meta *nv; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/nvidia_raid.h b/extras/volume_id/volume_id/nvidia_raid.h index f892be5590..250c1f8214 100644 --- a/extras/volume_id/volume_id/nvidia_raid.h +++ b/extras/volume_id/volume_id/nvidia_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_NVIDIA_RAID_ #define _VOLUME_ID_NVIDIA_RAID_ -extern int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c index 90a6bd531c..08138472ce 100644 --- a/extras/volume_id/volume_id/ocfs2.c +++ b/extras/volume_id/volume_id/ocfs2.c @@ -51,66 +51,66 @@ This is one has been simplified since we only care about the superblock. */ struct ocfs2_super_block { - __u8 i_signature[8]; /* Signature for validation */ - __u32 i_generation; /* Generation number */ - __s16 i_suballoc_slot; /* Slot suballocator this inode belongs to */ - __u16 i_suballoc_bit; /* Bit offset in suballocator block group */ - __u32 i_reserved0; - __u32 i_clusters; /* Cluster count */ - __u32 i_uid; /* Owner UID */ - __u32 i_gid; /* Owning GID */ - __u64 i_size; /* Size in bytes */ - __u16 i_mode; /* File mode */ - __u16 i_links_count; /* Links count */ - __u32 i_flags; /* File flags */ - __u64 i_atime; /* Access time */ - __u64 i_ctime; /* Creation time */ - __u64 i_mtime; /* Modification time */ - __u64 i_dtime; /* Deletion time */ - __u64 i_blkno; /* Offset on disk, in blocks */ - __u64 i_last_eb_blk; /* Pointer to last extent block */ - __u32 i_fs_generation; /* Generation per fs-instance */ - __u32 i_atime_nsec; - __u32 i_ctime_nsec; - __u32 i_mtime_nsec; - __u64 i_reserved1[9]; - __u64 i_pad1; /* Generic way to refer to this 64bit union */ + uint8_t i_signature[8]; /* Signature for validation */ + uint32_t i_generation; /* Generation number */ + int16_t i_suballoc_slot; /* Slot suballocator this inode belongs to */ + uint16_t i_suballoc_bit; /* Bit offset in suballocator block group */ + uint32_t i_reserved0; + uint32_t i_clusters; /* Cluster count */ + uint32_t i_uid; /* Owner UID */ + uint32_t i_gid; /* Owning GID */ + uint64_t i_size; /* Size in bytes */ + uint16_t i_mode; /* File mode */ + uint16_t i_links_count; /* Links count */ + uint32_t i_flags; /* File flags */ + uint64_t i_atime; /* Access time */ + uint64_t i_ctime; /* Creation time */ + uint64_t i_mtime; /* Modification time */ + uint64_t i_dtime; /* Deletion time */ + uint64_t i_blkno; /* Offset on disk, in blocks */ + uint64_t i_last_eb_blk; /* Pointer to last extent block */ + uint32_t i_fs_generation; /* Generation per fs-instance */ + uint32_t i_atime_nsec; + uint32_t i_ctime_nsec; + uint32_t i_mtime_nsec; + uint64_t i_reserved1[9]; + uint64_t i_pad1; /* Generic way to refer to this 64bit union */ /* Normally there is a union of the different block types, but we only care about the superblock. */ - __u16 s_major_rev_level; - __u16 s_minor_rev_level; - __u16 s_mnt_count; - __s16 s_max_mnt_count; - __u16 s_state; /* File system state */ - __u16 s_errors; /* Behaviour when detecting errors */ - __u32 s_checkinterval; /* Max time between checks */ - __u64 s_lastcheck; /* Time of last check */ - __u32 s_creator_os; /* OS */ - __u32 s_feature_compat; /* Compatible feature set */ - __u32 s_feature_incompat; /* Incompatible feature set */ - __u32 s_feature_ro_compat; /* Readonly-compatible feature set */ - __u64 s_root_blkno; /* Offset, in blocks, of root directory dinode */ - __u64 s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ - __u32 s_blocksize_bits; /* Blocksize for this fs */ - __u32 s_clustersize_bits; /* Clustersize for this fs */ - __u16 s_max_slots; /* Max number of simultaneous mounts before tunefs required */ - __u16 s_reserved1; - __u32 s_reserved2; - __u64 s_first_cluster_group; /* Block offset of 1st cluster group header */ - __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ - __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ + uint16_t s_major_rev_level; + uint16_t s_minor_rev_level; + uint16_t s_mnt_count; + int16_t s_max_mnt_count; + uint16_t s_state; /* File system state */ + uint16_t s_errors; /* Behaviour when detecting errors */ + uint32_t s_checkinterval; /* Max time between checks */ + uint64_t s_lastcheck; /* Time of last check */ + uint32_t s_creator_os; /* OS */ + uint32_t s_feature_compat; /* Compatible feature set */ + uint32_t s_feature_incompat; /* Incompatible feature set */ + uint32_t s_feature_ro_compat; /* Readonly-compatible feature set */ + uint64_t s_root_blkno; /* Offset, in blocks, of root directory dinode */ + uint64_t s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ + uint32_t s_blocksize_bits; /* Blocksize for this fs */ + uint32_t s_clustersize_bits; /* Clustersize for this fs */ + uint16_t s_max_slots; /* Max number of simultaneous mounts before tunefs required */ + uint16_t s_reserved1; + uint32_t s_reserved2; + uint64_t s_first_cluster_group; /* Block offset of 1st cluster group header */ + uint8_t s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ + uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ } __attribute__((__packed__)); -int volume_id_probe_ocfs2(struct volume_id *id, __u64 off) +int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) { struct ocfs2_super_block *os; dbg("probing at offset 0x%llx", (unsigned long long) off); - os = (struct ocsf2_super_block *) volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200); + os = (struct ocfs2_super_block *) volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200); if (os == NULL) return -1; - if (strcmp(os->i_signature, "OCFSV2") != 0) { + if (memcmp(os->i_signature, "OCFSV2", 6) != 0) { return -1; } diff --git a/extras/volume_id/volume_id/ocfs2.h b/extras/volume_id/volume_id/ocfs2.h index 128348133c..b4b7cc4469 100644 --- a/extras/volume_id/volume_id/ocfs2.h +++ b/extras/volume_id/volume_id/ocfs2.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_OCFS2_ #define _VOLUME_ID_OCFS2_ -extern int volume_id_probe_ocfs2(struct volume_id *id, __u64 off); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/promise_raid.c b/extras/volume_id/volume_id/promise_raid.c index 8fda14945f..ed72809acb 100644 --- a/extras/volume_id/volume_id/promise_raid.c +++ b/extras/volume_id/volume_id/promise_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,15 +39,15 @@ #include "promise_raid.h" struct promise_meta { - __u8 sig[24]; + uint8_t sig[24]; } __attribute__((packed)); #define PDC_CONFIG_OFF 0x1200 #define PDC_SIGNATURE "Promise Technology, Inc." -int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; + const uint8_t *buf; struct promise_meta *pdc; unsigned int i; static unsigned int sectors[] = { @@ -62,7 +61,7 @@ int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u6 return -1; for (i = 0; sectors[i] != 0; i++) { - __u64 meta_off; + uint64_t meta_off; meta_off = ((size / 0x200) - sectors[i]) * 0x200; buf = volume_id_get_buffer(id, off + meta_off, 0x200); diff --git a/extras/volume_id/volume_id/promise_raid.h b/extras/volume_id/volume_id/promise_raid.h index 554bcb97d5..f1a9925d72 100644 --- a/extras/volume_id/volume_id/promise_raid.h +++ b/extras/volume_id/volume_id/promise_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_PROMISE_RAID_ #define _VOLUME_ID_PROMISE_RAID_ -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index a53fc4a5a9..75d1be05dc 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -41,37 +41,37 @@ #include "reiserfs.h" struct reiserfs_super_block { - __u32 blocks_count; - __u32 free_blocks; - __u32 root_block; - __u32 journal_block; - __u32 journal_dev; - __u32 orig_journal_size; - __u32 dummy2[5]; - __u16 blocksize; - __u16 dummy3[3]; - __u8 magic[12]; - __u32 dummy4[5]; - __u8 uuid[16]; - __u8 label[16]; + uint32_t blocks_count; + uint32_t free_blocks; + uint32_t root_block; + uint32_t journal_block; + uint32_t journal_dev; + uint32_t orig_journal_size; + uint32_t dummy2[5]; + uint16_t blocksize; + uint16_t dummy3[3]; + uint8_t magic[12]; + uint32_t dummy4[5]; + uint8_t uuid[16]; + uint8_t label[16]; } __attribute__((__packed__)); struct reiser4_super_block { - __u8 magic[16]; - __u16 dummy[2]; - __u8 uuid[16]; - __u8 label[16]; - __u64 dummy2; + uint8_t magic[16]; + uint16_t dummy[2]; + uint8_t uuid[16]; + uint8_t label[16]; + uint64_t dummy2; } __attribute__((__packed__)); #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 #define REISERFS_SUPERBLOCK_OFFSET 0x10000 -int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) +int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) { struct reiserfs_super_block *rs; struct reiser4_super_block *rs4; - __u8 *buf; + uint8_t *buf; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/reiserfs.h b/extras/volume_id/volume_id/reiserfs.h index 14f094578f..2ef1d255b7 100644 --- a/extras/volume_id/volume_id/reiserfs.h +++ b/extras/volume_id/volume_id/reiserfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_REISERFS_ #define _VOLUME_ID_REISERFS_ -extern int volume_id_probe_reiserfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/romfs.c b/extras/volume_id/volume_id/romfs.c index 9c2b41bb86..3d7df2443f 100644 --- a/extras/volume_id/volume_id/romfs.c +++ b/extras/volume_id/volume_id/romfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,13 +39,13 @@ #include "romfs.h" struct romfs_super { - __u8 magic[8]; - __u32 size; - __u32 checksum; - __u8 name[0]; + uint8_t magic[8]; + uint32_t size; + uint32_t checksum; + uint8_t name[0]; } __attribute__((__packed__)); -int volume_id_probe_romfs(struct volume_id *id, __u64 off) +int volume_id_probe_romfs(struct volume_id *id, uint64_t off) { struct romfs_super *rfs; @@ -57,7 +56,7 @@ int volume_id_probe_romfs(struct volume_id *id, __u64 off) return -1; if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { - size_t len = strlen(rfs->name); + size_t len = strlen((char *)rfs->name); if (len) { volume_id_set_label_raw(id, rfs->name, len); diff --git a/extras/volume_id/volume_id/romfs.h b/extras/volume_id/volume_id/romfs.h index b0108f3dde..5a8e900b08 100644 --- a/extras/volume_id/volume_id/romfs.h +++ b/extras/volume_id/volume_id/romfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_ROMFS_ #define _VOLUME_ID_ROMFS_ -extern int volume_id_probe_romfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/silicon_raid.c b/extras/volume_id/volume_id/silicon_raid.c index e528a34ce0..0d5ce043da 100644 --- a/extras/volume_id/volume_id/silicon_raid.c +++ b/extras/volume_id/volume_id/silicon_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,30 +39,30 @@ #include "silicon_raid.h" struct silicon_meta { - __u8 unknown0[0x2E]; - __u8 ascii_version[0x36 - 0x2E]; - __u8 diskname[0x56 - 0x36]; - __u8 unknown1[0x60 - 0x56]; - __u32 magic; - __u32 unknown1a[0x6C - 0x64]; - __u32 array_sectors_low; - __u32 array_sectors_high; - __u8 unknown2[0x78 - 0x74]; - __u32 thisdisk_sectors; - __u8 unknown3[0x100 - 0x7C]; - __u8 unknown4[0x104 - 0x100]; - __u16 product_id; - __u16 vendor_id; - __u16 minor_ver; - __u16 major_ver; + uint8_t unknown0[0x2E]; + uint8_t ascii_version[0x36 - 0x2E]; + uint8_t diskname[0x56 - 0x36]; + uint8_t unknown1[0x60 - 0x56]; + uint32_t magic; + uint32_t unknown1a[0x6C - 0x64]; + uint32_t array_sectors_low; + uint32_t array_sectors_high; + uint8_t unknown2[0x78 - 0x74]; + uint32_t thisdisk_sectors; + uint8_t unknown3[0x100 - 0x7C]; + uint8_t unknown4[0x104 - 0x100]; + uint16_t product_id; + uint16_t vendor_id; + uint16_t minor_ver; + uint16_t major_ver; } __attribute__((packed)); #define SILICON_MAGIC 0x2F000000 -int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct silicon_meta *sil; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/silicon_raid.h b/extras/volume_id/volume_id/silicon_raid.h index b88e80bb1c..0816125d7f 100644 --- a/extras/volume_id/volume_id/silicon_raid.h +++ b/extras/volume_id/volume_id/silicon_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_SILICON_RAID_ #define _VOLUME_ID_SILICON_RAID_ -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c index d4745daa22..9645ef8004 100644 --- a/extras/volume_id/volume_id/sysv.c +++ b/extras/volume_id/volume_id/sysv.c @@ -44,56 +44,56 @@ struct sysv_super { - __u16 s_isize; - __u16 s_pad0; - __u32 s_fsize; - __u16 s_nfree; - __u16 s_pad1; - __u32 s_free[SYSV_NICFREE]; - __u16 s_ninode; - __u16 s_pad2; - __u16 s_inode[SYSV_NICINOD]; - __u8 s_flock; - __u8 s_ilock; - __u8 s_fmod; - __u8 s_ronly; - __u32 s_time; - __u16 s_dinfo[4]; - __u32 s_tfree; - __u16 s_tinode; - __u16 s_pad3; - __u8 s_fname[6]; - __u8 s_fpack[6]; - __u32 s_fill[12]; - __u32 s_state; - __u32 s_magic; - __u32 s_type; + uint16_t s_isize; + uint16_t s_pad0; + uint32_t s_fsize; + uint16_t s_nfree; + uint16_t s_pad1; + uint32_t s_free[SYSV_NICFREE]; + uint16_t s_ninode; + uint16_t s_pad2; + uint16_t s_inode[SYSV_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint16_t s_dinfo[4]; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_pad3; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint32_t s_fill[12]; + uint32_t s_state; + uint32_t s_magic; + uint32_t s_type; } __attribute__((__packed__)); #define XENIX_NICINOD 100 #define XENIX_NICFREE 100 struct xenix_super { - __u16 s_isize; - __u32 s_fsize; - __u16 s_nfree; - __u32 s_free[XENIX_NICFREE]; - __u16 s_ninode; - __u16 s_inode[XENIX_NICINOD]; - __u8 s_flock; - __u8 s_ilock; - __u8 s_fmod; - __u8 s_ronly; - __u32 s_time; - __u32 s_tfree; - __u16 s_tinode; - __u16 s_dinfo[4]; - __u8 s_fname[6]; - __u8 s_fpack[6]; - __u8 s_clean; - __u8 s_fill[371]; - __u32 s_magic; - __u32 s_type; + uint16_t s_isize; + uint32_t s_fsize; + uint16_t s_nfree; + uint32_t s_free[XENIX_NICFREE]; + uint16_t s_ninode; + uint16_t s_inode[XENIX_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_dinfo[4]; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint8_t s_clean; + uint8_t s_fill[371]; + uint32_t s_magic; + uint32_t s_type; } __attribute__((__packed__)); #define SYSV_SUPERBLOCK_BLOCK 0x01 @@ -102,7 +102,7 @@ struct xenix_super { #define XENIX_MAGIC 0x2b5544 #define SYSV_MAX_BLOCKSIZE 0x800 -int volume_id_probe_sysv(struct volume_id *id, __u64 off) +int volume_id_probe_sysv(struct volume_id *id, uint64_t off) { struct sysv_super *vs; struct xenix_super *xs; diff --git a/extras/volume_id/volume_id/sysv.h b/extras/volume_id/volume_id/sysv.h index bd5a3500fb..1cb2bf9f43 100644 --- a/extras/volume_id/volume_id/sysv.h +++ b/extras/volume_id/volume_id/sysv.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_SYSV_ #define _VOLUME_ID_SYSV_ -extern int volume_id_probe_sysv(struct volume_id *id, __u64 off); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/udf.c b/extras/volume_id/volume_id/udf.c index a378fa9fd1..ecb6b9743d 100644 --- a/extras/volume_id/volume_id/udf.c +++ b/extras/volume_id/volume_id/udf.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -41,40 +40,40 @@ struct volume_descriptor { struct descriptor_tag { - __u16 id; - __u16 version; - __u8 checksum; - __u8 reserved; - __u16 serial; - __u16 crc; - __u16 crc_len; - __u32 location; + uint16_t id; + uint16_t version; + uint8_t checksum; + uint8_t reserved; + uint16_t serial; + uint16_t crc; + uint16_t crc_len; + uint32_t location; } __attribute__((__packed__)) tag; union { struct anchor_descriptor { - __u32 length; - __u32 location; + uint32_t length; + uint32_t location; } __attribute__((__packed__)) anchor; struct primary_descriptor { - __u32 seq_num; - __u32 desc_num; + uint32_t seq_num; + uint32_t desc_num; struct dstring { - __u8 clen; - __u8 c[31]; + uint8_t clen; + uint8_t c[31]; } __attribute__((__packed__)) ident; } __attribute__((__packed__)) primary; } __attribute__((__packed__)) type; } __attribute__((__packed__)); struct volume_structure_descriptor { - __u8 type; - __u8 id[5]; - __u8 version; + uint8_t type; + uint8_t id[5]; + uint8_t version; } __attribute__((__packed__)); #define UDF_VSD_OFFSET 0x8000 -int volume_id_probe_udf(struct volume_id *id, __u64 off) +int volume_id_probe_udf(struct volume_id *id, uint64_t off) { struct volume_descriptor *vd; struct volume_structure_descriptor *vsd; diff --git a/extras/volume_id/volume_id/udf.h b/extras/volume_id/volume_id/udf.h index b112e46ffc..5a784ad068 100644 --- a/extras/volume_id/volume_id/udf.h +++ b/extras/volume_id/volume_id/udf.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_UDF_ #define _VOLUME_ID_UDF_ -extern int volume_id_probe_udf(struct volume_id *id, __u64 off); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/ufs.c b/extras/volume_id/volume_id/ufs.c index d4f4db3d32..763b79cb0b 100644 --- a/extras/volume_id/volume_id/ufs.c +++ b/extras/volume_id/volume_id/ufs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,140 +39,140 @@ #include "ufs.h" struct ufs_super_block { - __u32 fs_link; - __u32 fs_rlink; - __u32 fs_sblkno; - __u32 fs_cblkno; - __u32 fs_iblkno; - __u32 fs_dblkno; - __u32 fs_cgoffset; - __u32 fs_cgmask; - __u32 fs_time; - __u32 fs_size; - __u32 fs_dsize; - __u32 fs_ncg; - __u32 fs_bsize; - __u32 fs_fsize; - __u32 fs_frag; - __u32 fs_minfree; - __u32 fs_rotdelay; - __u32 fs_rps; - __u32 fs_bmask; - __u32 fs_fmask; - __u32 fs_bshift; - __u32 fs_fshift; - __u32 fs_maxcontig; - __u32 fs_maxbpg; - __u32 fs_fragshift; - __u32 fs_fsbtodb; - __u32 fs_sbsize; - __u32 fs_csmask; - __u32 fs_csshift; - __u32 fs_nindir; - __u32 fs_inopb; - __u32 fs_nspf; - __u32 fs_optim; - __u32 fs_npsect_state; - __u32 fs_interleave; - __u32 fs_trackskew; - __u32 fs_id[2]; - __u32 fs_csaddr; - __u32 fs_cssize; - __u32 fs_cgsize; - __u32 fs_ntrak; - __u32 fs_nsect; - __u32 fs_spc; - __u32 fs_ncyl; - __u32 fs_cpg; - __u32 fs_ipg; - __u32 fs_fpg; + uint32_t fs_link; + uint32_t fs_rlink; + uint32_t fs_sblkno; + uint32_t fs_cblkno; + uint32_t fs_iblkno; + uint32_t fs_dblkno; + uint32_t fs_cgoffset; + uint32_t fs_cgmask; + uint32_t fs_time; + uint32_t fs_size; + uint32_t fs_dsize; + uint32_t fs_ncg; + uint32_t fs_bsize; + uint32_t fs_fsize; + uint32_t fs_frag; + uint32_t fs_minfree; + uint32_t fs_rotdelay; + uint32_t fs_rps; + uint32_t fs_bmask; + uint32_t fs_fmask; + uint32_t fs_bshift; + uint32_t fs_fshift; + uint32_t fs_maxcontig; + uint32_t fs_maxbpg; + uint32_t fs_fragshift; + uint32_t fs_fsbtodb; + uint32_t fs_sbsize; + uint32_t fs_csmask; + uint32_t fs_csshift; + uint32_t fs_nindir; + uint32_t fs_inopb; + uint32_t fs_nspf; + uint32_t fs_optim; + uint32_t fs_npsect_state; + uint32_t fs_interleave; + uint32_t fs_trackskew; + uint32_t fs_id[2]; + uint32_t fs_csaddr; + uint32_t fs_cssize; + uint32_t fs_cgsize; + uint32_t fs_ntrak; + uint32_t fs_nsect; + uint32_t fs_spc; + uint32_t fs_ncyl; + uint32_t fs_cpg; + uint32_t fs_ipg; + uint32_t fs_fpg; struct ufs_csum { - __u32 cs_ndir; - __u32 cs_nbfree; - __u32 cs_nifree; - __u32 cs_nffree; + uint32_t cs_ndir; + uint32_t cs_nbfree; + uint32_t cs_nifree; + uint32_t cs_nffree; } __attribute__((__packed__)) fs_cstotal; - __s8 fs_fmod; - __s8 fs_clean; - __s8 fs_ronly; - __s8 fs_flags; + int8_t fs_fmod; + int8_t fs_clean; + int8_t fs_ronly; + int8_t fs_flags; union { struct { - __s8 fs_fsmnt[512]; - __u32 fs_cgrotor; - __u32 fs_csp[31]; - __u32 fs_maxcluster; - __u32 fs_cpc; - __u16 fs_opostbl[16][8]; + int8_t fs_fsmnt[512]; + uint32_t fs_cgrotor; + uint32_t fs_csp[31]; + uint32_t fs_maxcluster; + uint32_t fs_cpc; + uint16_t fs_opostbl[16][8]; } __attribute__((__packed__)) fs_u1; struct { - __s8 fs_fsmnt[468]; - __u8 fs_volname[32]; - __u64 fs_swuid; - __s32 fs_pad; - __u32 fs_cgrotor; - __u32 fs_ocsp[28]; - __u32 fs_contigdirs; - __u32 fs_csp; - __u32 fs_maxcluster; - __u32 fs_active; - __s32 fs_old_cpc; - __s32 fs_maxbsize; - __s64 fs_sparecon64[17]; - __s64 fs_sblockloc; + int8_t fs_fsmnt[468]; + uint8_t fs_volname[32]; + uint64_t fs_swuid; + int32_t fs_pad; + uint32_t fs_cgrotor; + uint32_t fs_ocsp[28]; + uint32_t fs_contigdirs; + uint32_t fs_csp; + uint32_t fs_maxcluster; + uint32_t fs_active; + int32_t fs_old_cpc; + int32_t fs_maxbsize; + int64_t fs_sparecon64[17]; + int64_t fs_sblockloc; struct ufs2_csum_total { - __u64 cs_ndir; - __u64 cs_nbfree; - __u64 cs_nifree; - __u64 cs_nffree; - __u64 cs_numclusters; - __u64 cs_spare[3]; + uint64_t cs_ndir; + uint64_t cs_nbfree; + uint64_t cs_nifree; + uint64_t cs_nffree; + uint64_t cs_numclusters; + uint64_t cs_spare[3]; } __attribute__((__packed__)) fs_cstotal; struct ufs_timeval { - __s32 tv_sec; - __s32 tv_usec; + int32_t tv_sec; + int32_t tv_usec; } __attribute__((__packed__)) fs_time; - __s64 fs_size; - __s64 fs_dsize; - __u64 fs_csaddr; - __s64 fs_pendingblocks; - __s32 fs_pendinginodes; + int64_t fs_size; + int64_t fs_dsize; + uint64_t fs_csaddr; + int64_t fs_pendingblocks; + int32_t fs_pendinginodes; } __attribute__((__packed__)) fs_u2; } fs_u11; union { struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __s32 fs_state; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + int32_t fs_state; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; } __attribute__((__packed__)) fs_sun; struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __u32 fs_npsect; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + uint32_t fs_npsect; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; } __attribute__((__packed__)) fs_sunx86; struct { - __s32 fs_sparecon[50]; - __s32 fs_contigsumsize; - __s32 fs_maxsymlinklen; - __s32 fs_inodefmt; - __u32 fs_maxfilesize[2]; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - __s32 fs_state; + int32_t fs_sparecon[50]; + int32_t fs_contigsumsize; + int32_t fs_maxsymlinklen; + int32_t fs_inodefmt; + uint32_t fs_maxfilesize[2]; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + int32_t fs_state; } __attribute__((__packed__)) fs_44; } fs_u2; - __s32 fs_postblformat; - __s32 fs_nrpos; - __s32 fs_postbloff; - __s32 fs_rotbloff; - __u32 fs_magic; - __u8 fs_space[1]; + int32_t fs_postblformat; + int32_t fs_nrpos; + int32_t fs_postbloff; + int32_t fs_rotbloff; + uint32_t fs_magic; + uint8_t fs_space[1]; } __attribute__((__packed__)); #define UFS_MAGIC 0x00011954 @@ -181,12 +180,12 @@ struct ufs_super_block { #define UFS_MAGIC_FEA 0x00195612 #define UFS_MAGIC_LFN 0x00095014 -int volume_id_probe_ufs(struct volume_id *id, __u64 off) +int volume_id_probe_ufs(struct volume_id *id, uint64_t off) { - __u32 magic; - int i; + uint32_t magic; + int i; struct ufs_super_block *ufs; - int offsets[] = {0, 8, 64, 256, -1}; + int offsets[] = {0, 8, 64, 256, -1}; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/ufs.h b/extras/volume_id/volume_id/ufs.h index 82b4e1d064..8f0af18897 100644 --- a/extras/volume_id/volume_id/ufs.h +++ b/extras/volume_id/volume_id/ufs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_UFS_ #define _VOLUME_ID_UFS_ -extern int volume_id_probe_ufs(struct volume_id *id, __u64 off); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 7499fc121e..a145a8aa2f 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -34,16 +34,15 @@ #include <ctype.h> #include <fcntl.h> #include <sys/stat.h> -#include <asm/types.h> #include "volume_id.h" #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) +void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) { unsigned int i, j; - __u16 c; + uint16_t c; j = 0; for (i = 0; i + 2 <= count; i += 2) { @@ -57,18 +56,18 @@ void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum } else if (c < 0x80) { if (j+1 >= len) break; - str[j++] = (__u8) c; + str[j++] = (uint8_t) c; } else if (c < 0x800) { if (j+2 >= len) break; - str[j++] = (__u8) (0xc0 | (c >> 6)); - str[j++] = (__u8) (0x80 | (c & 0x3f)); + str[j++] = (uint8_t) (0xc0 | (c >> 6)); + str[j++] = (uint8_t) (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++] = (uint8_t) (0xe0 | (c >> 12)); + str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); } } str[j] = '\0'; @@ -109,20 +108,26 @@ void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) id->usage = usage_to_string(usage_id); } -void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count) +void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) { memcpy(id->label_raw, buf, count); id->label_raw_len = count; } -void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned int count) +static size_t my_strnlen(const char *s, size_t max) { + const char *p = s; + for (; *p && max--; ++p); + return(p - s); +} + +void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) { unsigned int i; memcpy(id->label, buf, count); /* remove trailing whitespace */ - i = strnlen(id->label, count); + i = my_strnlen(id->label, count); while (i--) { if (!isspace(id->label[i])) break; @@ -130,12 +135,12 @@ void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned id->label[i+1] = '\0'; } -void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count) +void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) { 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) +void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) { unsigned int i; unsigned int count = 0; @@ -196,11 +201,11 @@ set: } } -__u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) +uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { - unsigned int buf_len; + size_t buf_len; - dbg("get buffer off 0x%llx(%llu), len 0x%x", (unsigned long long) off, (unsigned long long) off, len); + dbg("get buffer off 0x%llx(%llu), len 0x%zx", (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) { @@ -214,7 +219,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int 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); + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->sbbuf_len = buf_len; if (buf_len < off + len) return NULL; @@ -236,15 +241,15 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) /* 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", (unsigned long long) off, len); + dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) == -1) return NULL; buf_len = read(id->fd, id->seekbuf, len); - dbg("got 0x%x (%i) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; if (buf_len < len) { - dbg("requested 0x%x bytes, got only 0x%x bytes", len, buf_len); + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; } } diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index e18efe2f21..0c94fea051 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -37,22 +37,22 @@ #define SEEK_BUFFER_SIZE 0x10000 /* probe volume for all known filesystems in specific order */ -#define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ - (((__u16)(x) & 0xff00u) >> 8)) +#define bswap16(x) (uint16_t) ((((uint16_t)(x) & 0x00ffu) << 8) | \ + (((uint16_t)(x) & 0xff00u) >> 8)) -#define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ - (((__u32)(x) & 0x00ff0000u) >> 8) | \ - (((__u32)(x) & 0x0000ff00u) << 8) | \ - (((__u32)(x) & 0x000000ffu) << 24)) +#define bswap32(x) (uint32_t) ((((uint32_t)(x) & 0xff000000u) >> 24) | \ + (((uint32_t)(x) & 0x00ff0000u) >> 8) | \ + (((uint32_t)(x) & 0x0000ff00u) << 8) | \ + (((uint32_t)(x) & 0x000000ffu) << 24)) -#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000ull) >> 56) | \ - (((__u64)(x) & 0x00ff000000000000ull) >> 40) | \ - (((__u64)(x) & 0x0000ff0000000000ull) >> 24) | \ - (((__u64)(x) & 0x000000ff00000000ull) >> 8) | \ - (((__u64)(x) & 0x00000000ff000000ull) << 8) | \ - (((__u64)(x) & 0x0000000000ff0000ull) << 24) | \ - (((__u64)(x) & 0x000000000000ff00ull) << 40) | \ - (((__u64)(x) & 0x00000000000000ffull) << 56)) +#define bswap64(x) (uint64_t) ((((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \ + (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \ + (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \ + (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \ + (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \ + (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \ + (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \ + (((uint64_t)(x) & 0x00000000000000ffull) << 56)) #ifdef __BYTE_ORDER #if (__BYTE_ORDER == __LITTLE_ENDIAN) @@ -87,14 +87,14 @@ enum endian { 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_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t 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); -extern void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned int count); -extern void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count); -extern void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format); -extern __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len); +extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); +extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); extern void volume_id_free_buffer(struct volume_id *id); #endif /* _VOLUME_ID_UTIL_ */ diff --git a/extras/volume_id/volume_id/via_raid.c b/extras/volume_id/volume_id/via_raid.c index 393890eb28..2f167dcbcc 100644 --- a/extras/volume_id/volume_id/via_raid.c +++ b/extras/volume_id/volume_id/via_raid.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,25 +39,25 @@ #include "via_raid.h" struct via_meta { - __u16 signature; - __u8 version_number; + uint16_t signature; + uint8_t version_number; struct via_array { - __u16 disk_bits; - __u8 disk_array_ex; - __u32 capacity_low; - __u32 capacity_high; - __u32 serial_checksum; + uint16_t disk_bits; + uint8_t disk_array_ex; + uint32_t capacity_low; + uint32_t capacity_high; + uint32_t serial_checksum; } __attribute((packed)) array; - __u32 serial_checksum[8]; - __u8 checksum; + uint32_t serial_checksum[8]; + uint8_t checksum; } __attribute__((packed)); #define VIA_SIGNATURE 0xAA55 -int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct via_meta *via; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/via_raid.h b/extras/volume_id/volume_id/via_raid.h index 2d0651c413..429375dcc9 100644 --- a/extras/volume_id/volume_id/via_raid.h +++ b/extras/volume_id/volume_id/via_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_VIA_RAID_ #define _VOLUME_ID_VIA_RAID_ -extern int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 8e944be0b1..4c4a42a00d 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -35,7 +35,6 @@ #include <ctype.h> #include <fcntl.h> #include <sys/stat.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -71,7 +70,7 @@ #include "msdos.h" #include "ocfs2.h" -int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size) +int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) { if (id == NULL) return -EINVAL; @@ -224,7 +223,7 @@ struct volume_id *volume_id_open_node(const char *path) struct volume_id *volume_id_open_dev_t(dev_t devt) { struct volume_id *id; - __u8 tmp_node[VOLUME_ID_PATH_MAX]; + char tmp_node[VOLUME_ID_PATH_MAX]; snprintf(tmp_node, VOLUME_ID_PATH_MAX, "/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt)); diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 4e0defdadd..a82b221028 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,9 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 46 +#include <stdint.h> + +#define VOLUME_ID_VERSION 47 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 @@ -44,17 +46,17 @@ struct volume_id_partition { enum volume_id_usage usage_id; char *usage; char *type; - unsigned long long off; - unsigned long long len; - unsigned int partition_type_raw; + uint64_t off; + uint64_t len; + uint8_t partition_type_raw; }; struct volume_id { - unsigned char label_raw[VOLUME_ID_LABEL_SIZE]; - unsigned int label_raw_len; + uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; char label[VOLUME_ID_LABEL_SIZE+1]; - unsigned char uuid_raw[VOLUME_ID_UUID_SIZE]; - unsigned int uuid_raw_len; + uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_raw_len; char uuid[VOLUME_ID_UUID_SIZE+1]; enum volume_id_usage usage_id; char *usage; @@ -62,21 +64,21 @@ struct volume_id { char type_version[VOLUME_ID_FORMAT_SIZE]; struct volume_id_partition *partitions; - unsigned int partition_count; + size_t partition_count; int fd; - unsigned char *sbbuf; - unsigned int sbbuf_len; - unsigned char *seekbuf; - unsigned long long seekbuf_off; - unsigned int seekbuf_len; - int fd_close; + uint8_t *sbbuf; + size_t sbbuf_len; + uint8_t *seekbuf; + uint64_t seekbuf_off; + size_t seekbuf_len; + int fd_close:1; }; extern struct volume_id *volume_id_open_fd(int fd); extern struct volume_id *volume_id_open_node(const char *path); extern struct volume_id *volume_id_open_dev_t(dev_t devt); -extern int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size); +extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); extern void volume_id_close(struct volume_id *id); #endif diff --git a/extras/volume_id/volume_id/xfs.c b/extras/volume_id/volume_id/xfs.c index b8702a3fb3..e631e23ead 100644 --- a/extras/volume_id/volume_id/xfs.c +++ b/extras/volume_id/volume_id/xfs.c @@ -32,7 +32,6 @@ #include <string.h> #include <errno.h> #include <ctype.h> -#include <asm/types.h> #include "volume_id.h" #include "logging.h" @@ -40,21 +39,21 @@ #include "xfs.h" struct xfs_super_block { - __u8 magic[4]; - __u32 blocksize; - __u64 dblocks; - __u64 rblocks; - __u32 dummy1[2]; - __u8 uuid[16]; - __u32 dummy2[15]; - __u8 fname[12]; - __u32 dummy3[2]; - __u64 icount; - __u64 ifree; - __u64 fdblocks; + uint8_t magic[4]; + uint32_t blocksize; + uint64_t dblocks; + uint64_t rblocks; + uint32_t dummy1[2]; + uint8_t uuid[16]; + uint32_t dummy2[15]; + uint8_t fname[12]; + uint32_t dummy3[2]; + uint64_t icount; + uint64_t ifree; + uint64_t fdblocks; } __attribute__((__packed__)); -int volume_id_probe_xfs(struct volume_id *id, __u64 off) +int volume_id_probe_xfs(struct volume_id *id, uint64_t off) { struct xfs_super_block *xs; diff --git a/extras/volume_id/volume_id/xfs.h b/extras/volume_id/volume_id/xfs.h index 76b1725664..537617f7e5 100644 --- a/extras/volume_id/volume_id/xfs.h +++ b/extras/volume_id/volume_id/xfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID__ #define _VOLUME_ID__ -extern int volume_id_probe_xfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); #endif |