remove all trailing whitespace

This commit is contained in:
fzielcke 2009-06-10 21:04:23 +00:00
parent d2d4966571
commit b39f9d20a9
222 changed files with 3286 additions and 3286 deletions

View file

@ -32,7 +32,7 @@ struct grub_loopback
struct grub_loopback *next;
};
static struct grub_loopback *loopback_list;
static struct grub_loopback *loopback_list;
static const struct grub_arg_option options[] =
{
@ -54,17 +54,17 @@ delete_loopback (const char *name)
prev = &dev->next, dev = dev->next)
if (grub_strcmp (dev->devname, name) == 0)
break;
if (! dev)
return grub_error (GRUB_ERR_BAD_DEVICE, "Device not found");
/* Remove the device from the list. */
*prev = dev->next;
grub_free (dev->devname);
grub_free (dev->filename);
grub_free (dev);
return 0;
}
@ -75,56 +75,56 @@ grub_cmd_loopback (grub_extcmd_t cmd, int argc, char **args)
struct grub_arg_list *state = state = cmd->state;
grub_file_t file;
struct grub_loopback *newdev;
if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
/* Check if `-d' was used. */
if (state[0].set)
return delete_loopback (args[0]);
if (argc < 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
file = grub_file_open (args[1]);
if (! file)
return grub_errno;
/* Close the file, the only reason for opening it is validation. */
grub_file_close (file);
/* First try to replace the old device. */
for (newdev = loopback_list; newdev; newdev = newdev->next)
if (grub_strcmp (newdev->devname, args[0]) == 0)
break;
if (newdev)
{
char *newname = grub_strdup (args[1]);
if (! newname)
return grub_errno;
grub_free (newdev->filename);
newdev->filename = newname;
/* Set has_partitions when `--partitions' was used. */
newdev->has_partitions = state[1].set;
return 0;
}
/* Unable to replace it, make a new entry. */
newdev = grub_malloc (sizeof (struct grub_loopback));
if (! newdev)
return grub_errno;
newdev->devname = grub_strdup (args[0]);
if (! newdev->devname)
{
grub_free (newdev);
return grub_errno;
}
newdev->filename = grub_strdup (args[1]);
if (! newdev->filename)
{
@ -132,14 +132,14 @@ grub_cmd_loopback (grub_extcmd_t cmd, int argc, char **args)
grub_free (newdev);
return grub_errno;
}
/* Set has_partitions when `--partitions' was used. */
newdev->has_partitions = state[1].set;
/* Add the new entry to the list. */
newdev->next = loopback_list;
loopback_list = newdev;
return 0;
}
@ -161,26 +161,26 @@ grub_loopback_open (const char *name, grub_disk_t disk)
{
grub_file_t file;
struct grub_loopback *dev;
for (dev = loopback_list; dev; dev = dev->next)
if (grub_strcmp (dev->devname, name) == 0)
break;
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
file = grub_file_open (dev->filename);
if (! file)
return grub_errno;
/* Use the filesize for the disk size, round up to a complete sector. */
disk->total_sectors = ((file->size + GRUB_DISK_SECTOR_SIZE - 1)
/ GRUB_DISK_SECTOR_SIZE);
disk->id = (unsigned long) dev;
disk->has_partitions = dev->has_partitions;
disk->data = file;
return 0;
}
@ -188,7 +188,7 @@ static void
grub_loopback_close (grub_disk_t disk)
{
grub_file_t file = (grub_file_t) disk->data;
grub_file_close (file);
}
@ -198,13 +198,13 @@ grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector,
{
grub_file_t file = (grub_file_t) disk->data;
grub_off_t pos;
grub_file_seek (file, sector << GRUB_DISK_SECTOR_BITS);
grub_file_read (file, buf, size << GRUB_DISK_SECTOR_BITS);
if (grub_errno)
return grub_errno;
/* In case there is more data read than there is available, in case
of files that are not a multiple of GRUB_DISK_SECTOR_SIZE, fill
the rest with zeros. */
@ -214,7 +214,7 @@ grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t amount = pos - file->size;
grub_memset (buf + (size << GRUB_DISK_SECTOR_BITS) - amount, 0, amount);
}
return 0;
}