Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Update
efibootmgr
efibootmgr-gcc-Wall.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File efibootmgr-gcc-Wall.diff of Package efibootmgr
From: Raymund Will <rw@suse.com> Subject: Fix all gcc warnings. + cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \ -c -o src/lib/disk.o src/lib/disk.c src/lib/disk.c: In function 'disk_get_ide_pci': src/lib/disk.c:195:9: warning: variable 'read_count' set but not used [-Wunused-but-set-variable] src/lib/disk.c: In function 'disk_get_partition_info': src/lib/disk.c:468:8: warning: variable 'offset' set but not used [-Wunused-but-set-variable] + cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \ -c -o src/lib/efi.o src/lib/efi.c src/lib/efi.c: In function 'is_parent_bridge': src/lib/efi.c:311:16: warning: variable 'primary' set but not used [-Wunused-but-set-variable] src/lib/efi.c: In function 'make_disk_load_option': src/lib/efi.c:536:10: warning: pointer targets in passing argument 5 of 'make_harddrive_device_path' differ in signedness [-Wpointer-sign] src/lib/efi.c:418:1: note: expected 'uint8_t *' but argument is of type 'char *' + cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \ -c -o src/lib/gpt.o src/lib/gpt.c src/lib/gpt.c: In function 'compare_gpts': src/lib/gpt.c:401:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:401:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:409:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:409:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:417:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:417:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:425:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:425:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:462:10: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat] src/lib/gpt.c:470:10: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat] + cc -Wall -g -D_FILE_OFFSET_BITS=64 -Isrc/lib -Isrc/include \ -c -o src/lib/efivars_sysfs.o src/lib/efivars_sysfs.c In file included from src/lib/efi.c:43:0: src/include/scsi_ioctls.h:38:12: warning: inline function 'get_scsi_pci' declared but never defined inline int get_scsi_pci(int fd, char *slot_name); ^ src/include/scsi_ioctls.h:37:12: warning: inline function 'get_scsi_idlun' declared but never defined inline int get_scsi_idlun(int fd, Scsi_Idlun *idlun); ^ In file included from src/lib/disk.c:30:0: src/include/scsi_ioctls.h:38:12: warning: inline function 'get_scsi_pci' declared but never defined inline int get_scsi_pci(int fd, char *slot_name); ^ src/include/scsi_ioctls.h:37:12: warning: inline function 'get_scsi_idlun' declared but never defined inline int get_scsi_idlun(int fd, Scsi_Idlun *idlun); ^ Signed-off-by: Raymund Will <rw@suse.com> --- src/include/scsi_ioctls.h | 13 +++++++++++-- src/lib/disk.c | 10 +++++++++- src/lib/efi.c | 4 +++- src/lib/gpt.c | 9 +++++++++ src/lib/scsi_ioctls.c | 5 +++-- 5 files changed, 35 insertions(+), 6 deletions(-) --- a/src/lib/disk.c +++ b/src/lib/disk.c @@ -211,6 +211,7 @@ disk_get_ide_pci(int fd, read_count = read(procfd, infoline, sizeof(infoline)-1); close(procfd); + infoline[(read_count < 0) ? 0 : read_count] = 0; num_scanned = sscanf(infoline, "pci bus %x device %x vid %*x did %*x channel %*x", &b, &d); @@ -375,7 +376,10 @@ msdos_disk_get_partition_info (int fd, l /* Write it to the disk */ lseek(fd, 0, SEEK_SET); - write(fd, mbr, sizeof(*mbr)); + rc = write(fd, mbr, sizeof(*mbr)); + if (rc == -1) { + perror("write unique MBR signature"); + } } *(uint32_t *)signature = mbr->unique_mbr_signature; @@ -478,6 +482,10 @@ disk_get_partition_info (int fd, memset(mbr_sector, '\0', mbr_size); offset = lseek(fd, 0, SEEK_SET); + if (offset) { + rc=1; + goto error_free_mbr; + } this_bytes_read = read(fd, mbr_sector, mbr_size); if (this_bytes_read < sizeof(*mbr)) { rc=1; --- a/src/lib/efi.c +++ b/src/lib/efi.c @@ -316,6 +316,8 @@ is_parent_bridge(struct pci_dev *p, unsi primary=pci_read_byte(p, PCI_PRIMARY_BUS); secondary=pci_read_byte(p, PCI_SECONDARY_BUS); + if (primary == 0xFF) + /* return NULL*/; /* don't care!? */ if (secondary != target_bus) return NULL; @@ -416,7 +418,7 @@ make_scsi_device_path(void *dest, uint16 static uint16_t make_harddrive_device_path(void *dest, uint32_t num, uint64_t start, uint64_t size, - uint8_t *signature, + char *signature, uint8_t mbr_type, uint8_t signature_type) { HARDDRIVE_DEVICE_PATH p; --- a/src/lib/gpt.c +++ b/src/lib/gpt.c @@ -32,7 +32,16 @@ #include <unistd.h> #include <errno.h> #include <sys/utsname.h> +#if 0 +/* don't use kernel headers! */ #include <asm/byteorder.h> +#else +#include <endian.h> +#define __le16_to_cpu le16toh +#define __le32_to_cpu le32toh +#define __le64_to_cpu le64toh +#define __cpu_to_le32 htole32 +#endif #include "crc32.h" #include "disk.h" #include "gpt.h" --- a/src/include/scsi_ioctls.h +++ b/src/include/scsi_ioctls.h @@ -34,8 +34,17 @@ typedef struct scsi_idlun { } Scsi_Idlun; -inline int get_scsi_idlun(int fd, Scsi_Idlun *idlun); -inline int get_scsi_pci(int fd, char *slot_name); +static inline int +get_scsi_idlun(int fd, Scsi_Idlun *idlun) +{ + return ioctl(fd, SCSI_IOCTL_GET_IDLUN, idlun); +} +static inline int +get_scsi_pci(int fd, char *slot_name) +{ + return ioctl(fd, SCSI_IOCTL_GET_PCI, slot_name); +} + int idlun_to_components (Scsi_Idlun *idlun, unsigned char *host, unsigned char *channel, --- a/src/lib/scsi_ioctls.c +++ b/src/lib/scsi_ioctls.c @@ -42,7 +42,8 @@ idlun_to_components (Scsi_Idlun *idlun, return 0; } - +#if 0 +/* moved definition to src/include/scsi_ioctls.h */ inline int get_scsi_idlun(int fd, Scsi_Idlun *idlun) { @@ -54,7 +55,7 @@ get_scsi_pci(int fd, char *slot_name) { return ioctl(fd, SCSI_IOCTL_GET_PCI, slot_name); } - +#endif #ifdef SCSI_IOCTLS_EXE
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor