Module Name:    src
Committed By:   manu
Date:           Wed Sep  1 14:57:24 UTC 2010

Modified Files:
        src/lib/libperfuse: ops.c perfuse_if.h perfuse_priv.h subr.c
        src/usr.sbin/perfused: msg.c perfused.c

Log Message:
Build fixes for LP64


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libperfuse/perfuse_if.h \
    src/lib/libperfuse/perfuse_priv.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libperfuse/subr.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/perfused/msg.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/perfused/perfused.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.4 src/lib/libperfuse/ops.c:1.5
--- src/lib/libperfuse/ops.c:1.4	Sat Aug 28 03:46:21 2010
+++ src/lib/libperfuse/ops.c	Wed Sep  1 14:57:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.4 2010/08/28 03:46:21 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.5 2010/09/01 14:57:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -124,12 +124,12 @@
 	vap->va_fileid = fa->ino;
 	vap->va_size = fa->size;
 	vap->va_blocksize = fa->blksize;
-	vap->va_atime.tv_sec = (long)fa->atime;
-	vap->va_atime.tv_nsec = fa->atimensec;
-	vap->va_mtime.tv_sec = (long)fa->mtime;
-	vap->va_mtime.tv_nsec = fa->mtimensec;
-	vap->va_ctime.tv_sec = (long)fa->ctime;
-	vap->va_ctime.tv_nsec = fa->ctimensec;
+	vap->va_atime.tv_sec = (time_t)fa->atime;
+	vap->va_atime.tv_nsec = (long) fa->atimensec;
+	vap->va_mtime.tv_sec = (time_t)fa->mtime;
+	vap->va_mtime.tv_nsec = (long)fa->mtimensec;
+	vap->va_ctime.tv_sec = (time_t)fa->ctime;
+	vap->va_ctime.tv_nsec = (long)fa->ctimensec;
 	vap->va_birthtime.tv_sec = 0;
 	vap->va_birthtime.tv_nsec = 0;
 	vap->va_gen = 0; 
@@ -404,14 +404,14 @@
 		}
 
 		dents->d_fileno = fd->ino;
-		dents->d_reclen = reclen;
+		dents->d_reclen = (unsigned short)reclen;
 		dents->d_namlen = fd->namelen;
 		dents->d_type = fd->type;
 		strlcpy(dents->d_name, fd->name, fd->namelen + 1);
 
 #ifdef PERFUSE_DEBUG
 		if (perfuse_diagflags & PDF_READDIR)
