efibootmgr/0020-Clean-up-some-whitespace.patch

338 lines
9.3 KiB
Diff
Raw Normal View History

From e56d305380334d17bd0701fb5f8347542e293b14 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 1 Aug 2014 08:36:49 -0400
Subject: [PATCH 20/22] Clean up some whitespace.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/include/efi.h | 2 +-
src/include/scsi_ioctls.h | 6 +++---
src/lib/disk.c | 42 ++++++++++++++++++------------------------
src/lib/efi.c | 6 +++---
src/lib/scsi_ioctls.c | 12 ++++++------
src/lib/unparse_path.c | 8 +++-----
6 files changed, 34 insertions(+), 42 deletions(-)
diff --git a/src/include/efi.h b/src/include/efi.h
index 954b4a6..ec25be9 100644
--- a/src/include/efi.h
+++ b/src/include/efi.h
@@ -236,7 +236,7 @@ typedef struct {
uint32_t reserved;
uint64_t node_guid;
uint64_t ioc_guid;
- uint64_t id;
+ uint64_t id;
} __attribute__((packed)) INFINIBAND_DEVICE_PATH;
typedef struct {
diff --git a/src/include/scsi_ioctls.h b/src/include/scsi_ioctls.h
index 331bb14..d355534 100644
--- a/src/include/scsi_ioctls.h
+++ b/src/include/scsi_ioctls.h
@@ -1,8 +1,8 @@
/*
scsi_ioctls.[ch]
-
+
Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -19,7 +19,7 @@
*/
#ifndef _SCSI_IOCTLS_H
-#define _SCSI_IOCTLS_H
+#define _SCSI_IOCTLS_H
#include <stdint.h>
#include <stddef.h>
diff --git a/src/lib/disk.c b/src/lib/disk.c
index ad95fd4..904010b 100644
--- a/src/lib/disk.c
+++ b/src/lib/disk.c
@@ -1,8 +1,8 @@
/*
disk.[ch]
-
+
Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -179,7 +179,7 @@ disk_info_from_fd(int fd, struct disk_info *info)
info->part = info->minor & 0x3F;
return 0;
}
-
+
/* I2O disks can have up to 16 partitions, or 4 bits worth. */
if (info->major >= 80 && info->major <= 87) {
info->interface_type = i2o;
@@ -248,7 +248,7 @@ disk_get_virt_pci(const struct disk_info *info, unsigned char *bus,
}
static int
-disk_get_scsi_pci(int fd,
+disk_get_scsi_pci(int fd,
const struct disk_info *info,
unsigned char *bus,
unsigned char *device,
@@ -265,7 +265,7 @@ disk_get_scsi_pci(int fd,
return 1;
}
if (S_ISREG(buf.st_mode)) {
- /* can't call ioctl() on this file and have it succeed.
+ /* can't call ioctl() on this file and have it succeed.
* instead, need to open the block device
* from /dev/.
*/
@@ -320,13 +320,13 @@ disk_get_ide_pci(int fd,
char procname[80], infoline[80];
size_t read_count __attribute__((unused));
int rc;
-
+
rc = disk_info_from_fd(fd, &info);
if (rc) return rc;
sprintf(procname, "/proc/ide/ide%d/config", info.controllernum);
-
+
procfd = open(procname, O_RDONLY);
if (!procfd) {
perror("opening /proc/ide/ide*/config");
@@ -334,11 +334,11 @@ disk_get_ide_pci(int fd,
}
read_count = read(procfd, infoline, sizeof(infoline)-1);
close(procfd);
-
+
num_scanned = sscanf(infoline,
"pci bus %x device %x vid %*x did %*x channel %*x",
&b, &d);
-
+
if (num_scanned == 2) {
*bus = b;
*device = PCI_SLOT(d);
@@ -376,7 +376,7 @@ disk_get_pci(int fd,
break;
}
return 1;
-}
+}
int
disk_get_size(int fd, long *size)
@@ -441,12 +441,12 @@ msdos_disk_get_partition_info (int fd, legacy_mbr *mbr,
uint64_t *start, uint64_t *size,
char *signature,
uint8_t *mbr_type, uint8_t *signature_type)
-{
+{
int rc;
long disk_size=0;
struct stat stat;
struct timeval tv;
-
+
if (!mbr) return 1;
if (!is_mbr_valid(mbr)) return 1;
@@ -454,7 +454,6 @@ msdos_disk_get_partition_info (int fd, legacy_mbr *mbr,
*signature_type = 0x01;
if (!mbr->unique_mbr_signature && !opts.write_signature) {
-
printf("\n\n******************************************************\n");
printf("Warning! This MBR disk does not have a unique signature.\n");
printf("If this is not the first disk found by EFI, you may not be able\n");
@@ -462,14 +461,11 @@ msdos_disk_get_partition_info (int fd, legacy_mbr *mbr,
printf("Run efibootmgr with the -w flag to write a unique signature\n");
printf("to the disk.\n");
printf("******************************************************\n\n");
-
}
else if (!mbr->unique_mbr_signature && opts.write_signature) {
-
- /* MBR Signatures must be unique for the
+ /* MBR Signatures must be unique for the
EFI Boot Manager
to find the right disk to boot from */
-
rc = fstat(fd, &stat);
if (rc == -1) {
perror("stat disk");
@@ -479,19 +475,18 @@ msdos_disk_get_partition_info (int fd, legacy_mbr *mbr,
if (rc == -1) {
perror("gettimeofday");
}
-
+
/* Write the device type to the signature.
This should be unique per disk per system */
mbr->unique_mbr_signature = tv.tv_usec << 16;
mbr->unique_mbr_signature |= stat.st_rdev & 0xFFFF;
-
+
/* Write it to the disk */
lseek(fd, 0, SEEK_SET);
rc = write(fd, mbr, sizeof(*mbr));
}
*(uint32_t *)signature = mbr->unique_mbr_signature;
-
-
+
if (num > 4) {
/* Extended partition */
return msdos_disk_get_extended_partition_info(fd, mbr, num,
@@ -507,7 +502,6 @@ msdos_disk_get_partition_info (int fd, legacy_mbr *mbr,
/* Primary partition */
*start = mbr->partition[num-1].starting_lba;
*size = mbr->partition[num-1].size_in_lba;
-
}
return 0;
}
@@ -561,13 +555,13 @@ lcm(unsigned int x, unsigned int y)
* @signature - partition signature returned
* @mbr_type - partition type returned
* @signature_type - signature type returned
- *
+ *
* Description: Finds partition table info for given partition on given disk.
* Both GPT and MSDOS partition tables are tested for.
* Returns 0 on success, non-zero on failure
*/
int
-disk_get_partition_info (int fd,
+disk_get_partition_info (int fd,
uint32_t num,
uint64_t *start, uint64_t *size,
char *signature,
diff --git a/src/lib/efi.c b/src/lib/efi.c
index 74df42a..133b8bb 100644
--- a/src/lib/efi.c
+++ b/src/lib/efi.c
@@ -611,7 +611,7 @@ static ssize_t
make_net_load_option(char *iface, uint8_t *buf, size_t size)
{
/* copied pretty much verbatim from the ethtool source */
- int fd = 0, err;
+ int fd = 0, err;
unsigned char bus, slot, func;
struct ifreq ifr;
struct ethtool_drvinfo drvinfo;
@@ -681,7 +681,7 @@ make_net_load_option(char *iface, uint8_t *buf, size_t size)
return needed;
buf_offset += needed;
- needed = make_end_device_path(buf + buf_offset,
+ needed = make_end_device_path(buf + buf_offset,
size == 0 ? 0 : size - buf_offset);
if (needed < 0)
return needed;
@@ -857,7 +857,7 @@ append_extra_args_file(uint8_t **data, size_t *data_size)
ssize_t num_read=0;
unsigned long appended=0;
size_t maxchars = 0;
- char *buffer;
+ char *buffer;
if (!data) {
fprintf(stderr, "internal error\n");
diff --git a/src/lib/scsi_ioctls.c b/src/lib/scsi_ioctls.c
index c04f12a..3aaa933 100644
--- a/src/lib/scsi_ioctls.c
+++ b/src/lib/scsi_ioctls.c
@@ -1,8 +1,8 @@
/*
scsi_ioctls.[ch]
-
+
Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -41,7 +41,7 @@ idlun_to_components (Scsi_Idlun *idlun,
unsigned char *lun)
{
if (!idlun || !host || !channel || !id || !lun) return 1;
-
+
*host = (idlun->dev_id >> 24) & 0xFF;
*channel = (idlun->dev_id >> 16) & 0xFF;
*id = (idlun->dev_id ) & 0xFF;
@@ -56,7 +56,7 @@ get_scsi_idlun(int fd, Scsi_Idlun *idlun)
return ioctl(fd, SCSI_IOCTL_GET_IDLUN, idlun);
}
-int
+int
get_scsi_pci(int fd, char *slot_name, size_t size)
{
char buf[SLOT_NAME_SIZE] = "";
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
memset(&idlun, 0, sizeof(idlun));
if (argc < 2) {usage(argv); exit(1);}
-
+
fd = open(argv[1], O_RDONLY);
if (fd == -1) {
perror("Unable to open file");
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
if (rc) {
perror("Unable to get_scsi_idlun()");
}
-
+
printf("Device: %s\n", argv[1]);
printf("PCI: %s\n", slot_name);
diff --git a/src/lib/unparse_path.c b/src/lib/unparse_path.c
index b164758..431dc06 100644
--- a/src/lib/unparse_path.c
+++ b/src/lib/unparse_path.c
@@ -1,8 +1,8 @@
/*
unparse_path.[ch]
-
+
Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -582,7 +582,6 @@ main(int argc, char **argv)
exit(-1);
}
-
fd = open(argv[1], O_RDONLY);
if (fd == -1) {
perror("Failed to open file.");
@@ -595,8 +594,7 @@ main(int argc, char **argv)
exit(-1);
}
unparse_var(&var);
-
-
+
return 0;
}
#endif
--
1.9.3