Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

AMD64 - AUDIT RUN - Fix format strings, size_t, and other issues

  • Loading branch information...
commit a276dc6b198ac253911f4d7e2994422e81efea72 1 parent 4ae574e
Matthew Dillon authored
Showing with 439 additions and 337 deletions.
  1. +7 −5 bin/dd/args.c
  2. +11 −8 bin/dd/misc.c
  3. +1 −1  bin/sh/mksyntax.c
  4. +1 −0  bin/sh/parser.c
  5. +4 −1 contrib/com_err/getarg.c
  6. +1 −5 contrib/libevent/kqueue.c
  7. +1 −1  contrib/ncurses-5.4/ncurses/trace/lib_tracechr.c
  8. +1 −0  contrib/opie/libopie/generator.c
  9. +1 −0  contrib/opie/libopie/lookup.c
  10. +1 −0  contrib/opie/libopie/newseed.c
  11. +1 −0  contrib/opie/libopie/passwd.c
  12. +2 −0  contrib/opie/libopie/randomchallenge.c
  13. +2 −0  contrib/opie/libopie/version.c
  14. +1 −1  contrib/sendmail-8.14/libmilter/listener.c
  15. +2 −1  contrib/smbfs/lib/smb/file.c
  16. +2 −1  contrib/smbfs/lib/smb/kiconv.c
  17. +1 −1  contrib/smbfs/lib/smb/nb_net.c
  18. +5 −4 contrib/smbfs/lib/smb/nls.c
  19. +2 −1  contrib/smbfs/lib/smb/rap.c
  20. +1 −0  contrib/smbfs/lib/smb/rq.c
  21. +1 −0  contrib/tcp_wrappers/options.c
  22. +1 −0  contrib/tcp_wrappers/shell_cmd.c
  23. +1 −0  gnu/lib/libdialog/rc.c
  24. +1 −0  gnu/usr.bin/sort/getopt.c
  25. +5 −0 lib/libc/gen/nlist.c
  26. +1 −1  lib/libc_r/uthread/uthread_sig.c
  27. +13 −8 lib/libcompat/4.3/rexec.c
  28. +4 −2 lib/libncp/ncpl_conn.c
  29. +3 −2 lib/libncp/ncpl_subr.c
  30. +1 −1  lib/libsctp/sctp_sys_calls.c
  31. +1 −1  lib/libthread_xu/thread/thr_private.h
  32. +7 −7 libexec/rtld-elf/debug.c
  33. +3 −3 sbin/camcontrol/camcontrol.c
  34. +1 −1  sbin/camcontrol/util.c
  35. +5 −4 sbin/diskinfo/diskinfo.c
  36. +37 −31 sbin/disklabel64/disklabel64.c
  37. +5 −4 sbin/dumpfs/dumpfs.c
  38. +2 −2 sbin/fdisk/fdisk.c
  39. +3 −3 sbin/fsdb/fsdb.c
  40. +16 −12 sbin/fsirand/fsirand.c
  41. +2 −2 sbin/growfs/growfs.c
  42. +11 −6 sbin/hammer/cmd_blockmap.c
  43. +6 −6 sbin/hammer/cmd_history.c
  44. +13 −7 sbin/hammer/cmd_info.c
  45. +45 −44 sbin/hammer/cmd_mirror.c
  46. +4 −4 sbin/hammer/cmd_pseudofs.c
  47. +12 −12 sbin/hammer/cmd_rebalance.c
  48. +11 −10 sbin/hammer/cmd_reblock.c
  49. +38 −31 sbin/hammer/cmd_show.c
  50. +1 −1  sbin/hammer/cmd_snapshot.c
  51. +13 −12 sbin/hammer/cmd_softprune.c
  52. +16 −15 sbin/hammer/cmd_stats.c
  53. +1 −1  sbin/hammer/cmd_synctid.c
  54. +1 −1  sbin/hammer/cycle.c
  55. +5 −5 sbin/hammer/hammer.c
  56. +7 −6 sbin/jscan/dump_debug.c
  57. +3 −3 sbin/jscan/jfile.c
  58. +6 −6 sbin/jscan/jscan.c
  59. +2 −2 sbin/jscan/jsession.c
  60. +18 −6 sbin/jscan/jstream.c
  61. +1 −1  sbin/jscan/subs.c
  62. +2 −2 sbin/mountctl/mountctl.c
  63. +4 −2 sbin/quotacheck/quotacheck.c
  64. +7 −4 sbin/restore/tape.c
  65. +3 −3 sbin/savecore/savecore.c
  66. +9 −6 sbin/sysctl/sysctl.c
  67. +1 −0  secure/lib/libssh/version.c
  68. +1 −1  sys/netproto/smb/smb_dev.h
  69. +2 −2 usr.bin/cmp/misc.c
  70. +6 −3 usr.bin/cmp/regular.c
  71. +2 −1  usr.bin/cmp/special.c
  72. +1 −1  usr.bin/finger/lprint.c
  73. +1 −1  usr.bin/finger/util.c
  74. +5 −1 usr.bin/gprof/arcs.c
  75. +3 −1 usr.bin/gprof/printgprof.c
  76. +1 −1  usr.bin/limits/limits.c
  77. +1 −1  usr.bin/monitor/monitor.c
  78. +3 −3 usr.bin/tail/misc.c
  79. +3 −2 usr.bin/tail/reverse.c
  80. +9 −9 usr.bin/wc/wc.c