-			DPRINTF("%s: translated \"%s\" ino = %lld\n",
+			DPRINTF("%s: translated \"%s\" ino = %"PRId64"\n",
 				__func__, dents->d_name, dents->d_fileno);
 #endif
 
@@ -428,8 +428,10 @@
 		len = FUSE_DIRENT_ALIGN(sizeof(*fd) + fd->namelen);
 #ifdef PERFUSE_DEBUG
 		if (perfuse_diagflags & PDF_READDIR)
-			DPRINTF("%s: record at %lld/0x%llx length = %d/0x%x. "
-				"next record at %lld/0x%llx, max %d/0x%x\n",
+			DPRINTF("%s: record at %"PRId64"/0x%"PRIx64" "
+				"length = %zd/0x%zx. "
+				"next record at %"PRId64"/0x%"PRIx64" "
+				"max %zd/0x%zx\n",
 				__func__, fd_offset, fd_offset, len, len,
 				fd_offset + len, fd_offset + len, 
 				fd_len, fd_len);
@@ -499,7 +501,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_READDIR)
-		DPRINTF("%s: readoff = %lld,  pnd->pnd_dirent_len = %d\n", 
+		DPRINTF("%s: readoff = %"PRId64",  pnd->pnd_dirent_len = %zd\n",
 			__func__, *readoff, pnd->pnd_dirent_len);
 #endif
 	if (*readoff >=  pnd->pnd_dirent_len) {
@@ -704,7 +706,7 @@
 	svfsb->f_asyncreads = ps->ps_asyncreads;
 	svfsb->f_asyncwrites = ps->ps_asyncwrites;
 
-	svfsb->f_fsidx.__fsid_val[0] = ps->ps_fsid;
+	svfsb->f_fsidx.__fsid_val[0] = (int32_t)ps->ps_fsid;
 	svfsb->f_fsidx.__fsid_val[1] = 0;
 	svfsb->f_fsid = ps->ps_fsid;
 	svfsb->f_namemax = MAXPATHLEN;	/* XXX */
@@ -1051,7 +1053,7 @@
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
 		DPRINTF("%s: opc = %p, file = \"%s\", "
-			"ino = %lld, fh = 0x%llx\n",
+			"ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc, 
 			(char *)PNPATH((struct puffs_node *)opc),
 			PERFUSE_NODE_DATA(opc)->pnd_ino, foo->fh);
@@ -1125,7 +1127,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc, pnd->pnd_ino, fh);
 #endif
 
@@ -1143,7 +1145,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			 __func__, (void *)opc, pnd->pnd_ino, fri->fh);
 #endif
 
@@ -1152,7 +1154,8 @@
 
 out:
 	if (error != 0)
-		DWARNX("%s: freed fh = 0x%llx but filesystem returned error = %d",
+		DWARNX("%s: freed fh = 0x%"PRIx64" but filesystem "
+		       "returned error = %d",
 		       __func__, fh, error);
 
 	ps->ps_destroy_msg(pm);
@@ -1204,8 +1207,8 @@
 
 #ifdef PERFUSE_DEBUG
 		if (perfuse_diagflags & PDF_FH)
-			DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
-				__func__, (void *)opc,
+			DPRINTF("%s: opc = %p, ino = %"PRId64", "
+				"fh = 0x%"PRIx64"\n", __func__, (void *)opc,
 				PERFUSE_NODE_DATA(opc)->pnd_ino, fgi->fh);
 #endif
 		if ((error = XCHG_MSG(ps, pu, pm, sizeof(*fao))) != 0) {
@@ -1355,13 +1358,13 @@
 
 	if (vap->va_atime.tv_sec != (time_t)PUFFS_VNOVAL) {
 		fsi->atime = vap->va_atime.tv_sec;;
-		fsi->atimensec = vap->va_atime.tv_nsec;;
+		fsi->atimensec = (uint32_t)vap->va_atime.tv_nsec;;
 		fsi->valid |= (FUSE_FATTR_ATIME|FUSE_FATTR_ATIME_NOW);
 	}
 
 	if (vap->va_mtime.tv_sec != (time_t)PUFFS_VNOVAL) {
 		fsi->mtime = vap->va_mtime.tv_sec;;
-		fsi->mtimensec = vap->va_mtime.tv_nsec;;
+		fsi->mtimensec = (uint32_t)vap->va_mtime.tv_nsec;;
 		fsi->valid |= (FUSE_FATTR_MTIME|FUSE_FATTR_MTIME_NOW);
 	}
 
@@ -1419,7 +1422,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc,	
 			PERFUSE_NODE_DATA(opc)->pnd_ino, fpi->fh);
 #endif
@@ -1515,7 +1518,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc,
 			PERFUSE_NODE_DATA(opc)->pnd_ino, ffi->fh);
 #endif
@@ -1915,7 +1918,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc,
 			PERFUSE_NODE_DATA(opc)->pnd_ino, fh);
 #endif
@@ -2066,7 +2069,7 @@
 	foh = GET_OUTHDR(ps, pm);
 	len = foh->len - sizeof(*foh) + 1;
 	if (len > *linklen)
-		DERRX(EX_PROTOCOL, "path len = %d too long", len);
+		DERRX(EX_PROTOCOL, "path len = %zd too long", len);
 		
 	*linklen = len;
 	(void)strlcpy(linkname, _GET_OUTPAYLOAD(ps, pm, char *), len);
