remove all trailing whitespace
This commit is contained in:
parent
d2d4966571
commit
b39f9d20a9
222 changed files with 3286 additions and 3286 deletions
66
fs/fshelp.c
66
fs/fshelp.c
|
@ -47,7 +47,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
grub_err_t err;
|
||||
enum grub_fshelp_filetype foundtype = GRUB_FSHELP_DIR;
|
||||
int symlinknest = 0;
|
||||
|
||||
|
||||
auto grub_err_t NESTED_FUNC_ATTR find_file (const char *currpath,
|
||||
grub_fshelp_node_t currroot,
|
||||
grub_fshelp_node_t *currfound);
|
||||
|
@ -69,13 +69,13 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
grub_fshelp_node_t node);
|
||||
|
||||
auto void free_node (grub_fshelp_node_t node);
|
||||
|
||||
|
||||
void free_node (grub_fshelp_node_t node)
|
||||
{
|
||||
if (node != rootnode && node != currroot)
|
||||
grub_free (node);
|
||||
}
|
||||
|
||||
|
||||
int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
enum grub_fshelp_filetype filetype,
|
||||
grub_fshelp_node_t node)
|
||||
|
@ -88,31 +88,31 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
grub_free (node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* The node is found, stop iterating over the nodes. */
|
||||
type = filetype & ~GRUB_FSHELP_CASE_INSENSITIVE;
|
||||
oldnode = currnode;
|
||||
currnode = node;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
grub_strncpy (fpath, currpath, grub_strlen (currpath) + 1);
|
||||
|
||||
|
||||
/* Remove all leading slashes. */
|
||||
while (*name == '/')
|
||||
name++;
|
||||
|
||||
|
||||
if (! *name)
|
||||
{
|
||||
*currfound = currnode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int found;
|
||||
|
||||
|
||||
/* Extract the actual part from the pathname. */
|
||||
next = grub_strchr (name, '/');
|
||||
if (next)
|
||||
|
@ -121,7 +121,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
while (*next == '/')
|
||||
*(next++) = '\0';
|
||||
}
|
||||
|
||||
|
||||
/* At this point it is expected that the current node is a
|
||||
directory, check if this is true. */
|
||||
if (type != GRUB_FSHELP_DIR)
|
||||
|
@ -129,22 +129,22 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
free_node (currnode);
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
}
|
||||
|
||||
|
||||
/* Iterate over the directory. */
|
||||
found = iterate_dir (currnode, iterate);
|
||||
if (! found)
|
||||
{
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Read in the symlink and follow it. */
|
||||
if (type == GRUB_FSHELP_SYMLINK)
|
||||
{
|
||||
char *symlink;
|
||||
|
||||
|
||||
/* Test if the symlink does not loop. */
|
||||
if (++symlinknest == 8)
|
||||
{
|
||||
|
@ -153,37 +153,37 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
return grub_error (GRUB_ERR_SYMLINK_LOOP,
|
||||
"too deep nesting of symlinks");
|
||||
}
|
||||
|
||||
|
||||
symlink = read_symlink (currnode);
|
||||
free_node (currnode);
|
||||
|
||||
|
||||
if (!symlink)
|
||||
{
|
||||
free_node (oldnode);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
/* The symlink is an absolute path, go back to the root inode. */
|
||||
if (symlink[0] == '/')
|
||||
{
|
||||
free_node (oldnode);
|
||||
oldnode = rootnode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Lookup the node the symlink points to. */
|
||||
find_file (symlink, oldnode, &currnode);
|
||||
type = foundtype;
|
||||
grub_free (symlink);
|
||||
|
||||
|
||||
if (grub_errno)
|
||||
{
|
||||
free_node (oldnode);
|
||||
return grub_errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
free_node (oldnode);
|
||||
|
||||
|
||||
/* Found the node! */
|
||||
if (! next || *next == '\0')
|
||||
{
|
||||
|
@ -191,10 +191,10 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
foundtype = type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
name = next;
|
||||
}
|
||||
|
||||
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||
}
|
||||
|
||||
|
@ -203,17 +203,17 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
err = find_file (path, rootnode, foundnode);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
/* Check if the node that was found was of the expected type. */
|
||||
if (expecttype == GRUB_FSHELP_REG && foundtype != expecttype)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file");
|
||||
else if (expecttype == GRUB_FSHELP_DIR && foundtype != expecttype)
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -252,14 +252,14 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
|
|||
blknr = get_block (node, i);
|
||||
if (grub_errno)
|
||||
return -1;
|
||||
|
||||
|
||||
blknr = blknr << log2blocksize;
|
||||
|
||||
/* Last block. */
|
||||
if (i == blockcnt - 1)
|
||||
{
|
||||
blockend = (len + pos) & (blocksize - 1);
|
||||
|
||||
|
||||
/* The last portion is exactly blocksize. */
|
||||
if (! blockend)
|
||||
blockend = blocksize;
|
||||
|
@ -271,12 +271,12 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
|
|||
skipfirst = blockoff;
|
||||
blockend -= skipfirst;
|
||||
}
|
||||
|
||||
|
||||
/* If the block number is 0 this block is not stored on disk but
|
||||
is zero filled instead. */
|
||||
if (blknr)
|
||||
{
|
||||
disk->read_hook = read_hook;
|
||||
disk->read_hook = read_hook;
|
||||
|
||||
grub_disk_read (disk, blknr, skipfirst,
|
||||
blockend, buf);
|
||||
|
@ -297,7 +297,7 @@ unsigned int
|
|||
grub_fshelp_log2blksize (unsigned int blksize, unsigned int *pow)
|
||||
{
|
||||
int mod;
|
||||
|
||||
|
||||
*pow = 0;
|
||||
while (blksize > 1)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue