remove all trailing whitespace
This commit is contained in:
parent
d2d4966571
commit
b39f9d20a9
222 changed files with 3286 additions and 3286 deletions
58
kern/disk.c
58
kern/disk.c
|
@ -132,7 +132,7 @@ grub_disk_cache_fetch (unsigned long dev_id, unsigned long disk_id,
|
|||
#if 0
|
||||
grub_disk_cache_misses++;
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -157,19 +157,19 @@ grub_disk_cache_store (unsigned long dev_id, unsigned long disk_id,
|
|||
{
|
||||
unsigned index;
|
||||
struct grub_disk_cache *cache;
|
||||
|
||||
|
||||
index = grub_disk_cache_get_index (dev_id, disk_id, sector);
|
||||
cache = grub_disk_cache_table + index;
|
||||
|
||||
|
||||
cache->lock = 1;
|
||||
grub_free (cache->data);
|
||||
cache->data = 0;
|
||||
cache->lock = 0;
|
||||
|
||||
|
||||
cache->data = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
|
||||
if (! cache->data)
|
||||
return grub_errno;
|
||||
|
||||
|
||||
grub_memcpy (cache->data, data,
|
||||
GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
|
||||
cache->dev_id = dev_id;
|
||||
|
@ -194,7 +194,7 @@ void
|
|||
grub_disk_dev_unregister (grub_disk_dev_t dev)
|
||||
{
|
||||
grub_disk_dev_t *p, q;
|
||||
|
||||
|
||||
for (p = &grub_disk_dev_list, q = *p; q; p = &(q->next), q = q->next)
|
||||
if (q == dev)
|
||||
{
|
||||
|
@ -255,12 +255,12 @@ grub_disk_open (const char *name)
|
|||
disk->name = grub_strdup (name);
|
||||
if (! disk->name)
|
||||
goto fail;
|
||||
|
||||
|
||||
p = find_part_sep (name);
|
||||
if (p)
|
||||
{
|
||||
grub_size_t len = p - name;
|
||||
|
||||
|
||||
raw = grub_malloc (len + 1);
|
||||
if (! raw)
|
||||
goto fail;
|
||||
|
@ -290,7 +290,7 @@ grub_disk_open (const char *name)
|
|||
grub_error (GRUB_ERR_BAD_DEVICE, "no partition on this disk");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
disk->dev = dev;
|
||||
|
||||
if (p)
|
||||
|
@ -310,11 +310,11 @@ grub_disk_open (const char *name)
|
|||
if (current_time > (grub_last_time
|
||||
+ GRUB_CACHE_TIMEOUT * 1000))
|
||||
grub_disk_cache_invalidate_all ();
|
||||
|
||||
|
||||
grub_last_time = current_time;
|
||||
|
||||
|
||||
fail:
|
||||
|
||||
|
||||
if (raw && raw != name)
|
||||
grub_free (raw);
|
||||
|
||||
|
@ -357,7 +357,7 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
|||
{
|
||||
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
|
||||
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
|
||||
|
||||
|
||||
if (disk->partition)
|
||||
{
|
||||
grub_disk_addr_t start;
|
||||
|
@ -391,7 +391,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
unsigned real_offset;
|
||||
|
||||
grub_dprintf ("disk", "Reading `%s'...\n", disk->name);
|
||||
|
||||
|
||||
/* First of all, check if the region is within the disk. */
|
||||
if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE)
|
||||
{
|
||||
|
@ -403,7 +403,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
}
|
||||
|
||||
real_offset = offset;
|
||||
|
||||
|
||||
/* Allocate a temporary buffer. */
|
||||
tmp_buf = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
|
||||
if (! tmp_buf)
|
||||
|
@ -454,7 +454,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
goto finish;
|
||||
|
||||
tmp_buf = p;
|
||||
|
||||
|
||||
if ((disk->dev->read) (disk, sector, num, tmp_buf))
|
||||
{
|
||||
grub_error_push ();
|
||||
|
@ -493,33 +493,33 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
grub_disk_addr_t s = sector;
|
||||
grub_size_t l = len;
|
||||
|
||||
|
||||
while (l)
|
||||
{
|
||||
(disk->read_hook) (s, real_offset,
|
||||
((l > GRUB_DISK_SECTOR_SIZE)
|
||||
? GRUB_DISK_SECTOR_SIZE
|
||||
: l));
|
||||
|
||||
|
||||
if (l < GRUB_DISK_SECTOR_SIZE - real_offset)
|
||||
break;
|
||||
|
||||
|
||||
s++;
|
||||
l -= GRUB_DISK_SECTOR_SIZE - real_offset;
|
||||
real_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sector = start_sector + GRUB_DISK_CACHE_SIZE;
|
||||
buf = (char *) buf + len;
|
||||
size -= len;
|
||||
real_offset = 0;
|
||||
}
|
||||
|
||||
|
||||
finish:
|
||||
|
||||
|
||||
grub_free (tmp_buf);
|
||||
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -528,21 +528,21 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
grub_off_t offset, grub_size_t size, const void *buf)
|
||||
{
|
||||
unsigned real_offset;
|
||||
|
||||
|
||||
grub_dprintf ("disk", "Writing `%s'...\n", disk->name);
|
||||
|
||||
if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE)
|
||||
return -1;
|
||||
|
||||
real_offset = offset;
|
||||
|
||||
|
||||
while (size)
|
||||
{
|
||||
if (real_offset != 0 || (size < GRUB_DISK_SECTOR_SIZE && size != 0))
|
||||
{
|
||||
char tmp_buf[GRUB_DISK_SECTOR_SIZE];
|
||||
grub_size_t len;
|
||||
|
||||
|
||||
if (grub_disk_read (disk, sector, 0, GRUB_DISK_SECTOR_SIZE, tmp_buf)
|
||||
!= GRUB_ERR_NONE)
|
||||
goto finish;
|
||||
|
@ -550,7 +550,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
len = GRUB_DISK_SECTOR_SIZE - real_offset;
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
|
||||
grub_memcpy (tmp_buf + real_offset, buf, len);
|
||||
|
||||
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
|
||||
|
@ -570,7 +570,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
|
||||
len = size & ~(GRUB_DISK_SECTOR_SIZE - 1);
|
||||
n = size >> GRUB_DISK_SECTOR_BITS;
|
||||
|
||||
|
||||
if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE)
|
||||
goto finish;
|
||||
|
||||
|
@ -587,7 +587,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_uint64_t
|
||||
grub_uint64_t
|
||||
grub_disk_get_size (grub_disk_t disk)
|
||||
{
|
||||
if (disk->partition)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue