summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-06-29 03:37:09 +0000
committerderaadt <deraadt@openbsd.org>2007-06-29 03:37:09 +0000
commit50c87d918618f89da49529955d50a336b096b647 (patch)
tree1748fc283a1a5b0bf81f6841f93574f32fda7d98
parentforce the pci bus probe routines to look for extra functions on jmicron (diff)
downloadwireguard-openbsd-50c87d918618f89da49529955d50a336b096b647.tar.xz
wireguard-openbsd-50c87d918618f89da49529955d50a336b096b647.zip
more daddr64_t changes; checked by otto
-rw-r--r--sbin/badsect/badsect.c28
-rw-r--r--sbin/ncheck_ffs/ncheck_ffs.c6
-rw-r--r--sbin/quotacheck/quotacheck.c52
3 files changed, 43 insertions, 43 deletions
diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c
index 13902b91fde..6d34d1fe664 100644
--- a/sbin/badsect/badsect.c
+++ b/sbin/badsect/badsect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: badsect.c,v 1.16 2007/03/19 13:27:47 pedro Exp $ */
+/* $OpenBSD: badsect.c,v 1.17 2007/06/29 03:37:09 deraadt Exp $ */
/* $NetBSD: badsect.c,v 1.10 1995/03/18 14:54:28 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)badsect.c 8.1 (Berkeley) 6/5/93";
#else
-static const char rcsid[] = "$OpenBSD: badsect.c,v 1.16 2007/03/19 13:27:47 pedro Exp $";
+static const char rcsid[] = "$OpenBSD: badsect.c,v 1.17 2007/06/29 03:37:09 deraadt Exp $";
#endif
#endif /* not lint */
@@ -69,8 +69,8 @@ static const char rcsid[] = "$OpenBSD: badsect.c,v 1.16 2007/03/19 13:27:47 pedr
#include <unistd.h>
#include <err.h>
-static int chkuse(daddr_t, int);
-static void rdfs(daddr_t, int, char *);
+static int chkuse(daddr64_t, int);
+static void rdfs(daddr64_t, int, char *);
static union {
struct fs fs;
@@ -90,7 +90,7 @@ static long dev_bsize = 1;
int
main(int argc, char *argv[])
{
- daddr_t number;
+ daddr64_t number;
struct stat stbuf, devstat;
struct direct *dp;
DIR *dirp;
@@ -140,7 +140,7 @@ main(int argc, char *argv[])
rdfs(SBOFF, SBSIZE, (char *)fs);
dev_bsize = fs->fs_fsize / fsbtodb(fs, 1);
for (argc -= 2, argv += 2; argc > 0; argc--, argv++) {
- number = atoi(*argv);
+ number = strtonum(*argv, 0, QUAD_MAX, NULL);
if (chkuse(number, 1))
continue;
if (mknod(*argv, S_IFMT|S_IRUSR|S_IWUSR,
@@ -154,26 +154,26 @@ main(int argc, char *argv[])
}
static int
-chkuse(daddr_t blkno, int cnt)
+chkuse(daddr64_t blkno, int cnt)
{
int cg;
- daddr_t fsbn, bn;
+ daddr64_t fsbn, bn;
fsbn = dbtofsb(fs, blkno);
- if ((unsigned)(fsbn+cnt) > fs->fs_ffs1_size) {
- fprintf(stderr, "block %d out of range of file system\n", blkno);
+ if (fsbn+cnt > fs->fs_ffs1_size) {
+ fprintf(stderr, "block %lld out of range of file system\n", blkno);
return (1);
}
cg = dtog(fs, fsbn);
if (fsbn < cgdmin(fs, cg)) {
if (cg == 0 || (fsbn+cnt) > cgsblock(fs, cg)) {
- fprintf(stderr, "block %d in non-data area: cannot attach\n",
+ fprintf(stderr, "block %lld in non-data area: cannot attach\n",
blkno);
return (1);
}
} else {
if ((fsbn+cnt) > cgbase(fs, cg+1)) {
- fprintf(stderr, "block %d in non-data area: cannot attach\n",
+ fprintf(stderr, "block %lld in non-data area: cannot attach\n",
blkno);
return (1);
}
@@ -187,7 +187,7 @@ chkuse(daddr_t blkno, int cnt)
}
bn = dtogd(fs, fsbn);
if (isclr(cg_blksfree(&acg), bn))
- fprintf(stderr, "Warning: sector %d is in use\n", blkno);
+ fprintf(stderr, "Warning: sector %lld is in use\n", blkno);
return (0);
}
@@ -195,7 +195,7 @@ chkuse(daddr_t blkno, int cnt)
* read a block from the file system
*/
static void
-rdfs(daddr_t bno, int size, char *bf)
+rdfs(daddr64_t bno, int size, char *bf)
{
int n;
diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c
index 6009a50fbb6..2c8bc358361 100644
--- a/sbin/ncheck_ffs/ncheck_ffs.c
+++ b/sbin/ncheck_ffs/ncheck_ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncheck_ffs.c,v 1.30 2007/06/01 23:42:35 pedro Exp $ */
+/* $OpenBSD: ncheck_ffs.c,v 1.31 2007/06/29 03:37:09 deraadt Exp $ */
/*-
* Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -55,7 +55,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.30 2007/06/01 23:42:35 pedro Exp $";
+static const char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.31 2007/06/29 03:37:09 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -231,7 +231,7 @@ void *
getino(ino_t inum)
{
static char *itab = NULL;
- static daddr_t iblk = -1;
+ static daddr64_t iblk = -1;
void *dp;
size_t dsize;
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c
index 7e9feadbd78..aaff32febcd 100644
--- a/sbin/quotacheck/quotacheck.c
+++ b/sbin/quotacheck/quotacheck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quotacheck.c,v 1.21 2007/02/21 06:22:25 jmc Exp $ */
+/* $OpenBSD: quotacheck.c,v 1.22 2007/06/29 03:37:09 deraadt Exp $ */
/* $NetBSD: quotacheck.c,v 1.12 1996/03/30 22:34:25 mark Exp $ */
/*
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)quotacheck.c 8.3 (Berkeley) 1/29/94";
#else
-static char rcsid[] = "$OpenBSD: quotacheck.c,v 1.21 2007/02/21 06:22:25 jmc Exp $";
+static char rcsid[] = "$OpenBSD: quotacheck.c,v 1.22 2007/06/29 03:37:09 deraadt Exp $";
#endif
#endif /* not lint */
@@ -91,11 +91,11 @@ struct quotaname {
#define HASGRP 2
struct fileusage {
- struct fileusage *fu_next;
- u_long fu_curinodes;
- u_long fu_curblocks;
- u_long fu_id;
- char fu_name[1];
+ struct fileusage *fu_next;
+ u_int32_t fu_curinodes;
+ u_int32_t fu_curblocks;
+ u_int32_t fu_id; /* uid_t or gid_t */
+ char fu_name[1];
/* actually bigger */
};
#define FUHASH 1024 /* must be power of two */
@@ -105,12 +105,12 @@ int gflag; /* check group quotas */
int uflag; /* check user quotas */
int flags; /* check flags (avd) */
int fi; /* open disk file descriptor */
-u_long highid[MAXQUOTAS]; /* highest addid()'ed identifier per type */
+u_int32_t highid[MAXQUOTAS]; /* highest addid()'ed identifier per type */
struct fileusage *
- addid(u_long, int, char *);
+ addid(u_int32_t, int, char *);
char *blockcheck(char *);
-void bread(daddr_t, char *, long);
+void bread(daddr64_t, char *, long);
int chkquota(const char *, const char *, const char *, void *, pid_t *);
void freeinodebuf(void);
struct ufs1_dinode *
@@ -118,7 +118,7 @@ struct ufs1_dinode *
int getquotagid(void);
int hasquota(struct fstab *, int, char **);
struct fileusage *
- lookup(u_long, int);
+ lookup(u_int32_t, int);
void *needchk(struct fstab *);
int oneof(char *, char*[], int);
void resetinodebuf(void);
@@ -133,7 +133,7 @@ main(int argc, char *argv[])
struct group *gr;
struct quotaname *auxdata;
int i, argnum, maxrun, errs, ch;
- long done = 0;
+ u_int64_t done = 0; /* XXX supports maximum 64 filesystems */
char *name;
errs = maxrun = 0;
@@ -173,13 +173,13 @@ main(int argc, char *argv[])
if (gflag) {
setgrent();
while ((gr = getgrent()) != 0)
- (void) addid((u_long)gr->gr_gid, GRPQUOTA, gr->gr_name);
+ (void) addid(gr->gr_gid, GRPQUOTA, gr->gr_name);
endgrent();
}
if (uflag) {
setpwent();
while ((pw = getpwent()) != 0)
- (void) addid((u_long)pw->pw_uid, USRQUOTA, pw->pw_name);
+ (void) addid(pw->pw_uid, USRQUOTA, pw->pw_name);
endpwent();
}
if (flags&CHECK_PREEN)
@@ -280,7 +280,7 @@ chkquota(const char *vfstype, const char *fsname, const char *mntpt,
if ((mode = dp->di_mode & IFMT) == 0)
continue;
if (qnp->flags & HASGRP) {
- fup = addid((u_long)dp->di_gid,
+ fup = addid(dp->di_gid,
GRPQUOTA, NULL);
fup->fu_curinodes++;
if (mode == IFREG || mode == IFDIR ||
@@ -289,7 +289,7 @@ chkquota(const char *vfstype, const char *fsname, const char *mntpt,
dp->di_blocks;
}
if (qnp->flags & HASUSR) {
- fup = addid((u_long)dp->di_uid,
+ fup = addid(dp->di_uid,
USRQUOTA, NULL);
fup->fu_curinodes++;
if (mode == IFREG || mode == IFDIR ||
@@ -348,7 +348,7 @@ update(const char *fsname, const char *quotafile, int type)
{
struct fileusage *fup;
FILE *qfi, *qfo;
- u_long id, lastid;
+ u_int32_t id, lastid;
struct dqblk dqbuf;
static int warned = 0;
static struct dqblk zerodqbuf;
@@ -375,7 +375,7 @@ update(const char *fsname, const char *quotafile, int type)
(void) fclose(qfo);
return (1);
}
- if (quotactl(fsname, QCMD(Q_SYNC, type), (u_long)0, (caddr_t)0) < 0 &&
+ if (quotactl(fsname, QCMD(Q_SYNC, type), 0, (caddr_t)0) < 0 &&
errno == EOPNOTSUPP && !warned &&
(flags&(CHECK_DEBUG|CHECK_VERBOSE))) {
warned++;
@@ -391,7 +391,7 @@ update(const char *fsname, const char *quotafile, int type)
dqbuf.dqb_curblocks == fup->fu_curblocks) {
fup->fu_curinodes = 0;
fup->fu_curblocks = 0;
- fseek(qfo, (long)sizeof(struct dqblk), 1);
+ fseek(qfo, (long)sizeof(struct dqblk), SEEK_CUR);
continue;
}
if (flags&(CHECK_DEBUG|CHECK_VERBOSE)) {
@@ -402,7 +402,7 @@ update(const char *fsname, const char *quotafile, int type)
(void)printf("\tinodes %d -> %ld",
dqbuf.dqb_curinodes, fup->fu_curinodes);
if (dqbuf.dqb_curblocks != fup->fu_curblocks)
- (void)printf("\tblocks %d -> %ld",
+ (void)printf("\tblocks %u -> %ld",
dqbuf.dqb_curblocks, fup->fu_curblocks);
(void)printf("\n");
}
@@ -508,7 +508,7 @@ hasquota(struct fstab *fs, int type, char **qfnamep)
* Lookup an id of a specific type.
*/
struct fileusage *
-lookup(u_long id, int type)
+lookup(u_int32_t id, int type)
{
struct fileusage *fup;
@@ -522,7 +522,7 @@ lookup(u_long id, int type)
* Add a new file usage id if it does not already exist.
*/
struct fileusage *
-addid(u_long id, int type, char *name)
+addid(u_int32_t id, int type, char *name)
{
struct fileusage *fup, **fhp;
int len;
@@ -562,11 +562,11 @@ struct ufs1_dinode *
getnextinode(ino_t inumber)
{
long size;
- daddr_t dblk;
+ daddr64_t dblk;
static struct ufs1_dinode *dp;
if (inumber != nextino++ || inumber > maxino)
- err(1, "bad inode number %d to nextinode", inumber);
+ err(1, "bad inode number %u to nextinode", inumber);
if (inumber >= lastinum) {
readcnt++;
dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
@@ -627,10 +627,10 @@ freeinodebuf(void)
* Read specified disk blocks.
*/
void
-bread(daddr_t bno, char *buf, long cnt)
+bread(daddr64_t bno, char *buf, long cnt)
{
if (lseek(fi, (off_t)bno * dev_bsize, SEEK_SET) < 0 ||
read(fi, buf, cnt) != cnt)
- err(1, "block %u", bno);
+ err(1, "block %lld", bno);
}