@@ -2107,7 +2110,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_RECLAIM)
-		DPRINTF("%s (nodeid %lld) reclaimed\n", 
+		DPRINTF("%s (nodeid %"PRId64") reclaimed\n", 
 		       (char *)PNPATH((struct puffs_node *)opc), pnd->pnd_ino);
 #endif
 
@@ -2120,7 +2123,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_RECLAIM)
-		DPRINTF("%s (nodeid %lld) is %sreclaimed, "
+		DPRINTF("%s (nodeid %"PRId64") is %sreclaimed, "
 			"has childcount %d, %sopen\n", 
 		        (char *)PNPATH(pn), pnd->pnd_ino,
 		        pnd->pnd_flags & PND_RECLAIMED ? "" : "not ",
@@ -2128,7 +2131,7 @@
 			pnd->pnd_flags & PND_OPEN ? "" : "not ");
 
 	if (pnd->pnd_flags & PND_OPEN)
-		DWARNX("%s: (nodeid %lld) %s is still open",
+		DWARNX("%s: (nodeid %"PRId64") %s is still open",
 		       __func__, pnd->pnd_ino, (char *)PNPATH(pn));
 #endif
 
@@ -2233,7 +2236,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc,
 			PERFUSE_NODE_DATA(opc)->pnd_ino, fli->fh);
 #endif
@@ -2292,7 +2295,7 @@
 	requested = *resid;
 	if ((ps->ps_readahead + requested) > ps->ps_max_readahead) {
 		if (perfuse_diagflags & PDF_REQUEUE)
-			DPRINTF("readahead = %d\n", ps->ps_readahead);
+			DPRINTF("readahead = %zd\n", ps->ps_readahead);
 		requeue_request(pu, opc, PCQ_READ);
 	}
 	ps->ps_readahead += requested;
@@ -2309,7 +2312,7 @@
 		fri = GET_INPAYLOAD(ps, pm, fuse_read_in);
 		fri->fh = perfuse_get_fh(opc);
 		fri->offset = offset;
-		fri->size = MIN(*resid, PAGE_SIZE - sizeof(*foh));
+		fri->size = (uint32_t)MIN(*resid, PAGE_SIZE - sizeof(*foh));
 		fri->read_flags = 0; /* XXX Unused by libfuse? */
 		fri->lock_owner = PERFUSE_NODE_DATA(opc)->pnd_lock_owner;
 		fri->flags = 0;
@@ -2317,7 +2320,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc,
 			PERFUSE_NODE_DATA(opc)->pnd_ino, fri->fh);
 #endif
@@ -2381,7 +2384,7 @@
 	requested = *resid;
 	if ((ps->ps_write + requested) > ps->ps_max_write) {
 		if (perfuse_diagflags & PDF_REQUEUE)
-			DPRINTF("write = %d\n", ps->ps_write);
+			DPRINTF("write = %zd\n", ps->ps_write);
 		requeue_request(pu, opc, PCQ_WRITE);
 	}
 	ps->ps_write += requested;
@@ -2405,7 +2408,7 @@
 		fwi = GET_INPAYLOAD(ps, pm, fuse_write_in);
 		fwi->fh = perfuse_get_fh(opc);
 		fwi->offset = offset;
-		fwi->size = data_len;
+		fwi->size = (uint32_t)data_len;
 		fwi->write_flags = (fwi->size % PAGE_SIZE) ? 0 : 1;
 		fwi->lock_owner = PERFUSE_NODE_DATA(opc)->pnd_lock_owner;
 		fwi->flags = 0;
@@ -2415,7 +2418,7 @@
 
 #ifdef PERFUSE_DEBUG
 	if (perfuse_diagflags & PDF_FH)