View
12 bin/dd/args.c
@@ -159,8 +159,10 @@ jcl(char **argv)
/*
* Bail out if the calculation of a file offset would overflow.
*/
- if (in.offset > QUAD_MAX / in.dbsz || out.offset > QUAD_MAX / out.dbsz)
+ if (in.offset > QUAD_MAX / (ssize_t)in.dbsz ||
+ out.offset > QUAD_MAX / (ssize_t)out.dbsz) {
errx(1, "seek offsets cannot be larger than %lld", QUAD_MAX);
+ }
}
static int
@@ -178,7 +180,7 @@ f_bs(char *arg)
res = get_num(arg);
if (res < 1 || res > SSIZE_MAX)
- errx(1, "bs must be between 1 and %d", SSIZE_MAX);
+ errx(1, "bs must be between 1 and %zd", SSIZE_MAX);
in.dbsz = out.dbsz = (size_t)res;
}
@@ -189,7 +191,7 @@ f_cbs(char *arg)
res = get_num(arg);
if (res < 1 || res > SSIZE_MAX)
- errx(1, "cbs must be between 1 and %d", SSIZE_MAX);
+ errx(1, "cbs must be between 1 and %zd", SSIZE_MAX);
cbsz = (size_t)res;
}
@@ -221,7 +223,7 @@ f_ibs(char *arg)
if (!(ddflags & C_BS)) {
res = get_num(arg);
if (res < 1 || res > SSIZE_MAX)
- errx(1, "ibs must be between 1 and %d", SSIZE_MAX);
+ errx(1, "ibs must be between 1 and %zd", SSIZE_MAX);
in.dbsz = (size_t)res;
}
}
@@ -241,7 +243,7 @@ f_obs(char *arg)
if (!(ddflags & C_BS)) {
res = get_num(arg);
if (res < 1 || res > SSIZE_MAX)
- errx(1, "obs must be between 1 and %d", SSIZE_MAX);
+ errx(1, "obs must be between 1 and %zd", SSIZE_MAX);
out.dbsz = (size_t)res;
}
}
View
19 bin/dd/misc.c
@@ -60,22 +60,25 @@ summary(void)
secs = 1e-6;
/* Use snprintf(3) so that we don't reenter stdio(3). */
snprintf(buf, sizeof(buf),
- "%llu+%llu records in\n%llu+%llu records out\n",
- st.in_full, st.in_part, st.out_full, st.out_part);
+ "%ju+%ju records in\n%ju+%ju records out\n",
+ (uintmax_t)st.in_full, (uintmax_t)st.in_part,
+ (uintmax_t)st.out_full, (uintmax_t)st.out_part);
write(STDERR_FILENO, buf, strlen(buf));
if (st.swab) {
- snprintf(buf, sizeof(buf), "%llu odd length swab %s\n",
- st.swab, (st.swab == 1) ? "block" : "blocks");
+ snprintf(buf, sizeof(buf), "%ju odd length swab %s\n",
+ (uintmax_t)st.swab,
+ ((st.swab == 1) ? "block" : "blocks"));
write(STDERR_FILENO, buf, strlen(buf));
}
if (st.trunc) {
- snprintf(buf, sizeof(buf), "%llu truncated %s\n",
- st.trunc, (st.trunc == 1) ? "block" : "blocks");
+ snprintf(buf, sizeof(buf), "%ju truncated %s\n",
+ (uintmax_t)st.trunc,
+ ((st.trunc == 1) ? "block" : "blocks"));
write(STDERR_FILENO, buf, strlen(buf));
}
snprintf(buf, sizeof(buf),
- "%llu bytes transferred in %.6f secs (%.0f bytes/sec)\n",
- st.bytes, secs, st.bytes / secs);
+ "%ju bytes transferred in %.6f secs (%.0f bytes/sec)\n",
+ (uintmax_t)st.bytes, secs, st.bytes / secs);
write(STDERR_FILENO, buf, strlen(buf));
}
View
2  bin/sh/mksyntax.c
@@ -385,7 +385,7 @@ digit_convert(void)
for (p = digit ; *p && *p != i ; p++);
if (*p == '\0')
p = digit;
- fprintf(cfile, " %d,\n", p - digit);
+ fprintf(cfile, " %td,\n", p - digit);
}
fputs("};\n", cfile);
}
View
1  bin/sh/parser.c
@@ -38,6 +38,7 @@
* $DragonFly: src/bin/sh/parser.c,v 1.12 2007/01/18 17:03:18 corecode Exp $
*/
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
View
5 contrib/com_err/getarg.c
@@ -43,6 +43,8 @@ RCSID("$Id: getarg.c,v 1.25 1998/11/22 09:45:05 assar Exp $");
#include <sys/ttycom.h>
#include <time.h>
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
#include "getarg.h"
#define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag)
@@ -175,7 +177,8 @@ arg_printusage (struct getargs *args,
static void
add_string(getarg_strings *s, char *value)
{
- s->strings = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings));
+ s->strings = realloc(s->strings,
+ (s->num_strings + 1) * sizeof(*s->strings));
s->strings[s->num_strings] = value;
s->num_strings++;
}
View
6 contrib/libevent/kqueue.c
@@ -51,11 +51,7 @@
/* Some platforms apparently define the udata field of struct kevent as
* ntptr_t, whereas others define it as void*. There doesn't seem to be an
* easy way to tell them apart via autoconf, so we need to use OS macros. */
-#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__)
-#define PTR_TO_UDATA(x) ((intptr_t)(x))
-#else
-#define PTR_TO_UDATA(x) (x)
-#endif
+#define PTR_TO_UDATA(x) ((void *)(x))
#include "event.h"
#include "log.h"
View
2  contrib/ncurses-5.4/ncurses/trace/lib_tracechr.c
@@ -45,7 +45,7 @@ NCURSES_EXPORT(char *)
_tracechar(int ch)
{
static char result[40];
- char *name;
+ const char *name;
if (ch > KEY_MIN || ch < 0) {
name = keyname(ch);
View
1  contrib/opie/libopie/generator.c
@@ -34,6 +34,7 @@ you didn't get a copy, you may request one from <license@inner.net>.
*/
#include "opie_cfg.h"
+#include <stdio.h>
#if HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
View
1  contrib/opie/libopie/lookup.c
@@ -13,6 +13,7 @@ you didn't get a copy, you may request one from <license@inner.net>.
#include "opie_cfg.h"
#include <stdio.h>
+#include <string.h>
#include "opie.h"
int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
View
1  contrib/opie/libopie/newseed.c
@@ -19,6 +19,7 @@ you didn't get a copy, you may request one from <license@inner.net>.
*/
#include "opie_cfg.h"
+#include <stdio.h>
#if HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
View
1  contrib/opie/libopie/passwd.c
@@ -20,6 +20,7 @@ you didn't get a copy, you may request one from <license@inner.net>.
Created by cmetz for OPIE 2.22.
*/
+#include <string.h>
#include "opie_cfg.h"
#include "opie.h"
View
2  contrib/opie/libopie/randomchallenge.c
@@ -26,6 +26,8 @@ License Agreement applies to this software.
Created at NRL for OPIE 2.2 from opiesubr2.c
*/
+#include <stdio.h>
+#include <string.h>
#include "opie_cfg.h"
#include "opie.h"
View
2  contrib/opie/libopie/version.c
@@ -17,6 +17,8 @@ License Agreement applies to this software.
Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
Created at NRL for OPIE 2.2 from opiesubr.c.
*/
+#include <stdio.h>
+#include <stdlib.h>
#include "opie_cfg.h"
#include "opie.h"
View
2  contrib/sendmail-8.14/libmilter/listener.c
@@ -576,7 +576,7 @@ mi_thread_handle_wrapper(arg)
** is not used anywhere.
*/
- return (void *) mi_handle_session(arg);
+ return (void *)(intptr_t)mi_handle_session(arg);
}
#endif /* _FFR_WORKERS_POOL */
View
3  contrib/smbfs/lib/smb/file.c
@@ -32,6 +32,7 @@
* $Id: file.c,v 1.2 2001/04/16 04:33:01 bp Exp $
*/
#include <sys/param.h>
+#include <sys/cdefs.h>
#include <sys/sysctl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
@@ -71,7 +72,7 @@ smb_write(struct smb_ctx *ctx, smbfh fh, off_t offset, size_t count,
struct smbioc_rw rwrq;
rwrq.ioc_fh = fh;
- rwrq.ioc_base = src;
+ rwrq.ioc_base = __DECONST(char *, src);
rwrq.ioc_cnt = count;
rwrq.ioc_offset = offset;
if (ioctl(ctx->ct_fd, SMBIOC_WRITE, &rwrq) == -1)
View
3  contrib/smbfs/lib/smb/kiconv.c
@@ -36,6 +36,7 @@
#include <sys/iconv.h>
#include <sys/sysctl.h>
#include <ctype.h>
+#include <string.h>
#include <errno.h>
#ifdef APPLE
@@ -48,7 +49,7 @@ kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
{
struct iconv_add_in din;
struct iconv_add_out dout;
- int olen;
+ size_t olen;
if (strlen(from) > ICONV_CSNMAXLEN || strlen(to) > ICONV_CSNMAXLEN)
return EINVAL;
View
2  contrib/smbfs/lib/smb/nb_net.c
@@ -198,4 +198,4 @@ nb_hostlookup(struct nb_name *np, const char *server, const char *hint,
nb_snbfree(snb);
return error;
}
-*/
+*/
View
9 contrib/smbfs/lib/smb/nls.c
@@ -41,6 +41,7 @@
#endif
#include <errno.h>
#include <stdio.h>
+#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <locale.h>
@@ -125,7 +126,7 @@ char *
nls_str_toloc(char *dst, const char *src)
{
char *p = dst;
- int inlen, outlen;
+ size_t inlen, outlen;
if (!iconv_loaded)
return strcpy(dst, src);
@@ -147,7 +148,7 @@ char *
nls_str_toext(char *dst, const char *src)
{
char *p = dst;
- int inlen, outlen;
+ size_t inlen, outlen;
if (!iconv_loaded)
return strcpy(dst, src);
@@ -170,7 +171,7 @@ nls_mem_toloc(void *dst, const void *src, int size)
{
char *p = dst;
const char *s = src;
- int inlen, outlen;
+ size_t inlen, outlen;
if (!iconv_loaded)
return memcpy(dst, src, size);
@@ -195,7 +196,7 @@ nls_mem_toext(void *dst, const void *src, int size)
{
char *p = dst;
const char *s = src;
- int inlen, outlen;
+ size_t inlen, outlen;
if (size == 0)
return NULL;
View
3  contrib/smbfs/lib/smb/rap.c
@@ -40,6 +40,7 @@
#include <err.h>
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <sysexits.h>
@@ -198,7 +199,7 @@ smb_rap_create(int fn, const char *param, const char *data,
rap = malloc(sizeof(*rap));
if (rap == NULL)
- return NULL;
+ return ENOMEM;
bzero(rap, sizeof(*rap));
p = rap->r_sparam = rap->r_nparam = strdup(param);
rap->r_sdata = rap->r_ndata = strdup(data);
View
1  contrib/smbfs/lib/smb/rq.c
@@ -39,6 +39,7 @@
#include <err.h>
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <sysexits.h>
View
1  contrib/tcp_wrappers/options.c
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31";
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
+#include <unistd.h>
#define SYSLOG_NAMES
#include <syslog.h>
#include <pwd.h>
View
1  contrib/tcp_wrappers/shell_cmd.c
@@ -18,6 +18,7 @@ static char sccsid[] = "@(#) shell_cmd.c 1.5 94/12/28 17:42:44";
#include <sys/param.h>
#include <signal.h>
#include <stdio.h>
+#include <unistd.h>
#include <syslog.h>
#include <string.h>
View
1  gnu/lib/libdialog/rc.c
@@ -245,6 +245,7 @@ static int str_to_attr(unsigned char *str, int *fg, int *bg, int *hl)
strcpy(tempstr, str + 1);
lastch(tempstr) = '\0';
+ *fg = 0; /* fix compiler warning */
/* get foreground and background */
View
1  gnu/usr.bin/sort/getopt.c
@@ -39,6 +39,7 @@
#endif
#include <stdio.h>
+#include <string.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
View
5 lib/libc/gen/nlist.c
@@ -256,11 +256,13 @@ __elf_fdnlist(int fd, struct nlist *list)
/* calculate section header table size */
shdr_size = ehdr.e_shentsize * ehdr.e_shnum;
+#ifndef __amd64__
/* Make sure it's not too big to mmap */
if (shdr_size > SIZE_T_MAX) {
errno = EFBIG;
return (-1);
}
+#endif
/* mmap section header table */
base = mmap(NULL, (size_t)shdr_size, PROT_READ, 0, fd,
@@ -285,11 +287,14 @@ __elf_fdnlist(int fd, struct nlist *list)
}
}
+#ifndef __amd64__
/* Check for files too large to mmap. */
if (symstrsize > SIZE_T_MAX) {
errno = EFBIG;
goto done;
}
+#endif
+
/*
* Map string table into our address space. This gives us
* an easy way to randomly access all the strings, without
View
2  lib/libc_r/uthread/uthread_sig.c
@@ -283,7 +283,7 @@ thread_sig_invoke_handler(int sig, siginfo_t *info, ucontext_t *ucp)
(info == NULL))
(*(sigfunc))(sig, info, ucp);
else
- (*(sigfunc))(sig, (siginfo_t *)info->si_code, ucp);
+ (*(sigfunc))(sig, (siginfo_t *)(intptr_t)info->si_code, ucp);
}
/*
* Only restore the signal mask if it hasn't been changed by the
View
21 lib/libcompat/4.3/rexec.c
@@ -136,7 +136,7 @@ token(void)
}
static int
-ruserpass(char *host, char **aname, char **apass, char **aacct)
+ruserpass(char *host, const char **aname, const char **apass, char **aacct)
{
char *hdir, buf[BUFSIZ], *tmp;
char myname[MAXHOSTNAMELEN], *mydomain;
@@ -189,9 +189,11 @@ ruserpass(char *host, char **aname, char **apass, char **aacct)
case LOGIN:
if (token())
- if (*aname == 0) {
- *aname = malloc((unsigned) strlen(tokval) + 1);
- (void) strcpy(*aname, tokval);
+ if (*aname == NULL) {
+ char *tmp;
+ tmp = malloc(strlen(tokval) + 1);
+ strcpy(tmp, tokval);
+ *aname = tmp;
} else {
if (strcmp(*aname, tokval))
goto next;
@@ -206,8 +208,10 @@ ruserpass(char *host, char **aname, char **apass, char **aacct)
goto bad;
}
if (token() && *apass == 0) {
- *apass = malloc((unsigned) strlen(tokval) + 1);
- (void) strcpy(*apass, tokval);
+ char *tmp;
+ tmp = malloc(strlen(tokval) + 1);
+ strcpy(tmp, tokval);
+ *apass = tmp;
}
break;
case ACCOUNT:
@@ -312,7 +316,8 @@ rexec_af(char **ahost, int rport, const char *name, const char *pass,
servbuff[sizeof(servbuff) - 1] = '\0';
memset(&hints, '\0', sizeof(hints));
- hints.ai_family = af;
+ if (af)
+ hints.ai_family = *af;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME;
gai = getaddrinfo(*ahost, servbuff, &hints, &res0);
@@ -431,7 +436,7 @@ rexec_af(char **ahost, int rport, const char *name, const char *pass,
int
-rexec(char **ahost, int rport, char *name, char *pass, char *cmd, int *fd2p)
+rexec(char **ahost, int rport, const char *name, const char *pass, char *cmd, int *fd2p)
{
struct sockaddr_in sin, sin2, from;
struct hostent *hp;
View
6 lib/libncp/ncpl_conn.c
@@ -274,7 +274,8 @@ ncp_li_check(struct ncp_conn_loginfo *li) {
int
ncp_conn_cnt(void) {
- int error, cnt = 0, len = sizeof(cnt);
+ int error, cnt = 0;
+ size_t len = sizeof(cnt);
error = sysctlbyname("net.ncp.conn_cnt", &cnt, &len, NULL, 0);
if (error) cnt = 0;
@@ -382,7 +383,8 @@ ncp_li_arg(struct ncp_conn_loginfo *li, int opt, char *arg) {
void *
ncp_conn_list(void) {
- int error, cnt = 0, len;
+ int error, cnt = 0;
+ size_t len;
void *p;
cnt = ncp_conn_cnt();
View
5 lib/libncp/ncpl_subr.c
@@ -213,8 +213,9 @@ NWRequest(NWCONN_HANDLE cH, nuint16 fn,
int
ncp_initlib(void){
int error;
- int len = sizeof(sysentoffset);
- int kv, kvlen = sizeof(kv);
+ size_t len = sizeof(sysentoffset);
+ int kv;
+ size_t kvlen = sizeof(kv);
static int ncp_initialized;
if (ncp_initialized)
View
2  lib/libsctp/sctp_sys_calls.c
@@ -260,7 +260,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
&asoc, &siz) != 0) {
return(-1);
}
- siz = (unsigned int)asoc;
+ siz = (unsigned int)(uintptr_t)asoc;
siz += sizeof(struct sctp_getaddresses);
addrs = calloc((unsigned long)1, (unsigned long)siz);
if (addrs == NULL) {
View
2  lib/libthread_xu/thread/thr_private.h
@@ -339,7 +339,7 @@ struct pthread {
long terminated;
/* Kernel thread id. */
- long tid;
+ lwpid_t tid;
/* Internal condition variable cycle number. */
umtx_t cycle;
View
14 libexec/rtld-elf/debug.c
@@ -39,7 +39,7 @@
static const char rel_header[] =
" symbol name r_info r_offset st_value st_size address value\n"
" ------------------------------------------------------------------------------\n";
-static const char rel_format[] = " %-25s %6x %08x %08x %7d %10p %08x\n";
+static const char rel_format[] = " %-25s %6lx %08lx %08lx %7ld %10p %08lx\n";
int debug = 0;
@@ -114,9 +114,9 @@ dump_Elf_Rel (Obj_Entry *obj, const Elf_Rel *rel0, u_long relsize)
sym = obj->symtab + ELF_R_SYM(rel->r_info);
printf(rel_format,
obj->strtab + sym->st_name,
- rel->r_info, rel->r_offset,
- sym->st_value, sym->st_size,
- dstaddr, *dstaddr);
+ (long)rel->r_info, (long)rel->r_offset,
+ (long)sym->st_value, (long)sym->st_size,
+ dstaddr, (long)*dstaddr);
}
return;
}
@@ -136,9 +136,9 @@ dump_Elf_Rela (Obj_Entry *obj, const Elf_Rela *rela0, u_long relasize)
sym = obj->symtab + ELF_R_SYM(rela->r_info);
printf(rel_format,
obj->strtab + sym->st_name,
- rela->r_info, rela->r_offset,
- sym->st_value, sym->st_size,
- dstaddr, *dstaddr);
+ (long)rela->r_info, (long)rela->r_offset,
+ (long)sym->st_value, (long)sym->st_size,
+ dstaddr, (long)*dstaddr);
}
return;
}
View
6 sbin/camcontrol/camcontrol.c
@@ -3154,10 +3154,10 @@ scsiformat(struct cam_device *device, int argc, char **argv,
percentage = 10000 * val;
fprintf(stdout,
- "\rFormatting: %qd.%02qd %% "
+ "\rFormatting: %jd.%02jd %% "
"(%d/%d) done",
- percentage / (0x10000 * 100),
- (percentage / 0x10000) % 100,
+ (intmax_t)percentage / (0x10000 * 100),
+ (intmax_t)(percentage / 0x10000) % 100,
val, 0x10000);
fflush(stdout);
} else if ((quiet == 0)
View
2  sbin/camcontrol/util.c
@@ -115,7 +115,7 @@ arg_put(void *hook __unused, int letter, void *arg, int count, char *name)
{
case 'i':
case 'b':
- printf("%d ", (intptr_t)arg);
+ printf("%jd ", (intmax_t)(intptr_t)arg);
break;
case 'c':
View
9 sbin/diskinfo/diskinfo.c
@@ -98,10 +98,10 @@ void
dumppart(const char *path, struct partinfo *dpart)
{
printf("%-16s ", path);
- printf("blksize=%-4d off=%012llx size=%012llx ",
+ printf("blksize=%-4d off=%012jx size=%012jx ",
dpart->media_blksize,
- dpart->media_offset,
- dpart->media_size
+ (intmax_t)dpart->media_offset,
+ (intmax_t)dpart->media_size
);
if (dpart->media_size >= 100LL*1024*1024*1024) {
printf("%7.2f GB",
@@ -145,7 +145,8 @@ dumppart(const char *path, struct partinfo *dpart)
* note: rsvdlabel is inclusive of rsvdplat. i.e.
* they are not relative to each other.
*/
- printf(" reserved=%lld", dpart->reserved_blocks);
+ printf(" reserved=%jd",
+ (intmax_t)dpart->reserved_blocks);
}
}
printf("\n");
View
68 sbin/disklabel64/disklabel64.c
@@ -670,11 +670,12 @@ display(FILE *f, const struct disklabel64 *lp)
fprintf(f, "# Informational fields calculated from the above\n");
fprintf(f, "# All byte equivalent offsets must be aligned\n");
fprintf(f, "#\n");
- fprintf(f, "# boot space: %10llu bytes\n", lp->d_pbase - lp->d_bbase);
- fprintf(f, "# data space: %10llu blocks\t# %6.2f MB (%llu bytes)\n",
- (lp->d_pstop - lp->d_pbase) / blksize,
+ fprintf(f, "# boot space: %10ju bytes\n",
+ (intmax_t)(lp->d_pbase - lp->d_bbase));
+ fprintf(f, "# data space: %10ju blocks\t# %6.2f MB (%ju bytes)\n",
+ (intmax_t)(lp->d_pstop - lp->d_pbase) / blksize,
(double)(lp->d_pstop - lp->d_pbase) / 1024.0 / 1024.0,
- lp->d_pstop - lp->d_pbase);
+ (intmax_t)(lp->d_pstop - lp->d_pbase));
fprintf(f, "#\n");
uuid_to_string(&lp->d_stor_uuid, &str, NULL);
@@ -683,12 +684,12 @@ display(FILE *f, const struct disklabel64 *lp)
fprintf(f, "label: %.*s\n", (int)sizeof(lp->d_packname),
lp->d_packname);
- fprintf(f, "boot2 data base: 0x%012llx\n", lp->d_bbase);
- fprintf(f, "partitions data base: 0x%012llx\n", lp->d_pbase);
- fprintf(f, "partitions data stop: 0x%012llx\n", lp->d_pstop);
- fprintf(f, "backup label: 0x%012llx\n", lp->d_abase);
- fprintf(f, "total size: 0x%012llx\t# %6.2f MB\n",
- lp->d_total_size,
+ fprintf(f, "boot2 data base: 0x%012jx\n", (intmax_t)lp->d_bbase);
+ fprintf(f, "partitions data base: 0x%012jx\n", (intmax_t)lp->d_pbase);
+ fprintf(f, "partitions data stop: 0x%012jx\n", (intmax_t)lp->d_pstop);
+ fprintf(f, "backup label: 0x%012jx\n", (intmax_t)lp->d_abase);
+ fprintf(f, "total size: 0x%012jx\t# %6.2f MB\n",
+ (intmax_t)lp->d_total_size,
(double)lp->d_total_size / 1024.0 / 1024.0);
fprintf(f, "alignment: %u\n", lp->d_align);
fprintf(f, "display block size: %u\t# for partition display only\n",
@@ -710,11 +711,12 @@ display(FILE *f, const struct disklabel64 *lp)
if (pp->p_bsize % lp->d_align)
fprintf(f, "%10s ", "ILLEGAL");
else
- fprintf(f, "%10llu ", pp->p_bsize / blksize);
+ fprintf(f, "%10ju ", (intmax_t)pp->p_bsize / blksize);
if (pp->p_boffset % lp->d_align)
fprintf(f, "%10s ", "ILLEGAL");
else
- fprintf(f, "%10llu ", (pp->p_boffset - lp->d_pbase) / blksize);
+ fprintf(f, "%10ju ",
+ (intmax_t)(pp->p_boffset - lp->d_pbase) / blksize);
if (pp->p_fstype < FSMAXTYPES)
fprintf(f, "%8.8s", fstypenames[pp->p_fstype]);
else
@@ -1256,7 +1258,8 @@ checklabel(struct disklabel64 *lp)
return (1);
}
if (lp->d_pstop > lp->d_total_size) {
- printf("%012llx\n%012llx\n", lp->d_pstop, lp->d_total_size);
+ printf("%012jx\n%012jx\n",
+ (intmax_t)lp->d_pstop, (intmax_t)lp->d_total_size);
Warning("disklabel control info is beyond the total size");
return (1);
}
@@ -1336,9 +1339,9 @@ checklabel(struct disklabel64 *lp)
}
}
} else {
- fprintf(stderr,
- "%lld bytes available to give to '*' and '%%' partitions\n",
- free_space);
+ fprintf(stderr, "%jd bytes available to give to "
+ "'*' and '%%' partitions\n",
+ (intmax_t)free_space);
errors++;
/* fix? set all % partitions to size 0? */
}
@@ -1367,9 +1370,10 @@ checklabel(struct disklabel64 *lp)
seen_default_offset &&
pp->p_fstype != FS_VINUM) {
fprintf(stderr,
-"Offset 0x%012llx for partition %c overlaps previous partition which ends at 0x%012llx\n",
- pp->p_boffset, i + 'a',
- current_offset);
+"Offset 0x%012jx for partition %c overlaps previous partition which ends at 0x%012jx\n",
+ (intmax_t)pp->p_boffset,
+ i + 'a',
+ (intmax_t)current_offset);
fprintf(stderr,
"Labels with any *'s for offset must be in ascending order by sector\n");
errors++;
@@ -1380,9 +1384,9 @@ checklabel(struct disklabel64 *lp)
* partitions are out-of-order
*/
Warning(
-"Offset 0x%012llx for partition %c doesn't match expected value 0x%012llx",
+"Offset 0x%012jx for partition %c doesn't match expected value 0x%012jx",
pp->p_boffset, i + 'a',
- current_offset);
+ (intmax_t)current_offset);
}
}
current_offset = pp->p_boffset + pp->p_bsize;
@@ -1393,8 +1397,8 @@ checklabel(struct disklabel64 *lp)
part = 'a' + i;
pp = &lp->d_partitions[i];
if (pp->p_bsize == 0 && pp->p_boffset != 0)
- Warning("partition %c: size 0, but offset 0x%012llx",
- part, pp->p_boffset);
+ Warning("partition %c: size 0, but offset 0x%012jx",
+ part, (intmax_t)pp->p_boffset);
if (pp->p_bsize == 0) {
pp->p_boffset = 0;
continue;
@@ -1404,20 +1408,20 @@ checklabel(struct disklabel64 *lp)
if (pp->p_boffset < lp->d_pbase) {
fprintf(stderr,
- "partition %c: offset out of bounds (%lld)\n",
- part, pp->p_boffset - lp->d_pbase);
+ "partition %c: offset out of bounds (%jd)\n",
+ part, (intmax_t)(pp->p_boffset - lp->d_pbase));
errors++;
}
if (pp->p_boffset > lp->d_pstop) {
fprintf(stderr,
- "partition %c: offset out of bounds (%lld)\n",
- part, pp->p_boffset - lp->d_pbase);
+ "partition %c: offset out of bounds (%jd)\n",
+ part, (intmax_t)(pp->p_boffset - lp->d_pbase));
errors++;
}
if (pp->p_boffset + pp->p_bsize > lp->d_pstop) {
fprintf(stderr,
- "partition %c: size out of bounds (%lld)\n",
- part, pp->p_boffset - lp->d_pbase);
+ "partition %c: size out of bounds (%jd)\n",
+ part, (intmax_t)(pp->p_boffset - lp->d_pbase));
errors++;
}
@@ -1442,8 +1446,10 @@ checklabel(struct disklabel64 *lp)
part = 'a' + i;
pp = &lp->d_partitions[i];
if (pp->p_bsize || pp->p_boffset)
- Warning("unused partition %c: size 0x%012llx offset 0x%012llx",
- 'a' + i, pp->p_bsize, pp->p_boffset);
+ Warning("unused partition %c: size 0x%012jx "
+ "offset 0x%012jx",
+ 'a' + i, (intmax_t)pp->p_bsize,
+ (intmax_t)pp->p_boffset);
}
return (errors);
}
View
9 sbin/dumpfs/dumpfs.c
@@ -164,8 +164,9 @@ dumpfs(char *name)
printf("symlinklen %d\ttrackskew %d\tinterleave %d\tcontigsumsize %d\n",
afs.fs_maxsymlinklen, afs.fs_trackskew, afs.fs_interleave,
afs.fs_contigsumsize);
- printf("nindir\t%d\tinopb\t%d\tnspf\t%d\tmaxfilesize\t%qu\n",
- afs.fs_nindir, afs.fs_inopb, afs.fs_nspf, afs.fs_maxfilesize);
+ printf("nindir\t%d\tinopb\t%d\tnspf\t%d\tmaxfilesize\t%ju\n",
+ afs.fs_nindir, afs.fs_inopb, afs.fs_nspf,
+ (intmax_t)afs.fs_maxfilesize);
printf("sblkno\t%d\tcblkno\t%d\tiblkno\t%d\tdblkno\t%d\n",
afs.fs_sblkno, afs.fs_cblkno, afs.fs_iblkno, afs.fs_dblkno);
printf("sbsize\t%d\tcgsize\t%d\tcgoffset %d\tcgmask\t0x%08x\n",
@@ -259,10 +260,10 @@ dumpcg(char *name, int fd, int c)
warnx("%s: error reading cg", name);
return (1);
}
- printf("magic\t%x\ttell\t%qx\ttime\t%s",
+ printf("magic\t%x\ttell\t%jx\ttime\t%s",
afs.fs_postblformat == FS_42POSTBLFMT ?
((struct ocg *)&acg)->cg_magic : acg.cg_magic,
- cur, ctime((time_t *)&acg.cg_time));
+ (intmax_t)cur, ctime((time_t *)&acg.cg_time));
printf("cgx\t%d\tncyl\t%d\tniblk\t%d\tndblk\t%d\n",
acg.cg_cgx, acg.cg_ncyl, acg.cg_niblk, acg.cg_ndblk);
printf("nbfree\t%d\tndir\t%d\tnifree\t%d\tnffree\t%d\n",
View
4 sbin/fdisk/fdisk.c
@@ -501,10 +501,10 @@ print_part(int i)
part_mb *= secsize;
part_mb /= (1024 * 1024);
printf("sysid %d,(%s)\n", partp->dp_typ, get_type(partp->dp_typ));
- printf(" start %lu, size %lu (%lld Meg), flag %x%s\n",
+ printf(" start %lu, size %lu (%jd Meg), flag %x%s\n",
(u_long)partp->dp_start,
(u_long)partp->dp_size,
- (long long)part_mb,
+ (intmax_t)part_mb,
partp->dp_flag,
partp->dp_flag == ACTIVE ? " (active)" : "");
printf("\tbeg: cyl %d/ head %d/ sector %d;\n\tend: cyl %d/ head %d/ sector %d\n"
View
6 sbin/fsdb/fsdb.c
@@ -803,7 +803,7 @@ CMDFUNCSTART(chgroup)
}
int
-dotime(char *name, struct timespec *rts)
+dotime(char *name, int32_t *rts)
{
char *p, *val;
struct tm t;
@@ -852,8 +852,8 @@ dotime(char *name, struct timespec *rts)
warnx("date/time out of range");
return 1;
}
- rts->tv_sec = sec;
- rts->tv_nsec = nsec;
+ rts[0] = sec;
+ rts[1] = nsec;
return 0;
}
View
28 sbin/fsirand/fsirand.c
@@ -134,7 +134,8 @@ fsirand(char *device)
memset(&sbuf, 0, sizeof(sbuf));
sblock = (struct fs *)&sbuf;
if (lseek(devfd, SBOFF, SEEK_SET) == -1) {
- warn("can't seek to superblock (%qd) on %s", SBOFF, device);
+ warn("can't seek to superblock (%jd) on %s",
+ (intmax_t)SBOFF, device);
return (1);
}
if ((n = read(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
@@ -167,7 +168,7 @@ fsirand(char *device)
for (cg = 0; cg < sblock->fs_ncg; cg++) {
dblk = fsbtodb(sblock, cgsblock(sblock, cg));
if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
- warn("can't seek to %qd", (off_t)dblk * bsize);
+ warn("can't seek to %jd", (intmax_t)dblk * bsize);
return (1);
} else if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
warn("can't read backup superblock %d on %s: %s",
@@ -211,8 +212,8 @@ fsirand(char *device)
sblock->fs_id[1] = random();
if (lseek(devfd, SBOFF, SEEK_SET) == -1) {
- warn("can't seek to superblock (%qd) on %s", SBOFF,
- device);
+ warn("can't seek to superblock (%jd) on %s",
+ (intmax_t)SBOFF, device);
return (1);
}
if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
@@ -228,7 +229,8 @@ fsirand(char *device)
if ((sblock->fs_inodefmt >= FS_44INODEFMT) && !printonly) {
dblk = fsbtodb(sblock, cgsblock(sblock, cg));
if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
- warn("can't seek to %qd", (off_t)dblk * bsize);
+ warn("can't seek to %jd",
+ (intmax_t)dblk * bsize);
return (1);
} else if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
warn("can't read backup superblock %d on %s: %s",
@@ -241,7 +243,7 @@ fsirand(char *device)
/* Read in inodes, then print or randomize generation nums */
dblk = fsbtodb(sblock, ino_to_fsba(sblock, inumber));
if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
- warn("can't seek to %qd", (off_t)dblk * bsize);
+ warn("can't seek to %jd", (intmax_t)dblk * bsize);
return (1);
} else if ((n = read(devfd, inodebuf, ibufsize)) != ibufsize) {
warnx("can't read inodes: %s",
@@ -251,19 +253,21 @@ fsirand(char *device)
for (n = 0; n < sblock->fs_ipg; n++, inumber++) {
if (inumber >= ROOTINO) {
- if (printonly)
- printf("ino %lld gen %x\n", inumber,
- inodebuf[n].di_gen);
- else
+ if (printonly) {
+ printf("ino %jd gen %x\n",
+ (intmax_t)inumber,
+ inodebuf[n].di_gen);
+ } else {
inodebuf[n].di_gen = random();
+ }
}
}
/* Write out modified inodes */
if (!printonly) {
if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
- warn("can't seek to %qd",
- (off_t)dblk * bsize);
+ warn("can't seek to %jd",
+ (intmax_t)dblk * bsize);
return (1);
} else if ((n = write(devfd, inodebuf, ibufsize)) !=
ibufsize) {
View
4 sbin/growfs/growfs.c
@@ -2075,8 +2075,8 @@ main(int argc, char **argv)
sblock.fs_size = dbtofsb(&osblock, pinfo.media_blocks);
if (size != 0) {
if (size > pinfo.media_blocks){
- errx(1, "There is not enough space (%llu < %d)",
- pinfo.media_blocks, size);
+ errx(1, "There is not enough space (%ju < %d)",
+ (intmax_t)pinfo.media_blocks, size);
}
sblock.fs_size = dbtofsb(&osblock, size);
}
View
17 sbin/hammer/cmd_blockmap.c
@@ -73,8 +73,10 @@ dump_blockmap(const char *label, int zone)
rootmap = &root_volume->ondisk->vol0_blockmap[zone];
assert(rootmap->phys_offset != 0);
- printf("zone %-16s next %016llx alloc %016llx\n",
- label, rootmap->next_offset, rootmap->alloc_offset);
+ printf("zone %-16s next %016jx alloc %016jx\n",
+ label,
+ (uintmax_t)rootmap->next_offset,
+ (uintmax_t)rootmap->alloc_offset);
for (scan1 = HAMMER_ZONE_ENCODE(zone, 0);
scan1 < HAMMER_ZONE_ENCODE(zone, HAMMER_OFF_LONG_MASK);
@@ -92,8 +94,11 @@ dump_blockmap(const char *label, int zone)
layer1->phys_offset == HAMMER_BLOCKMAP_UNAVAIL) {
continue;
}
- printf("%c layer1 %016llx @%016llx blocks-free %lld\n",
- xerr, scan1, layer1->phys_offset, layer1->blocks_free);
+ printf("%c layer1 %016jx @%016jx blocks-free %jd\n",
+ xerr,
+ (uintmax_t)scan1,
+ (uintmax_t)layer1->phys_offset,
+ (intmax_t)layer1->blocks_free);
if (layer1->phys_offset == HAMMER_BLOCKMAP_FREE)
continue;
for (scan2 = scan1;
@@ -109,9 +114,9 @@ dump_blockmap(const char *label, int zone)
xerr = ' ';
if (layer2->entry_crc != crc32(layer2, HAMMER_LAYER2_CRCSIZE))
xerr = 'B';
- printf("%c %016llx zone=%d app=%-7d free=%-7d\n",
+ printf("%c %016jx zone=%d app=%-7d free=%-7d\n",
xerr,
- scan2,
+ (uintmax_t)scan2,
layer2->zone,
layer2->append_off,
layer2->bytes_free);
View
12 sbin/hammer/cmd_history.c
@@ -96,16 +96,16 @@ hammer_do_history(const char *path, off_t off, int len)
}
status = ((hist.head.flags & HAMMER_IOC_HISTORY_UNSYNCED) ?
"dirty" : "clean");
- printf("%016llx %s {\n", hist.obj_id, status);
+ printf("%016jx %s {\n", (uintmax_t)hist.obj_id, status);
for (;;) {
for (i = 0; i < hist.count; ++i) {
char *hist_path = NULL;
- asprintf(&hist_path, "%s@@0x%016llx",
- path, hist.hist_ary[i].tid);
- printf(" %016llx %s",
- hist.hist_ary[i].tid,
- timestr32(hist.hist_ary[i].time32));
+ asprintf(&hist_path, "%s@@0x%016jx",
+ path, (uintmax_t)hist.hist_ary[i].tid);
+ printf(" %016jx %s",
+ (uintmax_t)hist.hist_ary[i].tid,
+ timestr32(hist.hist_ary[i].time32));
if (off >= 0) {
if (VerboseOpt) {
printf(" '");
View
20 sbin/hammer/cmd_info.c
@@ -99,18 +99,24 @@ void show_info(char *path) {
usedbigblocks = info.bigblocks - info.freebigblocks;
fprintf(stdout, "Big block information\n");
- fprintf(stdout, "\tTotal\t %lld\n", info.bigblocks);
- fprintf(stdout, "\tUsed\t %lld (%.2lf%%)\n\tReserved %lld (%.2lf%%)\n\tFree\t %lld (%.2lf%%)\n",
- usedbigblocks, percent(usedbigblocks, info.bigblocks),
- info.rsvbigblocks, percent(info.rsvbigblocks, info.bigblocks),
- (info.freebigblocks - info.rsvbigblocks),
- percent(info.freebigblocks - info.rsvbigblocks, info.bigblocks));
+ fprintf(stdout, "\tTotal\t %jd\n", (intmax_t)info.bigblocks);
+ fprintf(stdout, "\tUsed\t %jd (%.2lf%%)\n\tReserved "
+ "%jd (%.2lf%%)\n\tFree\t "
+ "%jd (%.2lf%%)\n",
+ (intmax_t)usedbigblocks,
+ percent(usedbigblocks, info.bigblocks),
+ (intmax_t)info.rsvbigblocks,
+ percent(info.rsvbigblocks, info.bigblocks),
+ (intmax_t)(info.freebigblocks - info.rsvbigblocks),
+ percent(info.freebigblocks - info.rsvbigblocks,
+ info.bigblocks));
fprintf(stdout, "Space information\n");
/* Space information */
bytes = (info.bigblocks << HAMMER_LARGEBLOCK_BITS);
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1), bytes, "", HN_AUTOSCALE, HN_DECIMAL | HN_NOSPACE | HN_B);
- fprintf(stdout, "\tTotal size %6s (%lld bytes)\n", buf, bytes);
+ fprintf(stdout, "\tTotal size %6s (%jd bytes)\n",
+ buf, (intmax_t)bytes);
bytes = (usedbigblocks << HAMMER_LARGEBLOCK_BITS);
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1), bytes, "", HN_AUTOSCALE, HN_DECIMAL | HN_NOSPACE | HN_B);
View
89 sbin/hammer/cmd_mirror.c
@@ -203,12 +203,12 @@ hammer_cmd_mirror_read(char **av, int ac, int streaming)
if (streaming == 0 || VerboseOpt >= 2) {
fprintf(stderr,
- "Mirror-read: Mirror from %016llx to %016llx\n",
- mirror.tid_beg, mirror.tid_end);
+ "Mirror-read: Mirror from %016jx to %016jx\n",
+ (uintmax_t)mirror.tid_beg, (uintmax_t)mirror.tid_end);
}
if (mirror.key_beg.obj_id != (int64_t)HAMMER_MIN_OBJID) {
- fprintf(stderr, "Mirror-read: Resuming at object %016llx\n",
- mirror.key_beg.obj_id);
+ fprintf(stderr, "Mirror-read: Resuming at object %016jx\n",
+ (uintmax_t)mirror.key_beg.obj_id);
}
/*
@@ -260,11 +260,11 @@ hammer_cmd_mirror_read(char **av, int ac, int streaming)
total_bytes += mirror.count;
if (streaming && VerboseOpt) {
fprintf(stderr,
- "\robj=%016llx tids=%016llx:%016llx %11lld",
- (long long)mirror.key_cur.obj_id,
- (long long)mirror.tid_beg,
- (long long)mirror.tid_end,
- total_bytes);
+ "\robj=%016jx tids=%016jx:%016jx %11jd",
+ (uintmax_t)mirror.key_cur.obj_id,
+ (uintmax_t)mirror.tid_beg,
+ (uintmax_t)mirror.tid_end,
+ (intmax_t)total_bytes);
fflush(stderr);
}
mirror.key_beg = mirror.key_cur;
@@ -276,9 +276,9 @@ hammer_cmd_mirror_read(char **av, int ac, int streaming)
(unsigned)(time(NULL) - base_t) > (unsigned)TimeoutOpt) {
fprintf(stderr,
"Mirror-read %s interrupted by timer at"
- " %016llx\n",
+ " %016jx\n",
filesystem,
- mirror.key_cur.obj_id);
+ (uintmax_t)mirror.key_cur.obj_id);
interrupted = 1;
break;
}
@@ -323,8 +323,9 @@ hammer_cmd_mirror_read(char **av, int ac, int streaming)
if (CyclePath) {
hammer_key_beg_init(&mirror.key_beg);
hammer_set_cycle(&mirror.key_beg, sync_tid);
- fprintf(stderr, "Cyclefile %s updated to 0x%016llx\n",
- CyclePath, sync_tid);
+ fprintf(stderr,
+ "Cyclefile %s updated to 0x%016jx\n",
+ CyclePath, (uintmax_t)sync_tid);
}
}
} else if (CyclePath) {
@@ -424,11 +425,11 @@ generate_histogram(int fd, const char *filesystem,
mirror.tid_end = tid_half;
if (VerboseOpt > 1) {
- fprintf(stderr, "RangeTest %016llx/%016llx - %016llx (%lld) ",
- (long long)tid_beg,
- (long long)tid_end,
- (long long)tid_half,
- (long long)(tid_half - tid_beg));
+ fprintf(stderr, "RangeTest %016jx/%016jx - %016jx (%jd) ",
+ (uintmax_t)tid_beg,
+ (uintmax_t)tid_end,
+ (uintmax_t)tid_half,
+ (intmax_t)(tid_half - tid_beg));
}
fflush(stderr);
if (ioctl(fd, HAMMERIOC_MIRROR_READ, &mirror) < 0) {
@@ -708,8 +709,8 @@ hammer_cmd_mirror_write(char **av, int ac)
write_mrecord(1, HAMMER_MREC_TYPE_UPDATE,
&mrec_tmp, sizeof(mrec_tmp.update));
} else {
- printf("Source can update synctid to 0x%016llx\n",
- mirror.tid_end);
+ printf("Source can update synctid to 0x%016jx\n",
+ (uintmax_t)mirror.tid_end);
}
relpfs(fd, &pfs);
goto again;
@@ -753,10 +754,10 @@ hammer_cmd_mirror_dump(void)
switch(mrec->head.type & HAMMER_MRECF_TYPE_MASK) {
case HAMMER_MREC_TYPE_REC_BADCRC:
case HAMMER_MREC_TYPE_REC:
- printf("Record obj=%016llx key=%016llx "
+ printf("Record obj=%016jx key=%016jx "
"rt=%02x ot=%02x",
- mrec->rec.leaf.base.obj_id,
- mrec->rec.leaf.base.key,
+ (uintmax_t)mrec->rec.leaf.base.obj_id,
+ (uintmax_t)mrec->rec.leaf.base.key,
mrec->rec.leaf.base.rec_type,
mrec->rec.leaf.base.obj_type);
if (mrec->head.type ==
@@ -764,31 +765,31 @@ hammer_cmd_mirror_dump(void)
printf(" (BAD CRC)");
}
printf("\n");
- printf(" tids %016llx:%016llx data=%d\n",
- mrec->rec.leaf.base.create_tid,
- mrec->rec.leaf.base.delete_tid,
- mrec->rec.leaf.data_len);
+ printf(" tids %016jx:%016jx data=%d\n",
+ (uintmax_t)mrec->rec.leaf.base.create_tid,
+ (uintmax_t)mrec->rec.leaf.base.delete_tid,
+ mrec->rec.leaf.data_len);
break;
case HAMMER_MREC_TYPE_PASS:
- printf("Pass obj=%016llx key=%016llx "
+ printf("Pass obj=%016jx key=%016jx "
"rt=%02x ot=%02x\n",
- mrec->rec.leaf.base.obj_id,
- mrec->rec.leaf.base.key,
+ (uintmax_t)mrec->rec.leaf.base.obj_id,
+ (uintmax_t)mrec->rec.leaf.base.key,
mrec->rec.leaf.base.rec_type,
mrec->rec.leaf.base.obj_type);
- printf(" tids %016llx:%016llx data=%d\n",
- mrec->rec.leaf.base.create_tid,
- mrec->rec.leaf.base.delete_tid,
+ printf(" tids %016jx:%016jx data=%d\n",
+ (uintmax_t)mrec->rec.leaf.base.create_tid,
+ (uintmax_t)mrec->rec.leaf.base.delete_tid,
mrec->rec.leaf.data_len);
break;
case HAMMER_MREC_TYPE_SKIP:
- printf("Skip obj=%016llx key=%016llx rt=%02x to\n"
- " obj=%016llx key=%016llx rt=%02x\n",
- mrec->skip.skip_beg.obj_id,
- mrec->skip.skip_beg.key,
+ printf("Skip obj=%016jx key=%016jx rt=%02x to\n"
+ " obj=%016jx key=%016jx rt=%02x\n",
+ (uintmax_t)mrec->skip.skip_beg.obj_id,
+ (uintmax_t)mrec->skip.skip_beg.key,
mrec->skip.skip_beg.rec_type,
- mrec->skip.skip_end.obj_id,
- mrec->skip.skip_end.key,
+ (uintmax_t)mrec->skip.skip_end.obj_id,
+ (uintmax_t)mrec->skip.skip_end.key,
mrec->skip.skip_end.rec_type);
default:
break;
@@ -1070,9 +1071,9 @@ read_mrecords(int fd, char *buf, u_int size, hammer_ioc_mrecord_head_t pickup)
hammer_crc_test_leaf(&mrec->rec + 1, &mrec->rec.leaf) == 0) {
fprintf(stderr,
"read_mrecords: data_crc did not "
- "match data! obj=%016llx key=%016llx\n",
- mrec->rec.leaf.base.obj_id,
- mrec->rec.leaf.base.key);
+ "match data! obj=%016jx key=%016jx\n",
+ (uintmax_t)mrec->rec.leaf.base.obj_id,
+ (uintmax_t)mrec->rec.leaf.base.key);
fprintf(stderr,
"continuing, but there are problems\n");
}
@@ -1315,8 +1316,8 @@ update_pfs_snapshot(int fd, hammer_tid_t snapshot_tid, int pfs_id)
if (VerboseOpt >= 2) {
fprintf(stderr,
"Mirror-write: Completed, updated snapshot "
- "to %016llx\n",
- snapshot_tid);
+ "to %016jx\n",
+ (uintmax_t)snapshot_tid);
}
}
}
View
8 sbin/hammer/cmd_pseudofs.c
@@ -50,7 +50,7 @@ static int timetosecs(char *str);
int
getpfs(struct hammer_ioc_pseudofs_rw *pfs, const char *path)
{
- hammer_tid_t dummy_tid;
+ uintmax_t dummy_tid;
struct stat st;
char *dirpath;
char buf[64];
@@ -113,7 +113,7 @@ getpfs(struct hammer_ioc_pseudofs_rw *pfs, const char *path)
fd = open(dirpath, O_RDONLY);
goto done;
}
- if (sscanf(buf, "@@%llx:%d", &dummy_tid, &pfs->pfs_id) == 2) {
+ if (sscanf(buf, "@@%jx:%d", &dummy_tid, &pfs->pfs_id) == 2) {
fd = open(dirpath, O_RDONLY);
goto done;
}
@@ -473,8 +473,8 @@ dump_pfsd(hammer_pseudofs_data_t pfsd)
u_int32_t status;
char *str = NULL;
- printf(" sync-beg-tid=0x%016llx\n", pfsd->sync_beg_tid);
- printf(" sync-end-tid=0x%016llx\n", pfsd->sync_end_tid);
+ printf(" sync-beg-tid=0x%016jx\n", (uintmax_t)pfsd->sync_beg_tid);
+ printf(" sync-end-tid=0x%016jx\n", (uintmax_t)pfsd->sync_end_tid);
uuid_to_string(&pfsd->shared_uuid, &str, &status);
printf(" shared-uuid=%s\n", str);
uuid_to_string(&pfsd->unique_uuid, &str, &status);
View
24 sbin/hammer/cmd_rebalance.c
@@ -69,8 +69,8 @@ hammer_cmd_rebalance(char **av, int ac)
if (perc < 50 || perc > 100)
rebalance_usage(1);
}
- printf("rebalance start %016llx:%04x\n",
- rebal.key_beg.obj_id,
+ printf("rebalance start %016jx:%04x\n",
+ (uintmax_t)rebal.key_beg.obj_id,
rebal.key_beg.localization);
fd = open(filesystem, O_RDONLY);
@@ -81,9 +81,9 @@ hammer_cmd_rebalance(char **av, int ac)
printf("Rebalance %s failed: %s\n",
filesystem, strerror(errno));
} else if (rebal.head.flags & HAMMER_IOC_HEAD_INTR) {
- printf("Rebalance %s interrupted by timer at %016llx:%04x\n",
+ printf("Rebalance %s interrupted by timer at %016jx:%04x\n",
filesystem,
- rebal.key_cur.obj_id,
+ (uintmax_t)rebal.key_cur.obj_id,
rebal.key_cur.localization);
if (CyclePath) {
hammer_set_cycle(&rebal.key_cur, 0);
@@ -96,14 +96,14 @@ hammer_cmd_rebalance(char **av, int ac)
RunningIoctl = 0;
close(fd);
printf("Rebalance:\n"
- " %lld btree nodes scanned\n"
- " %lld btree nodes deleted\n"
- " %lld collision retries\n"
- " %lld btree nodes rebalanced\n",
- rebal.stat_ncount,
- rebal.stat_deletions,
- rebal.stat_collisions,
- rebal.stat_nrebal
+ " %jd btree nodes scanned\n"
+ " %jd btree nodes deleted\n"
+ " %jd collision retries\n"
+ " %jd btree nodes rebalanced\n",
+ (intmax_t)rebal.stat_ncount,
+ (intmax_t)rebal.stat_deletions,
+ (intmax_t)rebal.stat_collisions,
+ (intmax_t)rebal.stat_nrebal
);
}
View
21 sbin/hammer/cmd_reblock.c
@@ -94,8 +94,8 @@ hammer_cmd_reblock(char **av, int ac, int flags)
reblock.free_level = HAMMER_LARGEBLOCK_SIZE - reblock.free_level;
if (reblock.free_level < 0)
reblock.free_level = 0;
- printf("reblock start %016llx:%04x free level %d\n",
- reblock.key_beg.obj_id,
+ printf("reblock start %016jx:%04x free level %d\n",
+ (uintmax_t)reblock.key_beg.obj_id,
reblock.key_beg.localization,
reblock.free_level);
@@ -106,9 +106,9 @@ hammer_cmd_reblock(char **av, int ac, int flags)
if (ioctl(fd, HAMMERIOC_REBLOCK, &reblock) < 0) {
printf("Reblock %s failed: %s\n", filesystem, strerror(errno));
} else if (reblock.head.flags & HAMMER_IOC_HEAD_INTR) {
- printf("Reblock %s interrupted by timer at %016llx:%04x\n",
+ printf("Reblock %s interrupted by timer at %016jx:%04x\n",
filesystem,
- reblock.key_cur.obj_id,
+ (uintmax_t)reblock.key_cur.obj_id,
reblock.key_cur.localization);
if (CyclePath) {
hammer_set_cycle(&reblock.key_cur, 0);
@@ -121,12 +121,13 @@ hammer_cmd_reblock(char **av, int ac, int flags)
RunningIoctl = 0;
close(fd);
printf("Reblocked:\n"
- " %lld/%lld btree nodes\n"
- " %lld/%lld data elements\n"
- " %lld/%lld data bytes\n",
- reblock.btree_moves, reblock.btree_count,
- reblock.data_moves, reblock.data_count,
- reblock.data_byte_moves, reblock.data_byte_count
+ " %jd/%jd btree nodes\n"
+ " %jd/%jd data elements\n"
+ " %jd/%jd data bytes\n",
+ (intmax_t)reblock.btree_moves, (intmax_t)reblock.btree_count,
+ (intmax_t)reblock.data_moves, (intmax_t)reblock.data_count,
+ (intmax_t)reblock.data_byte_moves,
+ (intmax_t)reblock.data_byte_count
);
}
View
69 sbin/hammer/cmd_show.c
@@ -74,15 +74,15 @@ hammer_cmd_show(hammer_off_t node_offset, u_int32_t lo, int64_t obj_id,
volume = get_volume(RootVolNo);
node_offset = volume->ondisk->vol0_btree_root;
if (QuietOpt < 3) {
- printf("Volume header\trecords=%lld next_tid=%016llx\n",
- volume->ondisk->vol0_stat_records,
- volume->ondisk->vol0_next_tid);
- printf("\t\tbufoffset=%016llx\n",
- volume->ondisk->vol_buf_beg);
+ printf("Volume header\trecords=%jd next_tid=%016jx\n",
+ (intmax_t)volume->ondisk->vol0_stat_records,
+ (uintmax_t)volume->ondisk->vol0_next_tid);
+ printf("\t\tbufoffset=%016jx\n",
+ (uintmax_t)volume->ondisk->vol_buf_beg);
for (zone = 0; zone < HAMMER_MAX_ZONES; ++zone) {
- printf("\t\tzone %d\tnext_offset=%016llx\n",
+ printf("\t\tzone %d\tnext_offset=%016jx\n",
zone,
- volume->ondisk->vol0_blockmap[zone].next_offset
+ (uintmax_t)volume->ondisk->vol0_blockmap[zone].next_offset
);
}
}
@@ -91,13 +91,13 @@ hammer_cmd_show(hammer_off_t node_offset, u_int32_t lo, int64_t obj_id,
if (lo == 0 && obj_id == (int64_t)HAMMER_MIN_OBJID) {
searchp = NULL;
- printf("show %016llx depth %d\n", node_offset, depth);
+ printf("show %016jx depth %d\n", (uintmax_t)node_offset, depth);
} else {
search.lo = lo;
search.obj_id = obj_id;
searchp = &search;
- printf("show %016llx lo %08x obj_id %016llx depth %d\n",
- node_offset, lo, (long long)obj_id, depth);
+ printf("show %016jx lo %08x obj_id %016jx depth %d\n",
+ (uintmax_t)node_offset, lo, (uintmax_t)obj_id, depth);
}
print_btree_node(node_offset, searchp, depth,
0, left_bound, right_bound);
@@ -127,12 +127,13 @@ print_btree_node(hammer_off_t node_offset, btree_search_t search,
badc = 'B';
if (spike == 0) {
- printf("%c NODE %016llx cnt=%02d p=%016llx "
+ printf("%c NODE %016jx cnt=%02d p=%016jx "
"type=%c depth=%d",
badc,
- node_offset, node->count, node->parent,
+ (uintmax_t)node_offset, node->count,
+ (uintmax_t)node->parent,
(node->type ? node->type : '?'), depth);
- printf(" mirror %016llx", node->mirror_tid);
+ printf(" mirror %016jx", (uintmax_t)node->mirror_tid);
if (QuietOpt < 3) {
printf(" fill=");
print_bigblock_fill(node_offset);
@@ -239,22 +240,25 @@ print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
printf("%s\t%s %2d %c ",
flagstr, label, i,
(elm->base.btype ? elm->base.btype : '?'));
- printf("obj=%016llx key=%016llx lo=%08x rt=%02x ot=%02x\n",
- elm->base.obj_id,
- elm->base.key,
+ printf("obj=%016jx key=%016jx lo=%08x rt=%02x ot=%02x\n",
+ (uintmax_t)elm->base.obj_id,
+ (uintmax_t)elm->base.key,
elm->base.localization,
elm->base.rec_type,
elm->base.obj_type);
- printf("\t %c tids %016llx:%016llx ",
+ printf("\t %c tids %016jx:%016jx ",
(elm->base.delete_tid ? 'd' : ' '),
- elm->base.create_tid,
- elm->base.delete_tid);
+ (uintmax_t)elm->base.create_tid,
+ (uintmax_t)elm->base.delete_tid);
switch(type) {
case HAMMER_BTREE_TYPE_INTERNAL:
- printf("suboff=%016llx", elm->internal.subtree_offset);
- if (QuietOpt < 3)
- printf(" mirror %016llx", elm->internal.mirror_tid);
+ printf("suboff=%016jx",
+ (uintmax_t)elm->internal.subtree_offset);
+ if (QuietOpt < 3) {
+ printf(" mirror %016jx",
+ (uintmax_t)elm->internal.mirror_tid);
+ }
if (ext)
printf(" %s", ext);
break;
@@ -267,8 +271,9 @@ print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type,
printf("\n%s\t ", check_data_crc(elm));
else
printf("\n\t ");
- printf("dataoff=%016llx/%d",
- elm->leaf.data_offset, elm->leaf.data_len);
+ printf("dataoff=%016jx/%d",
+ (uintmax_t)elm->leaf.data_offset,
+ elm->leaf.data_len);
if (QuietOpt < 3) {
printf(" crc=%04x", elm->leaf.data_crc);
printf("\n\t fills=");
@@ -433,26 +438,28 @@ print_record(hammer_btree_elm_t elm)
switch(elm->leaf.base.rec_type) {
case HAMMER_RECTYPE_INODE:
printf("\n%17s", "");
- printf("size=%lld nlinks=%lld",
- data->inode.size, data->inode.nlinks);
+ printf("size=%jd nlinks=%jd",
+ (intmax_t)data->inode.size,
+ (intmax_t)data->inode.nlinks);
if (QuietOpt < 1) {
printf(" mode=%05o uflags=%08x\n",
data->inode.mode,
data->inode.uflags);
printf("%17s", "");
- printf("ctime=%016llx pobjid=%016llx obj_type=%d\n",
- data->inode.ctime, data->inode.parent_obj_id,
+ printf("ctime=%016jx pobjid=%016jx obj_type=%d\n",
+ (uintmax_t)data->inode.ctime,
+ (uintmax_t)data->inode.parent_obj_id,
data->inode.obj_type);
printf("%17s", "");
- printf("mtime=%016llx", data->inode.mtime);
+ printf("mtime=%016jx", (uintmax_t)data->inode.mtime);
printf(" caps=%02x", data->inode.cap_flags);
}
break;
case HAMMER_RECTYPE_DIRENTRY:
printf("\n%17s", "");
data_len -= HAMMER_ENTRY_NAME_OFF;
- printf("dir-entry ino=%016llx lo=%08x name=\"%*.*s\"",
- data->entry.obj_id,
+ printf("dir-entry ino=%016jx lo=%08x name=\"%*.*s\"",
+ (uintmax_t)data->entry.obj_id,
data->entry.localization,
data_len, data_len, data->entry.name);
break;
View
2  sbin/hammer/cmd_snapshot.c
@@ -136,7 +136,7 @@ hammer_cmd_snapshot(char **av, int ac)
err(2, "Synctid %s failed", filesystem);
close(fd);
- asprintf(&from, "%s/@@0x%016llx", filesystem, synctid.tid);
+ asprintf(&from, "%s/@@0x%016jx", filesystem, (uintmax_t)synctid.tid);
if (from == NULL)
err(2, "Couldn't generate string");
View
25 sbin/hammer/cmd_softprune.c
@@ -171,12 +171,12 @@ hammer_cmd_softprune(char **av, int ac, int everything_opt)
continue;
}
- printf("Prune %s: objspace %016llx:%04x %016llx:%04x "
+ printf("Prune %s: objspace %016jx:%04x %016jx:%04x "
"pfs_id %d\n",
scan->filesystem,
- scan->prune.key_beg.obj_id,
+ (uintmax_t)scan->prune.key_beg.obj_id,
scan->prune.key_beg.localization,
- scan->prune.key_end.obj_id,
+ (uintmax_t)scan->prune.key_end.obj_id,
scan->prune.key_end.localization,
pfs.pfs_id);
printf("Prune %s: prune_min is %dd/%02d:%02d:%02d\n",
@@ -193,9 +193,9 @@ hammer_cmd_softprune(char **av, int ac, int everything_opt)
rcode = 2;
} else if (scan->prune.head.flags & HAMMER_IOC_HEAD_INTR) {
printf("Prune %s interrupted by timer at "
- "%016llx %04x\n",
+ "%016jx %04x\n",
scan->filesystem,
- scan->prune.key_cur.obj_id,
+ (uintmax_t)scan->prune.key_cur.obj_id,
scan->prune.key_cur.localization);
if (CyclePath)
hammer_set_cycle(&scan->prune.key_cur, 0);
@@ -205,12 +205,12 @@ hammer_cmd_softprune(char **av, int ac, int everything_opt)
hammer_reset_cycle();
printf("Prune %s succeeded\n", scan->filesystem);
}
- printf("Pruned %lld/%lld records (%lld directory entries) "
- "and %lld bytes\n",
- scan->prune.stat_rawrecords,
- scan->prune.stat_scanrecords,
- scan->prune.stat_dirrecords,
- scan->prune.stat_bytes
+ printf("Pruned %jd/%jd records (%jd directory entries) "
+ "and %jd bytes\n",
+ (uintmax_t)scan->prune.stat_rawrecords,
+ (uintmax_t)scan->prune.stat_scanrecords,
+ (uintmax_t)scan->prune.stat_dirrecords,
+ (uintmax_t)scan->prune.stat_bytes
);
RunningIoctl = 0;
close(fd);
@@ -484,7 +484,8 @@ hammer_softprune_finalize(struct softprune *scan)
for (i = 0; i < scan->prune.nelms; ++i) {
elm = &scan->prune.elms[i];
elm->mod_tid = elm->end_tid - elm->beg_tid;
- printf("TID %016llx - %016llx\n", elm->beg_tid, elm->end_tid);
+ printf("TID %016jx - %016jx\n",
+ (uintmax_t)elm->beg_tid, (uintmax_t)elm->end_tid);
}
}
View
31 sbin/hammer/cmd_stats.c
@@ -92,13 +92,13 @@ hammer_cmd_bstats(char **av, int ac)
if (count) {
if ((count & 15) == 1)
printf(" elements iterations lookups inserts deletes splits\n");
- printf("%10lld %10lld %10lld %10lld %10lld %10lld\n",
- stats[0] - copy[0],
- stats[1] - copy[1],
- stats[2] - copy[2],
- stats[3] - copy[3],
- stats[4] - copy[4],
- stats[5] - copy[5]);
+ printf("%10jd %10jd %10jd %10jd %10jd %10jd\n",
+ (intmax_t)(stats[0] - copy[0]),
+ (intmax_t)(stats[1] - copy[1]),
+ (intmax_t)(stats[2] - copy[2]),
+ (intmax_t)(stats[3] - copy[3]),
+ (intmax_t)(stats[4] - copy[4]),
+ (intmax_t)(stats[5] - copy[5]));
}
nanosleep(&delay, NULL);
bcopy(stats, copy, sizeof(stats));
@@ -164,14 +164,15 @@ hammer_cmd_iostats(char **av, int ac)
if (count) {
if ((count & 15) == 1)
printf(" file-rd file-wr dev-read dev-write inode_ops ino_flush commits\n");
- printf("%9lld %9lld %9lld %9lld %9lld %8lld %8lld\n",
- stats[0] - copy[0],
- stats[1] - copy[1],
- stats[2] - copy[2],
- stats[3] - copy[3],
- stats[4] + stats[5] - copy[4] - copy[5],
- stats[6] - copy[6],
- stats[7] - copy[7]);
+ printf("%9jd %9jd %9jd %9jd %9jd %8jd %8jd\n",
+ (intmax_t)(stats[0] - copy[0]),
+ (intmax_t)(stats[1] - copy[1]),
+ (intmax_t)(stats[2] - copy[2]),
+ (intmax_t)(stats[3] - copy[3]),
+ (intmax_t)(stats[4] + stats[5] -
+ copy[4] - copy[5]),
+ (intmax_t)(stats[6] - copy[6]),
+ (intmax_t)(stats[7] - copy[7]));
}
nanosleep(&delay, NULL);
bcopy(stats, copy, sizeof(stats));
View
2  sbin/hammer/cmd_synctid.c
@@ -66,7 +66,7 @@ hammer_cmd_synctid(char **av, int ac)
if (ioctl(fd, HAMMERIOC_SYNCTID, &synctid) < 0) {
fprintf(stderr, "Synctid %s failed: %s\n", filesystem, strerror(errno));
} else {
- printf("0x%016llx\n", synctid.tid);
+ printf("0x%016jx\n", (uintmax_t)synctid.tid);
}
close(fd);
}
View
2  sbin/hammer/cycle.c
@@ -49,7 +49,7 @@ hammer_get_cycle(hammer_base_elm_t base, hammer_tid_t *extra)
close(fd);
return;
}
- if (st.st_size < sizeof(*base)) {
+ if (st.st_size < (off_t)sizeof(*base)) {
fprintf(stderr, "cycle-file %s: clearing old version\n",
CyclePath);
close(fd);
View
10 sbin/hammer/hammer.c
@@ -229,7 +229,7 @@ main(int ac, char **av)
}
if (key == 0)
key |= 0x100000000LL;
- printf("0x%016llx\n", key);
+ printf("0x%016jx\n", (uintmax_t)key);
exit(0);
}
if (strcmp(av[0], "namekey1") == 0) {
@@ -240,7 +240,7 @@ main(int ac, char **av)
key = (int64_t)(crc32(av[1], strlen(av[1])) & 0x7FFFFFFF) << 32;
if (key == 0)
key |= 0x100000000LL;
- printf("0x%016llx\n", key);
+ printf("0x%016jx\n", (uintmax_t)key);
exit(0);
}
if (strcmp(av[0], "namekey32") == 0) {
@@ -378,12 +378,12 @@ main(int ac, char **av)
if (strcmp(av[0], "show") == 0) {
u_int32_t lo = 0;
- int64_t obj_id = (int64_t)HAMMER_MIN_OBJID;
+ intmax_t obj_id = (int64_t)HAMMER_MIN_OBJID;
hammer_parsedevs(blkdevs);
if (ac > 1)
- sscanf(av[1], "%08x:%llx", &lo, &obj_id);
- hammer_cmd_show(-1, lo, obj_id, 0, NULL, NULL);
+ sscanf(av[1], "%08x:%jx", &lo, &obj_id);
+ hammer_cmd_show(-1, lo, (int64_t)obj_id, 0, NULL, NULL);
exit(0);
}
if (strcmp(av[0], "blockmap") == 0) {
View
13 sbin/jscan/dump_debug.c
@@ -63,8 +63,9 @@ dump_debug_stream(struct jstream *js)
jsread(js, 0, &head, sizeof(head));
sid = head.streamid & JREC_STREAMID_MASK;
- printf("STREAM %04x %016llx {\n", (int)(u_int16_t)head.streamid,
- head.transid);
+ printf("STREAM %04x %016jx {\n",
+ (int)(u_int16_t)head.streamid,
+ (uintmax_t)head.transid);
if (sid >= JREC_STREAMID_JMIN && sid < JREC_STREAMID_JMAX) {
off_t off = sizeof(head);
@@ -108,7 +109,7 @@ dump_debug_subrecord(struct jstream *js, off_t *off, off_t recsize, int level)
break;
}
printf("%*.*s", level * 4, level * 4, "");
- printf("@%lld ", base);
+ printf("@%jd ", (intmax_t)base);
printf("RECORD %s [%04x/%d]", type_to_name(sub.rectype),
(int)(u_int16_t)sub.rectype, sub.recsize);
if (sub.recsize == -1) {
@@ -268,7 +269,7 @@ dump_debug_payload(int16_t rectype, struct jstream *js, off_t off,
printf(" %d", (int)*(const u_int32_t *)buf);
break;
case 8:
- printf(" %lld", (int64_t)*(const u_int64_t *)buf);
+ printf(" %jd", (intmax_t)*(const int64_t *)buf);
break;
default:
printf(" ?");
@@ -287,7 +288,7 @@ dump_debug_payload(int16_t rectype, struct jstream *js, off_t off,
printf(" 0x%08x", (int)*(const u_int32_t *)buf);
break;
case 8:
- printf(" 0x%016llx", (int64_t)*(const u_int64_t *)buf);
+ printf(" 0x%016jx", (uintmax_t)*(const u_int64_t *)buf);
break;
default:
printf(" ?");
@@ -306,7 +307,7 @@ dump_debug_payload(int16_t rectype, struct jstream *js, off_t off,
printf(" %011o", (int)*(const u_int32_t *)buf);
break;
case 8:
- printf(" %022llo", (int64_t)*(const u_int64_t *)buf);
+ printf(" %022jo", (intmax_t)*(const int64_t *)buf);
break;
default:
printf(" ?");
View
6 sbin/jscan/jfile.c
@@ -98,7 +98,7 @@ jopen_prefix(const char *prefix, int rw)
den->d_name[baselen] == '.'
) {
seq = strtoul(den->d_name + baselen + 1, &ptr, 16);
- if (*ptr == 0 && seq != ULONG_MAX) {
+ if (*ptr == 0 && seq != UINT_MAX) {
if (seq_beg == (unsigned int)-1 || seq_beg > seq)
seq_beg = seq;
if (seq_end == (unsigned int)-1 || seq_end < seq)
@@ -700,8 +700,8 @@ jseek(struct jfile *jf, int64_t transid, enum jdirection direction)
jd =jread(jf, jd, JD_FORWARDS);
}
if (verbose_opt > 1) {
- fprintf(stderr, "jseek returning seq %08x offset 0x%08llx\n",
- jd->jd_seq, jd->jd_pos);
+ fprintf(stderr, "jseek returning seq %08x offset 0x%08jx\n",
+ jd->jd_seq, (uintmax_t)jd->jd_pos);
}
return(jd);
}
View
12 sbin/jscan/jscan.c
@@ -269,16 +269,16 @@ main(int ac, char **av)
transid = 0;
if (verbose_opt) {
if (jmodes & JMODEF_OUTPUT) {
- fprintf(stderr, "Starting transid for OUTPUT: %016llx\n",
- output_transid);
+ fprintf(stderr, "Starting transid for OUTPUT: %016jx\n",
+ (uintmax_t)output_transid);
}
if (jmodes & JMODEF_MIRROR) {
- fprintf(stderr, "Starting transid for MIRROR: %016llx\n",
- mirror_transid);
+ fprintf(stderr, "Starting transid for MIRROR: %016jx\n",
+ (uintmax_t)mirror_transid);
}