Page MenuHomeFreeBSD

D10777.id.diff
No OneTemporary

D10777.id.diff

Index: sbin/tunefs/tunefs.c
===================================================================
--- sbin/tunefs/tunefs.c
+++ sbin/tunefs/tunefs.c
@@ -691,7 +691,7 @@
dp2 = ip;
dp1 = ip;
if (sblock.fs_magic == FS_UFS1_MAGIC) {
- if ((off_t)dp1->di_size >= lblktosize(&sblock, UFS_NDADDR)) {
+ if (dp1->di_size >= lblktosize(&sblock, UFS_NDADDR)) {
warnx("UFS_ROOTINO extends beyond direct blocks.");
return (-1);
}
@@ -703,7 +703,7 @@
return (ino);
}
} else {
- if ((off_t)dp2->di_size >= lblktosize(&sblock, UFS_NDADDR)) {
+ if (dp2->di_size >= lblktosize(&sblock, UFS_NDADDR)) {
warnx("UFS_ROOTINO extends beyond direct blocks.");
return (-1);
}
Index: sys/ufs/ffs/fs.h
===================================================================
--- sys/ufs/ffs/fs.h
+++ sys/ufs/ffs/fs.h
@@ -574,7 +574,7 @@
#define lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \
(((off_t)(frag)) << (fs)->fs_fshift)
#define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \
- (((off_t)(blk)) << (fs)->fs_bshift)
+ (((uint64_t)(blk)) << (fs)->fs_bshift)
/* Use this only when `blk' is known to be small, e.g., < UFS_NDADDR. */
#define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
((blk) << (fs)->fs_bshift)
Index: usr.sbin/makefs/Makefile
===================================================================
--- usr.sbin/makefs/Makefile
+++ usr.sbin/makefs/Makefile
@@ -14,7 +14,7 @@
walk.c
MAN= makefs.8
-WARNS?= 2
+WARNS?= 6
.include "${SRCDIR}/cd9660/Makefile.inc"
.include "${SRCDIR}/ffs/Makefile.inc"
Index: usr.sbin/makefs/cd9660.h
===================================================================
--- usr.sbin/makefs/cd9660.h
+++ usr.sbin/makefs/cd9660.h
@@ -314,8 +314,8 @@
void cd9660_731(uint32_t, unsigned char *);
void cd9660_722(uint16_t, unsigned char *);
void cd9660_732(uint32_t, unsigned char *);
-void cd9660_bothendian_dword(uint32_t dw, unsigned char *);
-void cd9660_bothendian_word(uint16_t dw, unsigned char *);
+void cd9660_bothendian_dword(uint32_t dw, unsigned char *);
+void cd9660_bothendian_word(uint16_t dw, unsigned char *);
void cd9660_set_date(char *, time_t);
void cd9660_time_8426(unsigned char *, time_t);
void cd9660_time_915(unsigned char *, time_t);
Index: usr.sbin/makefs/cd9660.c
===================================================================
--- usr.sbin/makefs/cd9660.c
+++ usr.sbin/makefs/cd9660.c
@@ -882,7 +882,7 @@
* @param const char * The first file name
* @param const char * The second file name
* @returns : -1 if first is less than second, 0 if they are the same, 1 if
- * the second is greater than the first
+ * the second is greater than the first
*/
static int
cd9660_compare_filename(const char *first, const char *second)
@@ -1015,7 +1015,7 @@
for (iter = TAILQ_FIRST(&colliding->cn_children);
iter != NULL && (next = TAILQ_NEXT(iter, cn_next_child)) != NULL;) {
if (strcmp(iter->isoDirRecord->name,
- next->isoDirRecord->name) != 0) {
+ next->isoDirRecord->name) != 0) {
iter = TAILQ_NEXT(iter, cn_next_child);
continue;
}
@@ -1052,7 +1052,7 @@
int numbts, digit, digits, temp, powers, count;
char *naming;
int maxlength;
- char *tmp;
+ char *tmp;
if (diskStructure->verbose_level > 0)
printf("Rename_filename called\n");
@@ -1199,7 +1199,7 @@
if ((next = TAILQ_NEXT(cn, cn_next_child)) == NULL)
return;
else if (strcmp(next->isoDirRecord->name,
- cn->isoDirRecord->name) >= 0)
+ cn->isoDirRecord->name) >= 0)
continue;
TAILQ_REMOVE(&node->cn_children, next, cn_next_child);
TAILQ_INSERT_BEFORE(cn, next, cn_next_child);
@@ -1701,7 +1701,7 @@
*newname++ = *oldname;
else if (diskStructure->allow_multidot &&
*oldname == '.') {
- *newname++ = '.';
+ *newname++ = '.';
} else {
*newname++ = '_';
}
@@ -1848,7 +1848,7 @@
cd9660_compute_record_size(diskStructure, child);
if ((cd9660_compute_record_size(diskStructure, child) +
current_sector_usage) >=
- diskStructure->sectorSize) {
+ diskStructure->sectorSize) {
current_sector_usage = 0;
node->fileSectorsUsed++;
}
@@ -2078,8 +2078,8 @@
} else if (type == CD9660_TYPE_DOTDOT) {
parent->dot_dot_record = temp;
/*
- * If the first child is the dot record, insert
- * this second. Otherwise, insert it at the head.
+ * If the first child is the dot record, insert
+ * this second. Otherwise, insert it at the head.
*/
if ((first = TAILQ_FIRST(&parent->cn_children)) == NULL ||
(first->type & CD9660_TYPE_DOT) == 0) {
Index: usr.sbin/makefs/cd9660/cd9660_archimedes.h
===================================================================
--- usr.sbin/makefs/cd9660/cd9660_archimedes.h
+++ usr.sbin/makefs/cd9660/cd9660_archimedes.h
@@ -14,7 +14,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Index: usr.sbin/makefs/cd9660/cd9660_archimedes.c
===================================================================
--- usr.sbin/makefs/cd9660/cd9660_archimedes.c
+++ usr.sbin/makefs/cd9660/cd9660_archimedes.c
@@ -14,7 +14,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Index: usr.sbin/makefs/cd9660/cd9660_eltorito.h
===================================================================
--- usr.sbin/makefs/cd9660/cd9660_eltorito.h
+++ usr.sbin/makefs/cd9660/cd9660_eltorito.h
@@ -128,7 +128,7 @@
char entry_type;
union {
boot_catalog_validation_entry VE;
- boot_catalog_initial_entry IE;
+ boot_catalog_initial_entry IE;
boot_catalog_section_header SH;
boot_catalog_section_entry SE;
boot_catalog_section_entry_extension EX;
@@ -141,7 +141,7 @@
struct cd9660_boot_image {
char *filename;
int size;
- int sector; /* copied to LoadRBA */
+ int sector; /* copied to LoadRBA */
int num_sectors;
unsigned int loadSegment;
u_char targetMode;
Index: usr.sbin/makefs/cd9660/cd9660_eltorito.c
===================================================================
--- usr.sbin/makefs/cd9660/cd9660_eltorito.c
+++ usr.sbin/makefs/cd9660/cd9660_eltorito.c
@@ -100,7 +100,7 @@
else if (strcmp(sysname, "powerpc") == 0)
new_image->system = ET_SYS_PPC;
else if (strcmp(sysname, "macppc") == 0 ||
- strcmp(sysname, "mac68k") == 0)
+ strcmp(sysname, "mac68k") == 0)
new_image->system = ET_SYS_MAC;
else {
warnx("boot disk system must be "
@@ -245,7 +245,7 @@
checksum = -checksum;
cd9660_721(checksum, ve->checksum);
- ELTORITO_DPRINTF(("%s: header_id %d, platform_id %d, key[0] %d, key[1] %d, "
+ ELTORITO_DPRINTF(("%s: header_id %d, platform_id %d, key[0] %d, key[1] %d, "
"checksum %04x\n", __func__, ve->header_id[0], ve->platform_id[0],
ve->key[0], ve->key[1], checksum));
return entry;
@@ -487,7 +487,7 @@
if (fseeko(fd, (off_t)(idx) * 16 + 0x1be, SEEK_SET) == -1)
err(1, "fseeko");
-
+
val = 0x80; /* Bootable */
fwrite(&val, sizeof(val), 1, fd);
@@ -556,13 +556,13 @@
apm32 = 0;
/* pmLgDataStart */
- fwrite(&apm32, sizeof(apm32), 1, fd);
- /* pmDataCnt */
+ fwrite(&apm32, sizeof(apm32), 1, fd);
+ /* pmDataCnt */
apm32 = htobe32(nsectors);
- fwrite(&apm32, sizeof(apm32), 1, fd);
+ fwrite(&apm32, sizeof(apm32), 1, fd);
/* pmPartStatus */
apm32 = htobe32(part_status);
- fwrite(&apm32, sizeof(apm32), 1, fd);
+ fwrite(&apm32, sizeof(apm32), 1, fd);
return 0;
}
@@ -606,9 +606,9 @@
}
cd9660_copy_file(diskStructure, fd, t->sector, t->filename);
- if (t->system == ET_SYS_MAC)
+ if (t->system == ET_SYS_MAC)
apm_partitions++;
- if (t->system == ET_SYS_PPC)
+ if (t->system == ET_SYS_PPC)
mbr_partitions++;
}
@@ -680,7 +680,7 @@
512, "CD Boot", "Apple_Bootstrap");
}
/* Write ISO9660 descriptor, enclosing the whole disk */
- cd9660_write_apm_partition_entry(fd, 2 + apm_partitions,
+ cd9660_write_apm_partition_entry(fd, 2 + apm_partitions,
total_parts, 0, diskStructure->totalSectors *
(diskStructure->sectorSize / 512), 512, "ISO9660",
"CD_ROM_Mode_1");
Index: usr.sbin/makefs/cd9660/cd9660_write.c
===================================================================
--- usr.sbin/makefs/cd9660/cd9660_write.c
+++ usr.sbin/makefs/cd9660/cd9660_write.c
@@ -188,7 +188,7 @@
/* round up */
len = temp_entry.length[0] + 8 + (temp_entry.length[0] & 0x01);
- /* todo: function pointers instead */
+ /* todo: function pointers instead */
if (mode == LITTLE_ENDIAN) {
cd9660_731(ptcur->fileDataSector,
temp_entry.first_sector);
@@ -314,7 +314,7 @@
/*
* Now loop over children, writing out their directory
* records - beware of sector boundaries
- */
+ */
TAILQ_FOREACH(temp, &writenode->cn_children, cn_next_child) {
/*
* Copy the temporary record and adjust its size
Index: usr.sbin/makefs/cd9660/iso9660_rrip.h
===================================================================
--- usr.sbin/makefs/cd9660/iso9660_rrip.h
+++ usr.sbin/makefs/cd9660/iso9660_rrip.h
@@ -207,7 +207,7 @@
char type_of[2];
char last_in_suf; /* last entry in the System Use Field? */
/* Dan's addons - will merge later. This allows use of a switch */
- char susp_type; /* SUSP or RRIP */
+ char susp_type; /* SUSP or RRIP */
char entry_type; /* Record type */
char write_location;
TAILQ_ENTRY(ISO_SUSP_ATTRIBUTES) rr_ll;
Index: usr.sbin/makefs/cd9660/iso9660_rrip.c
===================================================================
--- usr.sbin/makefs/cd9660/iso9660_rrip.c
+++ usr.sbin/makefs/cd9660/iso9660_rrip.c
@@ -674,7 +674,7 @@
cd9660node_rrip_nm(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *file_node)
{
int nm_length = strlen(file_node->isoDirRecord->name) + 5;
- p->attr.rr_entry.NM.h.type[0] = 'N';
+ p->attr.rr_entry.NM.h.type[0] = 'N';
p->attr.rr_entry.NM.h.type[1] = 'M';
sprintf(p->attr.rr_entry.NM.altname, "%s", file_node->isoDirRecord->name);
p->attr.rr_entry.NM.h.length[0] = (unsigned char)nm_length;
Index: usr.sbin/makefs/ffs.c
===================================================================
--- usr.sbin/makefs/ffs.c
+++ usr.sbin/makefs/ffs.c
@@ -143,7 +143,6 @@
fsnode *, fsinfo_t *);
-int sectorsize; /* XXX: for buf.c::getblk() */
/* publicly visible functions */
void
@@ -391,11 +390,11 @@
/* add space needed to store inodes, x3 for blockmaps, etc */
if (ffs_opts->version == 1)
fsopts->size += ncg * DINODE1_SIZE *
- roundup(fsopts->inodes / ncg,
+ roundup(fsopts->inodes / ncg,
ffs_opts->bsize / DINODE1_SIZE);
else
fsopts->size += ncg * DINODE2_SIZE *
- roundup(fsopts->inodes / ncg,
+ roundup(fsopts->inodes / ncg,
ffs_opts->bsize / DINODE2_SIZE);
/* add minfree */
@@ -426,8 +425,6 @@
printf("ffs_validate: dir %s; %lld bytes, %lld inodes\n",
dir, (long long)fsopts->size, (long long)fsopts->inodes);
}
- sectorsize = fsopts->sectorsize; /* XXX - see earlier */
-
/* now check calculated sizes vs requested sizes */
if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) {
errx(1, "`%s' size of %lld is larger than the maxsize of %lld.",
@@ -868,13 +865,14 @@
static void
ffs_write_file(union dinode *din, uint32_t ino, void *buf, fsinfo_t *fsopts)
{
- int isfile, ffd;
+ int isfile, ffd;
char *fbuf, *p;
off_t bufleft, chunk, offset;
ssize_t nread;
struct inode in;
struct buf * bp;
ffs_opt_t *ffs_opts = fsopts->fs_specific;
+ struct vnode vp = { fsopts, NULL };
assert (din != NULL);
assert (buf != NULL);
@@ -887,6 +885,7 @@
p = NULL;
in.i_fs = (struct fs *)fsopts->superblock;
+ in.i_vnode = &vp;
if (debug & DEBUG_FS_WRITE_FILE) {
printf(
@@ -907,7 +906,6 @@
else
memcpy(&in.i_din.ffs2_din, &din->ffs2_din,
sizeof(in.i_din.ffs2_din));
- in.i_fd = fsopts->fd;
if (DIP(din, size) == 0)
goto write_inode_and_leave; /* mmm, cheating */
@@ -967,7 +965,7 @@
if (!isfile)
p += chunk;
}
-
+
write_inode_and_leave:
ffs_write_inode(&in.i_din, in.i_number, fsopts);
@@ -992,7 +990,7 @@
dir, dbuf->size, dbuf->cur);
for (i = 0; i < dbuf->size; ) {
- de = (struct direct *)(dbuf->buf + i);
+ de = (struct direct *)(void *)(dbuf->buf + i);
reclen = ufs_rw16(de->d_reclen, needswap);
printf(
" inode %4d %7s offset %4d reclen %3d namlen %3d name %s\n",
@@ -1023,7 +1021,7 @@
reclen = DIRSIZ_SWAP(0, &de, needswap);
de.d_reclen = ufs_rw16(reclen, needswap);
- dp = (struct direct *)(dbuf->buf + dbuf->cur);
+ dp = (struct direct *)(void *)(dbuf->buf + dbuf->cur);
llen = 0;
if (dp != NULL)
llen = DIRSIZ_SWAP(0, dp, needswap);
@@ -1049,7 +1047,7 @@
dp->d_reclen = ufs_rw16(llen,needswap);
dbuf->cur += llen;
}
- dp = (struct direct *)(dbuf->buf + dbuf->cur);
+ dp = (struct direct *)(void *)(dbuf->buf + dbuf->cur);
memcpy(dp, &de, reclen);
dp->d_reclen = ufs_rw16(dbuf->size - dbuf->cur, needswap);
}
@@ -1060,7 +1058,7 @@
static void
ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
{
- char *buf;
+ char *buf;
struct ufs1_dinode *dp1;
struct ufs2_dinode *dp2, *dip;
struct cg *cgp;
@@ -1068,7 +1066,7 @@
int cg, cgino, i;
daddr_t d;
char sbbuf[FFS_MAXBSIZE];
- int32_t initediblk;
+ uint32_t initediblk;
ffs_opt_t *ffs_opts = fsopts->fs_specific;
assert (dp != NULL);
@@ -1085,15 +1083,15 @@
ffs_rdfs(fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, &sbbuf,
fsopts);
- cgp = (struct cg *)sbbuf;
+ cgp = (struct cg *)(void *)sbbuf;
if (!cg_chkmagic_swap(cgp, fsopts->needswap))
errx(1, "ffs_write_inode: cg %d: bad magic number", cg);
assert (isclr(cg_inosused_swap(cgp, fsopts->needswap), cgino));
buf = emalloc(fs->fs_bsize);
- dp1 = (struct ufs1_dinode *)buf;
- dp2 = (struct ufs2_dinode *)buf;
+ dp1 = (struct ufs1_dinode *)(void *)buf;
+ dp2 = (struct ufs2_dinode *)(void *)buf;
if (fs->fs_cstotal.cs_nifree == 0)
errx(1, "ffs_write_inode: fs out of inodes for ino %u",
@@ -1109,18 +1107,20 @@
if (S_ISDIR(DIP(dp, mode))) {
ufs_add32(cgp->cg_cs.cs_ndir, 1, fsopts->needswap);
fs->fs_cstotal.cs_ndir++;
- fs->fs_cs(fs, cg).cs_ndir++;
+ fs->fs_cs(fs, cg).cs_ndir++;
}
/*
* Initialize inode blocks on the fly for UFS2.
*/
initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap);
- if (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk &&
+ if (ffs_opts->version == 2 &&
+ (uint32_t)(cgino + INOPB(fs)) > initediblk &&
initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) {
memset(buf, 0, fs->fs_bsize);
- dip = (struct ufs2_dinode *)buf;
- for (i = 0; i < INOPB(fs); i++) {
+ dip = (struct ufs2_dinode *)(void *)buf;
+ /* XXX check (int) */
+ for (i = 0; i < (int)INOPB(fs); i++) {
dip->di_gen = random();
dip++;
}
Index: usr.sbin/makefs/ffs/buf.h
===================================================================
--- usr.sbin/makefs/ffs/buf.h
+++ usr.sbin/makefs/ffs/buf.h
@@ -43,25 +43,23 @@
#include <sys/param.h>
#include <sys/queue.h>
+struct makefs_fsinfo;
struct ucred;
struct vnode {
- int fd;
- void *fs;
+ struct makefs_fsinfo *v_fsinfo;
void *v_data;
- int offset;
};
struct buf {
- void * b_data;
- long b_bufsize;
- long b_bcount;
- daddr_t b_blkno;
- daddr_t b_lblkno;
- int b_fd;
- void * b_fs;
+ void *b_data;
+ long b_bufsize;
+ long b_bcount;
+ daddr_t b_blkno;
+ daddr_t b_lblkno;
+ struct makefs_fsinfo *b_fsinfo;
- TAILQ_ENTRY(buf) b_tailq;
+ TAILQ_ENTRY(buf) b_tailq;
};
void bcleanup(void);
Index: usr.sbin/makefs/ffs/buf.c
===================================================================
--- usr.sbin/makefs/ffs/buf.c
+++ usr.sbin/makefs/ffs/buf.c
@@ -52,8 +52,6 @@
#include "makefs.h"
#include "buf.h"
-extern int sectorsize; /* XXX: from ffs.c & mkfs.c */
-
static TAILQ_HEAD(buftailhead,buf) buftail;
int
@@ -62,6 +60,7 @@
{
off_t offset;
ssize_t rv;
+ fsinfo_t *fsinfo = vp->v_fsinfo;
assert (bpp != NULL);
@@ -69,15 +68,15 @@
printf("%s: blkno %lld size %d\n", __func__, (long long)blkno,
size);
*bpp = getblk(vp, blkno, size, 0, 0, 0);
- offset = (*bpp)->b_blkno * sectorsize; /* XXX */
+ offset = (*bpp)->b_blkno * fsinfo->sectorsize;
if (debug & DEBUG_BUF_BREAD)
printf("%s: blkno %lld offset %lld bcount %ld\n", __func__,
(long long)(*bpp)->b_blkno, (long long) offset,
(*bpp)->b_bcount);
- if (lseek((*bpp)->b_fd, offset, SEEK_SET) == -1)
+ if (lseek((*bpp)->b_fsinfo->fd, offset, SEEK_SET) == -1)
err(1, "%s: lseek %lld (%lld)", __func__,
(long long)(*bpp)->b_blkno, (long long)offset);
- rv = read((*bpp)->b_fd, (*bpp)->b_data, (*bpp)->b_bcount);
+ rv = read((*bpp)->b_fsinfo->fd, (*bpp)->b_data, (*bpp)->b_bcount);
if (debug & DEBUG_BUF_BREAD)
printf("%s: read %ld (%lld) returned %d\n", __func__,
(*bpp)->b_bcount, (long long)offset, (int)rv);
@@ -126,16 +125,17 @@
{
off_t offset;
ssize_t rv;
+ fsinfo_t *fs = bp->b_fsinfo;
assert (bp != NULL);
- offset = bp->b_blkno * sectorsize; /* XXX */
+ offset = bp->b_blkno * fs->sectorsize;
if (debug & DEBUG_BUF_BWRITE)
printf("bwrite: blkno %lld offset %lld bcount %ld\n",
(long long)bp->b_blkno, (long long) offset,
bp->b_bcount);
- if (lseek(bp->b_fd, offset, SEEK_SET) == -1)
+ if (lseek(bp->b_fsinfo->fd, offset, SEEK_SET) == -1)
return (errno);
- rv = write(bp->b_fd, bp->b_data, bp->b_bcount);
+ rv = write(bp->b_fsinfo->fd, bp->b_data, bp->b_bcount);
if (debug & DEBUG_BUF_BWRITE)
printf("bwrite: write %ld (offset %lld) returned %lld\n",
bp->b_bcount, (long long)offset, (long long)rv);
@@ -178,8 +178,6 @@
struct buf *bp;
void *n;
- //blkno += vp->offset;
- assert (fs != NULL);
if (debug & DEBUG_BUF_GETBLK)
printf("getblk: blkno %lld size %d\n", (long long)blkno, size);
@@ -200,8 +198,7 @@
bp = ecalloc(1, sizeof(*bp));
bp->b_bufsize = 0;
bp->b_blkno = bp->b_lblkno = blkno;
- bp->b_fd = vp->fd;
- bp->b_fs = vp->fs;
+ bp->b_fsinfo = vp->v_fsinfo;
bp->b_data = NULL;
TAILQ_INSERT_HEAD(&buftail, bp, b_tailq);
}
Index: usr.sbin/makefs/ffs/ffs_alloc.c
===================================================================
--- usr.sbin/makefs/ffs/ffs_alloc.c
+++ usr.sbin/makefs/ffs/ffs_alloc.c
@@ -64,13 +64,13 @@
static daddr_t ffs_alloccg(struct inode *, int, daddr_t, int);
static daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t);
-static daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int,
+static daddr_t ffs_hashalloc(struct inode *, uint32_t, daddr_t, int,
daddr_t (*)(struct inode *, int, daddr_t, int));
static int32_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int);
/*
* Allocate a block in the file system.
- *
+ *
* The size of the requested block is given, which must be some
* multiple of fs_fsize and <= fs_bsize.
* A preference may be optionally specified. If a preference is given
@@ -94,7 +94,7 @@
struct fs *fs = ip->i_fs;
daddr_t bno;
int cg;
-
+
*bnp = 0;
if (size > fs->fs_bsize || fragoff(fs, size) != 0) {
errx(1, "ffs_alloc: bad size: bsize %d size %d",
@@ -125,7 +125,7 @@
* Select the desired position for the next block in a file. The file is
* logically divided into sections. The first section is composed of the
* direct blocks. Each additional section contains fs_maxbpg blocks.
- *
+ *
* If no blocks have been allocated in the first section, the policy is to
* request a block in the same cylinder group as the inode that describes
* the file. If no blocks have been allocated in any other section, the
@@ -139,7 +139,7 @@
* indirect block, the information on the previous allocation is unavailable;
* here a best guess is made based upon the logical block number being
* allocated.
- *
+ *
* If a section is already partially allocated, the policy is to
* contiguously allocate fs_maxcontig blocks. The end of one of these
* contiguous blocks and the beginning of the next is physically separated
@@ -152,8 +152,8 @@
ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap)
{
struct fs *fs;
- int cg;
- int avgbfree, startcg;
+ uint32_t cg, startcg;
+ int avgbfree;
fs = ip->i_fs;
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
@@ -191,8 +191,8 @@
ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap)
{
struct fs *fs;
- int cg;
- int avgbfree, startcg;
+ uint32_t cg, startcg;
+ int avgbfree;
fs = ip->i_fs;
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
@@ -240,12 +240,13 @@
*/
/*VARARGS5*/
static daddr_t
-ffs_hashalloc(struct inode *ip, int cg, daddr_t pref, int size,
+ffs_hashalloc(struct inode *ip, uint32_t cg, daddr_t pref, int size,
daddr_t (*allocator)(struct inode *, int, daddr_t, int))
{
struct fs *fs;
daddr_t result;
- int i, icg = cg;
+ uint32_t i;
+ int icg = cg;
fs = ip->i_fs;
/*
@@ -297,11 +298,10 @@
int error, frags, allocsiz, i;
struct fs *fs = ip->i_fs;
const int needswap = UFS_FSNEEDSWAP(fs);
- struct vnode vp = { ip->i_fd, ip->i_fs, NULL, 0 };
if (fs->fs_cs(fs, cg).cs_nbfree == 0 && size == fs->fs_bsize)
return (0);
- error = bread(&vp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
+ error = bread(ip->i_vnode, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
NULL, &bp);
if (error) {
brelse(bp, 0);
@@ -329,7 +329,7 @@
break;
if (allocsiz == fs->fs_frag) {
/*
- * no fragments were available, so a block will be
+ * no fragments were available, so a block will be
* allocated, and hacked up
*/
if (cgp->cg_cs.cs_nbfree == 0) {
@@ -421,7 +421,7 @@
* Free a block or fragment.
*
* The specified block or fragment is placed back in the
- * free map. If a fragment is deallocated, a possible
+ * free map. If a fragment is deallocated, a possible
* block reassembly is checked.
*/
void
@@ -433,7 +433,6 @@
int i, error, cg, blk, frags, bbase;
struct fs *fs = ip->i_fs;
const int needswap = UFS_FSNEEDSWAP(fs);
- struct vnode vp = { ip->i_fd, ip->i_fs, NULL, 0 };
if (size > fs->fs_bsize || fragoff(fs, size) != 0 ||
fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) {
@@ -446,7 +445,7 @@
(uintmax_t)ip->i_number);
return;
}
- error = bread(&vp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
+ error = bread(ip->i_vnode, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
NULL, &bp);
if (error) {
brelse(bp, 0);
Index: usr.sbin/makefs/ffs/ffs_balloc.c
===================================================================
--- usr.sbin/makefs/ffs/ffs_balloc.c
+++ usr.sbin/makefs/ffs/ffs_balloc.c
@@ -79,7 +79,7 @@
{
daddr_t lbn, lastlbn;
int size;
- int32_t nb;
+ uint32_t nb;
struct buf *bp, *nbp;
struct fs *fs = ip->i_fs;
struct indir indirs[UFS_NIADDR + 2];
@@ -89,7 +89,6 @@
int32_t *allocblk, allociblk[UFS_NIADDR + 1];
int32_t *allocib;
const int needswap = UFS_FSNEEDSWAP(fs);
- struct vnode vp = { ip->i_fd, ip->i_fs, NULL, 0 };
lbn = lblkno(fs, offset);
size = blkoff(fs, offset) + bufsize;
@@ -133,7 +132,7 @@
*/
if (bpp != NULL) {
- error = bread(&vp, lbn, fs->fs_bsize, NULL,
+ error = bread(ip->i_vnode, lbn, fs->fs_bsize, NULL,
bpp);
if (error) {
brelse(*bpp, 0);
@@ -159,7 +158,7 @@
*/
if (bpp != NULL) {
- error = bread(&vp, lbn, osize, NULL,
+ error = bread(ip->i_vnode, lbn, osize, NULL,
bpp);
if (error) {
brelse(*bpp, 0);
@@ -189,7 +188,7 @@
if (error)
return (error);
if (bpp != NULL) {
- bp = getblk(&vp, lbn, nsize, 0, 0, 0);
+ bp = getblk(ip->i_vnode, lbn, nsize, 0, 0, 0);
bp->b_blkno = fsbtodb(fs, newb);
clrbuf(bp);
*bpp = bp;
@@ -227,7 +226,7 @@
return error;
nb = newb;
*allocblk++ = nb;
- bp = getblk(&vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
+ bp = getblk(ip->i_vnode, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
bp->b_blkno = fsbtodb(fs, nb);
clrbuf(bp);
/*
@@ -245,7 +244,7 @@
*/
for (i = 1;;) {
- error = bread(&vp, indirs[i].in_lbn, fs->fs_bsize, NULL, &bp);
+ error = bread(ip->i_vnode, indirs[i].in_lbn, fs->fs_bsize, NULL, &bp);
if (error) {
brelse(bp, 0);
return error;
@@ -268,7 +267,7 @@
}
nb = newb;
*allocblk++ = nb;
- nbp = getblk(&vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
+ nbp = getblk(ip->i_vnode, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
nbp->b_blkno = fsbtodb(fs, nb);
clrbuf(nbp);
/*
@@ -299,7 +298,7 @@
nb = newb;
*allocblk++ = nb;
if (bpp != NULL) {
- nbp = getblk(&vp, lbn, fs->fs_bsize, 0, 0, 0);
+ nbp = getblk(ip->i_vnode, lbn, fs->fs_bsize, 0, 0, 0);
nbp->b_blkno = fsbtodb(fs, nb);
clrbuf(nbp);
*bpp = nbp;
@@ -315,7 +314,7 @@
}
brelse(bp, 0);
if (bpp != NULL) {
- error = bread(&vp, lbn, (int)fs->fs_bsize, NULL, &nbp);
+ error = bread(ip->i_vnode, lbn, (int)fs->fs_bsize, NULL, &nbp);
if (error) {
brelse(nbp, 0);
return error;
@@ -333,13 +332,13 @@
struct buf *bp, *nbp;
struct fs *fs = ip->i_fs;
struct indir indirs[UFS_NIADDR + 2];
- daddr_t newb, pref, nb;
+ daddr_t newb, pref;
+ uint64_t nb;
int64_t *bap;
int osize, nsize, num, i, error;
int64_t *allocblk, allociblk[UFS_NIADDR + 1];
int64_t *allocib;
const int needswap = UFS_FSNEEDSWAP(fs);
- struct vnode vp = { ip->i_fd, ip->i_fs, NULL, 0 };
lbn = lblkno(fs, offset);
size = blkoff(fs, offset) + bufsize;
@@ -383,7 +382,7 @@
*/
if (bpp != NULL) {
- error = bread(&vp, lbn, fs->fs_bsize, NULL,
+ error = bread(ip->i_vnode, lbn, fs->fs_bsize, NULL,
bpp);
if (error) {
brelse(*bpp, 0);
@@ -409,7 +408,7 @@
*/
if (bpp != NULL) {
- error = bread(&vp, lbn, osize, NULL,
+ error = bread(ip->i_vnode, lbn, osize, NULL,
bpp);
if (error) {
brelse(*bpp, 0);
@@ -439,7 +438,7 @@
if (error)
return (error);
if (bpp != NULL) {
- bp = getblk(&vp, lbn, nsize, 0, 0, 0);
+ bp = getblk(ip->i_vnode, lbn, nsize, 0, 0, 0);
bp->b_blkno = fsbtodb(fs, newb);
clrbuf(bp);
*bpp = bp;
@@ -477,7 +476,7 @@
return error;
nb = newb;
*allocblk++ = nb;
- bp = getblk(&vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
+ bp = getblk(ip->i_vnode, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
bp->b_blkno = fsbtodb(fs, nb);
clrbuf(bp);
/*
@@ -495,7 +494,7 @@
*/
for (i = 1;;) {
- error = bread(&vp, indirs[i].in_lbn, fs->fs_bsize, NULL, &bp);
+ error = bread(ip->i_vnode, indirs[i].in_lbn, fs->fs_bsize, NULL, &bp);
if (error) {
brelse(bp, 0);
return error;
@@ -518,7 +517,7 @@
}
nb = newb;
*allocblk++ = nb;
- nbp = getblk(&vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
+ nbp = getblk(ip->i_vnode, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0);
nbp->b_blkno = fsbtodb(fs, nb);
clrbuf(nbp);
/*
@@ -549,7 +548,7 @@
nb = newb;
*allocblk++ = nb;
if (bpp != NULL) {
- nbp = getblk(&vp, lbn, fs->fs_bsize, 0, 0, 0);
+ nbp = getblk(ip->i_vnode, lbn, fs->fs_bsize, 0, 0, 0);
nbp->b_blkno = fsbtodb(fs, nb);
clrbuf(nbp);
*bpp = nbp;
@@ -565,7 +564,7 @@
}
brelse(bp, 0);
if (bpp != NULL) {
- error = bread(&vp, lbn, (int)fs->fs_bsize, NULL, &nbp);
+ error = bread(ip->i_vnode, lbn, (int)fs->fs_bsize, NULL, &nbp);
if (error) {
brelse(nbp, 0);
return error;
Index: usr.sbin/makefs/ffs/ffs_bswap.c
===================================================================
--- usr.sbin/makefs/ffs/ffs_bswap.c
+++ usr.sbin/makefs/ffs/ffs_bswap.c
@@ -60,6 +60,8 @@
void ffs_csum_swap(struct csum *o, struct csum *n, int size);
void ffs_csumtotal_swap(struct csum_total *o, struct csum_total *n);
+void ffs_sb_swap(struct fs *o, struct fs *n);
+
void
ffs_sb_swap(struct fs *o, struct fs *n)
{
@@ -118,6 +120,7 @@
n->fs_magic = bswap32(o->fs_magic);
}
+void ffs_dinode1_swap(struct ufs1_dinode *o, struct ufs1_dinode *n);
void
ffs_dinode1_swap(struct ufs1_dinode *o, struct ufs1_dinode *n)
{
@@ -140,6 +143,7 @@
n->di_gid = bswap32(o->di_gid);
}
+void ffs_dinode2_swap(struct ufs2_dinode *o, struct ufs2_dinode *n);
void
ffs_dinode2_swap(struct ufs2_dinode *o, struct ufs2_dinode *n)
{
@@ -189,6 +193,7 @@
n->cs_nffree = bswap64(o->cs_nffree);
}
+void ffs_cg_swap(struct cg *o, struct cg *n, struct fs *fs);
/*
* Note that ffs_cg_swap may be called with o == n.
*/
@@ -216,7 +221,7 @@
n->cg_irotor = bswap32(o->cg_irotor);
for (i = 0; i < MAXFRAG; i++)
n->cg_frsum[i] = bswap32(o->cg_frsum[i]);
-
+
n->cg_old_btotoff = bswap32(o->cg_old_btotoff);
n->cg_old_boff = bswap32(o->cg_old_boff);
n->cg_iusedoff = bswap32(o->cg_iusedoff);
@@ -241,19 +246,19 @@
boff = bswap32(n->cg_old_boff);
clustersumoff = bswap32(n->cg_clustersumoff);
}
- n32 = (u_int32_t *)((u_int8_t *)n + btotoff);
- o32 = (u_int32_t *)((u_int8_t *)o + btotoff);
- n16 = (u_int16_t *)((u_int8_t *)n + boff);
- o16 = (u_int16_t *)((u_int8_t *)o + boff);
+ n32 = (u_int32_t *)(void *)((u_int8_t *)n + btotoff);
+ o32 = (u_int32_t *)(void *)((u_int8_t *)o + btotoff);
+ n16 = (u_int16_t *)(void *)((u_int8_t *)n + boff);
+ o16 = (u_int16_t *)(void *)((u_int8_t *)o + boff);
for (i = 0; i < fs->fs_old_cpg; i++)
n32[i] = bswap32(o32[i]);
-
+
for (i = 0; i < fs->fs_old_cpg * fs->fs_old_nrpos; i++)
n16[i] = bswap16(o16[i]);
- n32 = (u_int32_t *)((u_int8_t *)n + clustersumoff);
- o32 = (u_int32_t *)((u_int8_t *)o + clustersumoff);
+ n32 = (u_int32_t *)(void *)((u_int8_t *)n + clustersumoff);
+ o32 = (u_int32_t *)(void *)((u_int8_t *)o + clustersumoff);
for (i = 1; i < fs->fs_contigsumsize + 1; i++)
n32[i] = bswap32(o32[i]);
}
Index: usr.sbin/makefs/ffs/ffs_subr.c
===================================================================
--- usr.sbin/makefs/ffs/ffs_subr.c
+++ usr.sbin/makefs/ffs/ffs_subr.c
@@ -43,7 +43,7 @@
#include "ffs/ufs_bswap.h"
/*
- * Update the frsum fields to reflect addition or deletion
+ * Update the frsum fields to reflect addition or deletion
* of some frags.
*/
void
Index: usr.sbin/makefs/ffs/mkfs.c
===================================================================
--- usr.sbin/makefs/ffs/mkfs.c
+++ usr.sbin/makefs/ffs/mkfs.c
@@ -117,7 +117,7 @@
{
int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg;
int32_t csfrags;
- uint32_t i, cylno;
+ size_t cylno, i;
long long sizepb;
void *space;
int size;
@@ -125,21 +125,21 @@
ffs_opt_t *ffs_opts = fsopts->fs_specific;
Oflag = ffs_opts->version;
- fssize = fsopts->size / fsopts->sectorsize;
- sectorsize = fsopts->sectorsize;
- fsize = ffs_opts->fsize;
- bsize = ffs_opts->bsize;
- maxbsize = ffs_opts->maxbsize;
- maxblkspercg = ffs_opts->maxblkspercg;
- minfree = ffs_opts->minfree;
- opt = ffs_opts->optimization;
- density = ffs_opts->density;
- maxcontig = ffs_opts->maxcontig;
- maxbpg = ffs_opts->maxbpg;
- avgfilesize = ffs_opts->avgfilesize;
- avgfpdir = ffs_opts->avgfpdir;
- bbsize = BBSIZE;
- sbsize = SBLOCKSIZE;
+ fssize = fsopts->size / fsopts->sectorsize;
+ sectorsize = fsopts->sectorsize;
+ fsize = ffs_opts->fsize;
+ bsize = ffs_opts->bsize;
+ maxbsize = ffs_opts->maxbsize;
+ maxblkspercg = ffs_opts->maxblkspercg;
+ minfree = ffs_opts->minfree;
+ opt = ffs_opts->optimization;
+ density = ffs_opts->density;
+ maxcontig = ffs_opts->maxcontig;
+ maxbpg = ffs_opts->maxbpg;
+ avgfilesize = ffs_opts->avgfilesize;
+ avgfpdir = ffs_opts->avgfpdir;
+ bbsize = BBSIZE;
+ sbsize = SBLOCKSIZE;
strlcpy(sblock.fs_volname, ffs_opts->label, sizeof(sblock.fs_volname));
@@ -499,7 +499,7 @@
*/
memcpy(writebuf, &sblock, sbsize);
if (fsopts->needswap)
- ffs_sb_swap(&sblock, (struct fs*)writebuf);
+ ffs_sb_swap(&sblock, (struct fs*)(void *)writebuf);
memcpy(iobuf, writebuf, SBLOCKSIZE);
printf("super-block backups (for fsck -b #) at:");
@@ -538,16 +538,16 @@
ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
{
int size, blks, i, saveflag;
- uint32_t cylno;
+ size_t cylno;
void *space;
char *wrbuf;
saveflag = fs->fs_flags & FS_INTERNAL;
fs->fs_flags &= ~FS_INTERNAL;
- memcpy(writebuf, &sblock, sbsize);
+ memcpy(writebuf, &sblock, sbsize);
if (fsopts->needswap)
- ffs_sb_swap(fs, (struct fs*)writebuf);
+ ffs_sb_swap(fs, (struct fs*)(void *)writebuf);
ffs_wtfs(fs->fs_sblockloc / sectorsize, sbsize, writebuf, fsopts);
/* Write out the duplicate super blocks */
@@ -566,7 +566,7 @@
size = (blks - i) * fs->fs_fsize;
if (fsopts->needswap)
ffs_csum_swap((struct csum *)space,
- (struct csum *)wrbuf, size);
+ (struct csum *)(void *)wrbuf, size);
else
memcpy(wrbuf, space, (u_int)size);
ffs_wtfs(fsbtodb(fs, fs->fs_csaddr + i), size, wrbuf, fsopts);
@@ -615,7 +615,7 @@
if (Oflag == 2) {
acg.cg_iusedoff = start;
} else {
- if (cylno == sblock.fs_ncg - 1)
+ if ((unsigned)cylno == sblock.fs_ncg - 1)
acg.cg_old_ncyl = howmany(acg.cg_ndblk,
sblock.fs_fpg / sblock.fs_old_cpg);
else
@@ -645,7 +645,7 @@
acg.cg_nextfreeoff = acg.cg_clusteroff +
howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT);
}
- if (acg.cg_nextfreeoff > (uint32_t)sblock.fs_cgsize) {
+ if ((int32_t)acg.cg_nextfreeoff > sblock.fs_cgsize) {
printf("Panic: cylinder group too big\n");
exit(37);
}
@@ -729,10 +729,10 @@
start = MAX(sblock.fs_bsize, SBLOCKSIZE);
memcpy(&iobuf[start], &acg, sblock.fs_cgsize);
if (fsopts->needswap)
- ffs_cg_swap(&acg, (struct cg*)&iobuf[start], &sblock);
+ ffs_cg_swap(&acg, (struct cg*)(void *)&iobuf[start], &sblock);
start += sblock.fs_bsize;
- dp1 = (struct ufs1_dinode *)(&iobuf[start]);
- dp2 = (struct ufs2_dinode *)(&iobuf[start]);
+ dp1 = (struct ufs1_dinode *)(void *)(&iobuf[start]);
+ dp2 = (struct ufs2_dinode *)(void *)(&iobuf[start]);
for (i = 0; i < acg.cg_initediblk; i++) {
if (sblock.fs_magic == FS_UFS1_MAGIC) {
/* No need to swap, it'll stay random */
@@ -752,7 +752,7 @@
for (i = 2 * sblock.fs_frag;
i < sblock.fs_ipg / INOPF(&sblock);
i += sblock.fs_frag) {
- dp1 = (struct ufs1_dinode *)(&iobuf[start]);
+ dp1 = (struct ufs1_dinode *)(void *)(&iobuf[start]);
for (j = 0; j < INOPB(&sblock); j++) {
dp1->di_gen = random();
dp1++;
Index: usr.sbin/makefs/ffs/ufs_bmap.c
===================================================================
--- usr.sbin/makefs/ffs/ufs_bmap.c
+++ usr.sbin/makefs/ffs/ufs_bmap.c
@@ -84,7 +84,7 @@
assert (bn >= UFS_NDADDR);
- /*
+ /*
* Determine the number of levels of indirection. After this loop
* is done, blockcnt indicates the number of data blocks possible
* at the given level of indirection, and UFS_NIADDR - i is the number
@@ -109,7 +109,7 @@
else
metalbn = -(-realbn - bn + UFS_NIADDR - i);
- /*
+ /*
* At each iteration, off is the offset into the bap array which is
* an array of disk addresses at the current level of indirection.
* The logical block number and the offset in that block are stored
Index: usr.sbin/makefs/ffs/ufs_inode.h
===================================================================
--- usr.sbin/makefs/ffs/ufs_inode.h
+++ usr.sbin/makefs/ffs/ufs_inode.h
@@ -44,10 +44,10 @@
};
struct inode {
- ino_t i_number; /* The identity of the inode. */
+ ino_t i_number; /* The identity of the inode. */
+ struct vnode *i_vnode; /* vnode pointer (contains fsopts) */
struct fs *i_fs; /* File system */
union dinode i_din;
- int i_fd; /* File descriptor */
uint64_t i_size;
};
@@ -93,5 +93,5 @@
#undef DIP
#define DIP(ip, field) \
- (((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) ? \
- (ip)->i_ffs1_##field : (ip)->i_ffs2_##field)
+ (((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) ? \
+ (ip)->i_ffs1_##field : (ip)->i_ffs2_##field)
Index: usr.sbin/makefs/makefs.h
===================================================================
--- usr.sbin/makefs/makefs.h
+++ usr.sbin/makefs/makefs.h
@@ -48,7 +48,7 @@
* a component of the tree; contains a filename, a pointer to
* fsinode, optional symlink name, and tree pointers
*
- * fsinode -
+ * fsinode -
* equivalent to an inode, containing target file system inode number,
* refcount (nlink), and stat buffer
*
@@ -56,7 +56,7 @@
*
* name "." "bin" "netbsd"
* type S_IFDIR S_IFDIR S_IFREG
- * next > > NULL
+ * next > > NULL
* parent NULL NULL NULL
* child NULL v
*
Index: usr.sbin/makefs/makefs.c
===================================================================
--- usr.sbin/makefs/makefs.c
+++ usr.sbin/makefs/makefs.c
@@ -94,7 +94,7 @@
fstype_t *fstype;
fsinfo_t fsoptions;
fsnode *root;
- int ch, i, len;
+ int ch, i, len;
const char *subtree;
const char *specfile;
@@ -426,7 +426,7 @@
get_fstype(const char *type)
{
int i;
-
+
for (i = 0; fstypes[i].type != NULL; i++)
if (strcmp(fstypes[i].type, type) == 0)
return (&fstypes[i]);
Index: usr.sbin/makefs/mtree.c
===================================================================
--- usr.sbin/makefs/mtree.c
+++ usr.sbin/makefs/mtree.c
@@ -159,7 +159,7 @@
break;
rp[++depth] = pnode->name;
}
-
+
sb = sbuf_new_auto();
if (sb == NULL) {
errno = ENOMEM;
@@ -505,7 +505,8 @@
struct stat *st, sb;
intmax_t num;
u_long flset, flclr;
- int error, istemp, type;
+ int error, istemp;
+ uint32_t type;
st = &node->inode->st;
do {
@@ -774,9 +775,9 @@
}
/*
- * Check for hardlinks. If the contents key is used, then the check
- * will only trigger if the contents file is a link even if it is used
- * by more than one file
+ * Check for hardlinks. If the contents key is used, then the check
+ * will only trigger if the contents file is a link even if it is used
+ * by more than one file
*/
if (sb.st_nlink > 1) {
fsinode *curino;
Index: usr.sbin/makefs/walk.c
===================================================================
--- usr.sbin/makefs/walk.c
+++ usr.sbin/makefs/walk.c
@@ -397,8 +397,8 @@
if (strcmp(curnode->name, curfsnode->name) == 0)
break;
}
- if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir,
- curnode->name) >= sizeof(path))
+ if ((size_t)snprintf(path, sizeof(path), "%s/%s",
+ dir, curnode->name) >= sizeof(path))
errx(1, "Pathname too long.");
if (curfsnode == NULL) { /* need new entry */
struct stat stbuf;
@@ -625,7 +625,7 @@
* return pointer to fsinode matching `entry's st_ino & st_dev if it exists,
* otherwise add `entry' to table and return NULL
*/
-/* This was borrowed from du.c and tweaked to keep an fsnode
+/* This was borrowed from du.c and tweaked to keep an fsnode
* pointer instead. -- dbj@netbsd.org
*/
fsinode *
@@ -644,7 +644,7 @@
*/
const uint64_t HTCONST = 11400714819323198485ULL;
const int HTBITS = 64;
-
+
/* Never store zero in hashtable */
assert(entry);
@@ -679,7 +679,7 @@
tmp *= HTCONST;
h = tmp >> (HTBITS - htshift);
h2 = 1 | ( tmp >> (HTBITS - (htshift<<1) - 1)); /* must be odd */
-
+
/* open address hashtable search with double hash probing */
while (htable[h].data) {
if ((htable[h].data->st.st_ino == entry->st.st_ino) &&

File Metadata

Mime Type
text/plain
Expires
Mon, Aug 31, 1:19 AM (5 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37640461
Default Alt Text
D10777.id.diff (39 KB)

Event Timeline