create_inode: whitespace fixes

Fix a ton of whitespace issues.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
crypto
Darrick J. Wong 2014-03-11 23:26:58 -04:00 committed by Theodore Ts'o
parent 8f8d8a575b
commit 9c891f7e6b
1 changed files with 110 additions and 88 deletions

View File

@ -25,7 +25,8 @@
int hdlink_cnt = HDLINK_CNT;
/* Link an inode number to a directory */
static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino, const char *name)
static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino,
const char *name)
{
struct ext2_inode inode;
errcode_t retval;
@ -43,7 +44,8 @@ static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino, const char *nam
com_err(__func__, retval, "while expanding directory");
return retval;
}
retval = ext2fs_link(current_fs, parent_ino, name, ino, inode.i_flags);
retval = ext2fs_link(current_fs, parent_ino, name, ino,
inode.i_flags);
}
if (retval) {
com_err(__func__, retval, "while linking %s", name);
@ -159,7 +161,8 @@ errcode_t do_mknod_internal(ext2_ino_t cwd, const char *name, struct stat *st)
inode.i_block[1] = 0;
} else {
inode.i_block[0] = 0;
inode.i_block[1] = (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12);
inode.i_block[1] = (minor & 0xff) | (major << 8) |
((minor & ~0xff) << 12);
}
inode.i_links_count = 1;
@ -182,7 +185,8 @@ errcode_t do_symlink_internal(ext2_ino_t cwd, const char *name, char *target)
cp = strrchr(name, '/');
if (cp) {
*cp = 0;
retval = ext2fs_namei(current_fs, root, cwd, name, &parent_ino);
retval = ext2fs_namei(current_fs, root, cwd, name,
&parent_ino);
if (retval) {
com_err(name, retval, 0);
return retval;
@ -196,7 +200,8 @@ try_again:
if (retval == EXT2_ET_DIR_NO_SPACE) {
retval = ext2fs_expand_dir(current_fs, parent_ino);
if (retval) {
com_err("do_symlink_internal", retval, "while expanding directory");
com_err("do_symlink_internal", retval,
"while expanding directory");
return retval;
}
goto try_again;
@ -220,7 +225,8 @@ errcode_t do_mkdir_internal(ext2_ino_t cwd, const char *name, struct stat *st)
cp = strrchr(name, '/');
if (cp) {
*cp = 0;
retval = ext2fs_namei(current_fs, root, cwd, name, &parent_ino);
retval = ext2fs_namei(current_fs, root, cwd, name,
&parent_ino);
if (retval) {
com_err(name, retval, 0);
return retval;
@ -245,7 +251,8 @@ try_again:
}
}
static errcode_t copy_file(int fd, ext2_ino_t newfile, int bufsize, int make_holes)
static errcode_t copy_file(int fd, ext2_ino_t newfile, int bufsize,
int make_holes)
{
ext2_file_t e2_file;
errcode_t retval;
@ -291,7 +298,9 @@ static errcode_t copy_file(int fd, ext2_ino_t newfile, int bufsize, int make_hol
cmp = memcmp(ptr, zero_buf, got);
if (cmp == 0) {
/* The whole block is zero, make a hole */
retval = ext2fs_file_lseek(e2_file, got, EXT2_SEEK_CUR, NULL);
retval = ext2fs_file_lseek(e2_file, got,
EXT2_SEEK_CUR,
NULL);
if (retval)
goto fail;
got = 0;
@ -463,7 +472,8 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
if (chdir(source_dir) < 0) {
com_err(__func__, errno,
_("while changing working directory to \"%s\""), source_dir);
_("while changing working directory to \"%s\""),
source_dir);
return errno;
}
@ -474,20 +484,24 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
}
while ((dent = readdir(dh))) {
if ((!strcmp(dent->d_name, ".")) || (!strcmp(dent->d_name, "..")))
if ((!strcmp(dent->d_name, ".")) ||
(!strcmp(dent->d_name, "..")))
continue;
lstat(dent->d_name, &st);
name = dent->d_name;
/* Check for hardlinks */
save_inode = 0;
if (!S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode) && st.st_nlink > 1) {
if (!S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode) &&
st.st_nlink > 1) {
hdlink = is_hardlink(st.st_ino);
if (hdlink >= 0) {
retval = add_link(parent_ino,
hdlinks.hdl[hdlink].dst_ino, name);
hdlinks.hdl[hdlink].dst_ino,
name);
if (retval) {
com_err(__func__, retval, "while linking %s", name);
com_err(__func__, retval,
"while linking %s", name);
return retval;
}
continue;
@ -502,7 +516,8 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
retval = do_mknod_internal(parent_ino, name, &st);
if (retval) {
com_err(__func__, retval,
_("while creating special file \"%s\""), name);
_("while creating special file "
"\"%s\""), name);
return retval;
}
break;
@ -512,17 +527,21 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
_("ignoring socket file \"%s\""), name);
continue;
case S_IFLNK:
read_cnt = readlink(name, ln_target, sizeof(ln_target));
read_cnt = readlink(name, ln_target,
sizeof(ln_target));
if (read_cnt == -1) {
com_err(__func__, errno,
_("while trying to readlink \"%s\""), name);
_("while trying to readlink \"%s\""),
name);
return errno;
}
ln_target[read_cnt] = '\0';
retval = do_symlink_internal(parent_ino, name, ln_target);
retval = do_symlink_internal(parent_ino, name,
ln_target);
if (retval) {
com_err(__func__, retval,
_("while writing symlink\"%s\""), name);
_("while writing symlink\"%s\""),
name);
return retval;
}
break;
@ -541,7 +560,8 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
_("while making dir \"%s\""), name);
return retval;
}
retval = ext2fs_namei(current_fs, root, parent_ino, name, &ino);
retval = ext2fs_namei(current_fs, root, parent_ino,
name, &ino);
if (retval) {
com_err(name, retval, 0);
return retval;
@ -549,7 +569,8 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
/* Populate the dir recursively*/
retval = populate_fs(ino, name);
if (retval) {
com_err(__func__, retval, _("while adding dir \"%s\""), name);
com_err(__func__, retval,
_("while adding dir \"%s\""), name);
return retval;
}
chdir("..");
@ -559,7 +580,8 @@ errcode_t populate_fs(ext2_ino_t parent_ino, const char *source_dir)
_("ignoring entry \"%s\""), name);
}
retval = ext2fs_namei(current_fs, root, parent_ino, name, &ino);
retval = ext2fs_namei(current_fs, root, parent_ino,
name, &ino);
if (retval) {
com_err(name, retval, 0);
return retval;