-		DPRINTF("%s: opc = %p, ino = %lld, fh = 0x%llx\n",
+		DPRINTF("%s: opc = %p, ino = %"PRId64", fh = 0x%"PRIx64"\n",
 			__func__, (void *)opc,
 			PERFUSE_NODE_DATA(opc)->pnd_ino, fwi->fh);
 #endif

Index: src/lib/libperfuse/perfuse_if.h
diff -u src/lib/libperfuse/perfuse_if.h:1.3 src/lib/libperfuse/perfuse_if.h:1.4
--- src/lib/libperfuse/perfuse_if.h:1.3	Fri Aug 27 09:58:17 2010
+++ src/lib/libperfuse/perfuse_if.h	Wed Sep  1 14:57:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_if.h,v 1.3 2010/08/27 09:58:17 manu Exp $ */
+/*  $NetBSD: perfuse_if.h,v 1.4 2010/09/01 14:57:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -146,7 +146,7 @@
  * mount request
  */
 struct perfuse_mount_out {
-        uint32_t pmo_len;
+        size_t pmo_len;
         int32_t pmo_error;  
         uint64_t pmo_unique;
 	char pmo_magic[sizeof(PERFUSE_MOUNT_MAGIC)];
Index: src/lib/libperfuse/perfuse_priv.h
diff -u src/lib/libperfuse/perfuse_priv.h:1.3 src/lib/libperfuse/perfuse_priv.h:1.4
--- src/lib/libperfuse/perfuse_priv.h:1.3	Fri Aug 27 09:58:17 2010
+++ src/lib/libperfuse/perfuse_priv.h	Wed Sep  1 14:57:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_priv.h,v 1.3 2010/08/27 09:58:17 manu Exp $ */
+/*  $NetBSD: perfuse_priv.h,v 1.4 2010/09/01 14:57:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -59,8 +59,8 @@
 	char *ps_filesystemtype;
 	int ps_mountflags;
 	uint64_t ps_unique;
-	uint32_t ps_readahead;
-	uint32_t ps_write;
+	size_t ps_readahead;
+	size_t ps_write;
 	perfuse_new_msg_fn ps_new_msg;
 	perfuse_xchg_msg_fn ps_xchg_msg;
 	perfuse_destroy_msg_fn ps_destroy_msg;

Index: src/lib/libperfuse/subr.c
diff -u src/lib/libperfuse/subr.c:1.2 src/lib/libperfuse/subr.c:1.3
--- src/lib/libperfuse/subr.c:1.2	Thu Aug 26 13:29:01 2010
+++ src/lib/libperfuse/subr.c	Wed Sep  1 14:57:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: subr.c,v 1.2 2010/08/26 13:29:01 manu Exp $ */
+/*  $NetBSD: subr.c,v 1.3 2010/09/01 14:57:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -141,7 +141,8 @@
 		pnd->pnd_flags &= ~PND_OPEN;
 
 	if (pfh == NULL)
-		DERRX(EX_SOFTWARE, "%s: unexistant fh = %lld (double close?)",
+		DERRX(EX_SOFTWARE, 
+		      "%s: unexistant fh = %"PRId64" (double close?)",
 		      __func__, fh);
 	
 	return;

Index: src/usr.sbin/perfused/msg.c
diff -u src/usr.sbin/perfused/msg.c:1.2 src/usr.sbin/perfused/msg.c:1.3
--- src/usr.sbin/perfused/msg.c:1.2	Fri Aug 27 09:58:17 2010
+++ src/usr.sbin/perfused/msg.c	Wed Sep  1 14:57:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: msg.c,v 1.2 2010/08/27 09:58:17 manu Exp $ */
+/*  $NetBSD: msg.c,v 1.3 2010/09/01 14:57:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -85,7 +85,7 @@
 		return NULL;
 
 	if ((buf = malloc(len + 1)) == NULL)
-		err(EX_OSERR, "malloc(%d) failed", len);
+		err(EX_OSERR, "malloc(%zd) failed", len);
 
 	if (read(fd, buf, len) != len) {
 		DWARN("short read");
@@ -226,7 +226,8 @@
 	opcode = fih->opcode;
 
 	if (perfuse_diagflags & PDF_FUSE)
-		DPRINTF("> unique = %lld, nodeid = %lld, opcode = %s (%d)\n",
+		DPRINTF("> unique = %"PRId64", nodeid = %"PRId64", "
+			"opcode = %s (%d)\n",
 			unique_in, nodeid, perfuse_opname(opcode), opcode);
 
 	if (perfuse_diagflags & PDF_DUMP)
@@ -234,7 +235,7 @@
 
 #endif /* PERFUSE_DEBUG */
 
-	fd = (int)perfuse_getspecific(pu);
+	fd = (int)(long)perfuse_getspecific(pu);
 
 	if (perfuse_inloop(pu))
 		error = xchg_pb_inloop(pu, pb, fd, reply);
@@ -252,7 +253,8 @@
 	unique_out = foh->unique;	
 
 	if (perfuse_diagflags & PDF_FUSE)
-		DPRINTF("< unique = %lld, nodeid = %lld, opcode = %s (%d), "
+		DPRINTF("< unique = %"PRId64", nodeid = %"PRId64", "
+			"opcode = %s (%d), "
 			"error = %d\n", unique_out, nodeid, 
 			perfuse_opname(opcode), opcode, error);
 
@@ -260,10 +262,11 @@
 		perfuse_hexdump((char *)foh, foh->len);
 
 	if (unique_in != unique_out) {
-		printf("%s: packet mismatch unique %lld vs %lld\n",
+		printf("%s: packet mismatch unique %"PRId64" vs %"PRId64"\n",
 		     __func__, unique_in, unique_out);
 		abort();
-		errx(EX_SOFTWARE, "%s: packet mismatch unique %lld vs %lld\n",
+		errx(EX_SOFTWARE, "%s: packet mismatch unique "
+		     "%"PRId64" vs %"PRId64"\n",
 		     __func__, unique_in, unique_out);
 	}
 #endif /* PERFUSE_DEBUG */
@@ -272,7 +275,7 @@
 	    (foh->len - sizeof(*foh) < expected_len) &&
 	    (foh->error == 0)) {
 		DERRX(EX_PROTOCOL, 
-		     "Unexpected short reply: received %d bytes, expected %d",
+		     "Unexpected short reply: received %zd bytes, expected %zd",
 		     foh->len - sizeof(*foh), expected_len);
 	}
 
@@ -588,7 +591,7 @@
 	len = sizeof(*foh);
 	PUFFS_FRAMEBUF_GETWINDOW(pb, 0, (void **)&foh, &len);
 
-	DWARNX("Unexpected frame: unique = %lld, error = %d", 
+	DWARNX("Unexpected frame: unique = %"PRId64", error = %d", 
 	       foh->unique, foh->error);
 #ifdef PERFUSE_DEBUG
 	perfuse_hexdump((char *)(void *)foh, foh->len);

Index: src/usr.sbin/perfused/perfused.c
diff -u src/usr.sbin/perfused/perfused.c:1.3 src/usr.sbin/perfused/perfused.c:1.4
--- src/usr.sbin/perfused/perfused.c:1.3	Fri Aug 27 09:58:17 2010
+++ src/usr.sbin/perfused/perfused.c	Wed Sep  1 14:57:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfused.c,v 1.3 2010/08/27 09:58:17 manu Exp $ */
+/*  $NetBSD: perfused.c,v 1.4 2010/09/01 14:57:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -137,8 +137,8 @@
 	}
 
 #ifdef PERFUSE_DEBUG
-	DPRINTF("perfuse lengths: source = %d, target = %d, "
-	       "filesystemtype = %d, data = %d\n", 
+	DPRINTF("perfuse lengths: source = %zd, target = %zd, "
+	       "filesystemtype = %zd, data = %zd\n", 
 		pmo->pmo_source_len, 
 		pmo->pmo_target_len,
 		pmo->pmo_filesystemtype_len,
@@ -235,7 +235,7 @@
 	if (puffs_framev_addfd(pu, fd, PUFFS_FBIO_READ|PUFFS_FBIO_WRITE) == -1)
 		DERR(EX_SOFTWARE, "puffs_framev_addfd failed");
 
-	perfuse_setspecific(pu, (void *)fd);
+	perfuse_setspecific(pu, (void *)(long)fd);
 
 	setproctitle("perfused %s", pmi.pmi_target);
 	(void)kill(getpid(), SIGINFO);		/* This is for -s option */

Reply via email to