Reduce diffs with code in Perforce:

Parenthesise return values.
This commit is contained in:
jmallett 2003-06-09 09:32:29 +00:00
parent 8b207107b5
commit e56450ad34
5 changed files with 34 additions and 34 deletions

View File

@ -71,9 +71,9 @@ bread(struct uufsd *disk, ufs2_daddr_t blockno, void *data, size_t size)
ERROR(disk, "short read or read error from block device");
goto fail;
}
return cnt;
return (cnt);
fail: memset(buf, 0, size);
return -1;
return (-1);
}
ssize_t
@ -87,18 +87,18 @@ bwrite(struct uufsd *disk, ufs2_daddr_t blockno, const void *data, size_t size)
rv = ufs_disk_write(disk);
if (rv == -1) {
ERROR(disk, "failed to open disk for writing");
return -1;
return (-1);
}
cnt = pwrite(disk->d_fd, data, size, (off_t)(blockno * disk->d_bsize));
if (cnt == -1) {
ERROR(disk, "write error to block device");
return -1;
return (-1);
}
if ((size_t)cnt != size) {
ERROR(disk, "short write to block device");
return -1;
return (-1);
}
return cnt;
return (cnt);
}

View File

@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
int
cgread(struct uufsd *disk)
{
return cgread1(disk, disk->d_ccg++);
return (cgread1(disk, disk->d_ccg++));
}
int
@ -60,14 +60,14 @@ cgread1(struct uufsd *disk, int c)
fs = &disk->d_fs;
if (c >= fs->fs_ncg) {
return 0;
return (0);
}
ccg = fsbtodb(fs, cgtod(fs, c)) * disk->d_bsize;
if (bread(disk, fsbtodb(fs, cgtod(fs, c)), disk->d_cgunion.d_buf,
fs->fs_bsize) == -1) {
ERROR(disk, "unable to read cylinder group");
return -1;
return (-1);
}
disk->d_lcg = c;
return 1;
return (1);
}

View File

@ -66,7 +66,7 @@ getino(struct uufsd *disk, void **dino, ino_t inode, int *mode)
inoblock = malloc(fs->fs_bsize);
if (inoblock == NULL) {
ERROR(disk, "unable to allocate inode block");
return -1;
return (-1);
}
disk->d_inoblock = inoblock;
}
@ -81,15 +81,15 @@ gotit: switch (disk->d_ufs) {
dp1 = &((struct ufs1_dinode *)inoblock)[inode - min];
*mode = dp1->di_mode & IFMT;
*dino = dp1;
return 0;
return (0);
case 2:
dp2 = &((struct ufs2_dinode *)inoblock)[inode - min];
*mode = dp2->di_mode & IFMT;
*dino = dp2;
return 0;
return (0);
default:
break;
}
ERROR(disk, "unknown UFS filesystem type");
return -1;
return (-1);
}

View File

@ -60,7 +60,7 @@ sbread(struct uufsd *disk)
for (sb = 0; (superblock = superblocks[sb]) != -1; sb++) {
if (bread(disk, superblock, disk->d_sb, SBLOCKSIZE) == -1) {
ERROR(disk, "non-existent or truncated superblock");
return -1;
return (-1);
}
if (fs->fs_magic == FS_UFS1_MAGIC)
disk->d_ufs = 1;
@ -82,11 +82,11 @@ sbread(struct uufsd *disk)
*/
ERROR(disk, "no usable known superblock found");
errno = ENOENT;
return -1;
return (-1);
}
disk->d_bsize = fs->fs_fsize / fsbtodb(fs, 1);
disk->d_sblock = superblock / disk->d_bsize;
return 0;
return (0);
}
int
@ -105,15 +105,15 @@ sbwrite(struct uufsd *disk, int all)
if (bwrite(disk, disk->d_sblock, fs, SBLOCKSIZE) == -1) {
ERROR(disk, "failed to write superblock");
return -1;
return (-1);
}
if (all) {
for (i = 0; i < fs->fs_ncg; i++)
if (bwrite(disk, fsbtodb(fs, cgsblock(fs, i)),
fs, SBLOCKSIZE) == -1) {
ERROR(disk, "failed to update a superblock");
return -1;
return (-1);
}
}
return 0;
return (0);
}

View File

@ -65,16 +65,16 @@ ufs_disk_ctor(const char *name)
new = malloc(sizeof(*new));
if (new == NULL) {
ERROR(new, "unable to allocate memory for disk");
return NULL;
return (NULL);
}
if (ufs_disk_fillout(new, name) == -1) {
ERROR(new, "could not fill out disk");
free(new);
return NULL;
return (NULL);
}
return new;
return (new);
}
void
@ -107,20 +107,20 @@ ufs_disk_close(struct uufsd *disk)
free((char *)(uintptr_t)disk->d_name);
disk->d_name = NULL;
}
return 0;
return (0);
}
int
ufs_disk_fillout(struct uufsd *disk, const char *name)
{
if (ufs_disk_fillout_blank(disk, name) == -1) {
return -1;
return (-1);
}
if (sbread(disk) == -1) {
ERROR(disk, "could not read superblock to fill out disk");
return -1;
return (-1);
}
return 0;
return (0);
}
int
@ -147,12 +147,12 @@ again: if (stat(name, &st) < 0) {
goto again;
}
ERROR(disk, "could not find special device");
return -1;
return (-1);
}
fd = open(name, O_RDONLY);
if (fd == -1) {
ERROR(disk, "could not open special device");
return -1;
return (-1);
}
disk->d_bsize = 1;
@ -170,13 +170,13 @@ again: if (stat(name, &st) < 0) {
name = strdup(name);
if (name == NULL) {
ERROR(disk, "could not allocate memory for disk name");
return -1;
return (-1);
}
disk->d_mine |= MINE_NAME;
}
disk->d_name = name;
return 0;
return (0);
}
int
@ -185,17 +185,17 @@ ufs_disk_write(struct uufsd *disk)
ERROR(disk, NULL);
if (disk->d_mine & MINE_WRITE)
return 0;
return (0);
close(disk->d_fd);
disk->d_fd = open(disk->d_name, O_RDWR);
if (disk->d_fd < 0) {
ERROR(disk, "failed to open disk for writing");
return -1;
return (-1);
}
disk->d_mine |= MINE_WRITE;
return 0;
return (0);
}