diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2013-12-02 16:05:08 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2013-12-02 16:05:08 +0000 |
commit | e5e4e461a2c78cd46646ba8a7f66ea2b1cb958be (patch) | |
tree | 827b68fb77bd5f26f363d29d834a7691ea956006 /sys | |
parent | 3ebcd003f5bde613ff6b6a96324874182f9dbd8a (diff) |
Use appropriate format specifiers in debug messages. In particular, avoid
casting almost everything to u_int32_t, then formatting as a signed int
(which really helps when you're trying to debug based on 64-bit values).
Looked over by krw@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ntfs/ntfs_subr.c | 159 | ||||
-rw-r--r-- | sys/ntfs/ntfs_vfsops.c | 19 | ||||
-rw-r--r-- | sys/ntfs/ntfs_vnops.c | 75 |
3 files changed, 121 insertions, 132 deletions
diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c index 279e47d0942..50bd664fc27 100644 --- a/sys/ntfs/ntfs_subr.c +++ b/sys/ntfs/ntfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_subr.c,v 1.33 2013/11/24 16:02:30 jsing Exp $ */ +/* $OpenBSD: ntfs_subr.c,v 1.34 2013/12/02 16:05:07 jsing Exp $ */ /* $NetBSD: ntfs_subr.c,v 1.4 2003/04/10 21:37:32 jdolecek Exp $ */ /*- @@ -87,7 +87,7 @@ static signed int ntfs_toupper_usecount; int ntfs_ntvattrrele(struct ntvattr *vap) { - DPRINTF("ntfs_ntvattrrele: ino: %d, type: 0x%x\n", + DPRINTF("ntfs_ntvattrrele: ino: %u, type: 0x%x\n", vap->va_ip->i_number, vap->va_type); ntfs_ntrele(vap->va_ip); @@ -107,7 +107,7 @@ ntfs_findvattr(struct ntfsmount *ntmp, struct ntnode *ip, struct ntvattr *vap; if((ip->i_flag & IN_LOADED) == 0) { - DPRINTF("ntfs_findvattr: node not loaded, ino: %d\n", + DPRINTF("ntfs_findvattr: node not loaded, ino: %u\n", ip->i_number); error = ntfs_loadntnode(ntmp,ip); if (error) { @@ -124,9 +124,8 @@ ntfs_findvattr(struct ntfsmount *ntmp, struct ntnode *ip, *lvapp = NULL; *vapp = NULL; LIST_FOREACH(vap, &ip->i_valist, va_list) { - DDPRINTF("ntfs_findvattr: type: 0x%x, vcn: %d - %d\n", - vap->va_type, (u_int32_t)vap->va_vcnstart, - (u_int32_t)vap->va_vcnend); + DDPRINTF("ntfs_findvattr: type: 0x%x, vcn: %llu - %llu\n", + vap->va_type, vap->va_vcnstart, vap->va_vcnend); if ((vap->va_type == type) && (vap->va_vcnstart <= vcn) && (vap->va_vcnend >= vcn) && (vap->va_namelen == namelen) && @@ -165,12 +164,12 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, *vapp = NULL; if (name) { - DPRINTF("ntfs_ntvattrget: ino: %d, type: 0x%x, name: %s, " - "vcn: %d\n", ip->i_number, type, name, (u_int32_t)vcn); + DPRINTF("ntfs_ntvattrget: ino: %u, type: 0x%x, name: %s, " + "vcn: %llu\n", ip->i_number, type, name, vcn); namelen = strlen(name); } else { - DPRINTF("ntfs_ntvattrget: ino: %d, type: 0x%x, vcn: %d\n", - ip->i_number, type, (u_int32_t)vcn); + DPRINTF("ntfs_ntvattrget: ino: %u, type: 0x%x, vcn: %llu\n", + ip->i_number, type, vcn); name = ""; namelen = 0; } @@ -180,9 +179,9 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, return (error); if (!lvap) { - DPRINTF("ntfs_ntvattrget: UNEXISTED ATTRIBUTE: ino: %d, " - "type: 0x%x, name: %s, vcn: %d\n", ip->i_number, type, - name, (u_int32_t)vcn); + DPRINTF("ntfs_ntvattrget: UNEXISTED ATTRIBUTE: ino: %u, " + "type: 0x%x, name: %s, vcn: %llu\n", ip->i_number, type, + name, vcn); return (ENOENT); } /* Scan $ATTRIBUTE_LIST for requested attribute */ @@ -197,9 +196,9 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, nextaalp = NULL; for(; len > 0; aalp = nextaalp) { - DPRINTF("ntfs_ntvattrget: attrlist: ino: %d, attr: 0x%x, " - "vcn: %d\n", aalp->al_inumber, aalp->al_type, - (u_int32_t)aalp->al_vcnstart); + DPRINTF("ntfs_ntvattrget: attrlist: ino: %u, attr: 0x%x, " + "vcn: %llu\n", aalp->al_inumber, aalp->al_type, + aalp->al_vcnstart); if (len > aalp->reclen) { nextaalp = NTFS_NEXTREC(aalp, struct attr_attrlist *); @@ -213,7 +212,7 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, NTFS_AALPCMP(nextaalp, type, name, namelen))) continue; - DPRINTF("ntfs_ntvattrget: attribute in ino: %d\n", + DPRINTF("ntfs_ntvattrget: attribute in ino: %u\n", aalp->al_inumber); /* this is not a main record, so we can't use just plain @@ -238,9 +237,9 @@ ntfs_ntvattrget(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t type, } error = ENOENT; - DPRINTF("ntfs_ntvattrget: UNEXISTED ATTRIBUTE: ino: %d, type: 0x%x, " - "name: %.*s, vcn: %d\n", ip->i_number, type, (int)namelen, name, - (u_int32_t)vcn); + DPRINTF("ntfs_ntvattrget: UNEXISTED ATTRIBUTE: ino: %u, type: 0x%x, " + "name: %.*s, vcn: %llu\n", ip->i_number, type, + (unsigned int)namelen, name, vcn); out: free(alpool, M_TEMP); return (error); @@ -261,7 +260,7 @@ ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip) daddr_t bn; int error,off; - DPRINTF("ntfs_loadntnode: loading ino: %d\n", ip->i_number); + DPRINTF("ntfs_loadntnode: loading ino: %u\n", ip->i_number); KASSERT((ip->i_flag & IN_LOADED) == 0); @@ -270,7 +269,7 @@ ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip) TAILQ_REMOVE(&ntmp->ntm_ntnodeq, oip, i_loaded); ntmp->ntm_ntnodes--; - DPRINTF("ntfs_loadntnode: unloading ino: %d\n", oip->i_number); + DPRINTF("ntfs_loadntnode: unloading ino: %u\n", oip->i_number); KASSERT((oip->i_flag & IN_LOADED)); oip->i_flag &= ~IN_LOADED; @@ -321,7 +320,7 @@ ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip) goto out; } - DPRINTF("ntfs_loadntnode: load attrs for ino: %d\n", ip->i_number); + DPRINTF("ntfs_loadntnode: load attrs for ino: %u\n", ip->i_number); off = mfrp->fr_attroff; ap = (struct attr *) ((caddr_t)mfrp + off); @@ -366,7 +365,7 @@ out: int ntfs_ntget(struct ntnode *ip, struct proc *p) { - DPRINTF("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", + DPRINTF("ntfs_ntget: get ntnode %u: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount); ip->i_usecount++; @@ -389,12 +388,12 @@ ntfs_ntlookup(struct ntfsmount *ntmp, ntfsino_t ino, struct ntnode **ipp, { struct ntnode *ip; - DPRINTF("ntfs_ntlookup: looking for ntnode %d\n", ino); + DPRINTF("ntfs_ntlookup: looking for ntnode %u\n", ino); do { if ((ip = ntfs_nthashlookup(ntmp->ntm_dev, ino)) != NULL) { ntfs_ntget(ip, p); - DPRINTF("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n", + DPRINTF("ntfs_ntlookup: ntnode %u: %p, usecount: %d\n", ino, ip, ip->i_usecount); *ipp = ip; return (0); @@ -402,7 +401,7 @@ ntfs_ntlookup(struct ntfsmount *ntmp, ntfsino_t ino, struct ntnode **ipp, } while (rw_enter(&ntfs_hashlock, RW_WRITE | RW_SLEEPFAIL)); ip = malloc(sizeof(*ip), M_NTFSNTNODE, M_WAITOK | M_ZERO); - DDPRINTF("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip); + DDPRINTF("ntfs_ntlookup: allocating ntnode: %u: %p\n", ino, ip); /* Generic initialization */ ip->i_devvp = ntmp->ntm_devvp; @@ -423,7 +422,7 @@ ntfs_ntlookup(struct ntfsmount *ntmp, ntfsino_t ino, struct ntnode **ipp, *ipp = ip; - DPRINTF("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n", + DPRINTF("ntfs_ntlookup: ntnode %u: %p, usecount: %d\n", ino, ip, ip->i_usecount); return (0); @@ -441,7 +440,7 @@ ntfs_ntput(struct ntnode *ip, struct proc *p) struct ntfsmount *ntmp = ip->i_mp; struct ntvattr *vap; - DPRINTF("ntfs_ntput: rele ntnode %d: %p, usecount: %d\n", + DPRINTF("ntfs_ntput: rele ntnode %u: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount); ip->i_usecount--; @@ -458,7 +457,7 @@ ntfs_ntput(struct ntnode *ip, struct proc *p) return; } - DPRINTF("ntfs_ntput: deallocating ntnode: %d\n", ip->i_number); + DPRINTF("ntfs_ntput: deallocating ntnode: %u\n", ip->i_number); if (LIST_FIRST(&ip->i_fnlist)) panic("ntfs_ntput: ntnode has fnodes"); @@ -488,7 +487,7 @@ ntfs_ntref(struct ntnode *ip) { ip->i_usecount++; - DPRINTF("ntfs_ntref: ino %d, usecount: %d\n", + DPRINTF("ntfs_ntref: ino %u, usecount: %d\n", ip->i_number, ip->i_usecount); } @@ -498,7 +497,7 @@ ntfs_ntref(struct ntnode *ip) void ntfs_ntrele(struct ntnode *ip) { - DPRINTF("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n", + DPRINTF("ntfs_ntrele: rele ntnode %u: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount); ip->i_usecount--; @@ -547,7 +546,7 @@ ntfs_attrtontvattr(struct ntfsmount *ntmp, struct ntvattr **rvapp, vap->va_compression = rap->a_hdr.a_compression; vap->va_index = rap->a_hdr.a_index; - DDPRINTF("type: 0x%x, index: %d", vap->va_type, vap->va_index); + DDPRINTF("type: 0x%x, index: %u", vap->va_type, vap->va_index); vap->va_namelen = rap->a_hdr.a_namelen; if (rap->a_hdr.a_namelen) { @@ -580,7 +579,7 @@ ntfs_attrtontvattr(struct ntfsmount *ntmp, struct ntvattr **rvapp, memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff, rap->a_r.a_datalen); } - DDPRINTF(", len: %d", vap->va_datalen); + DDPRINTF(", len: %u", vap->va_datalen); if (error) free(vap, M_NTFSNTVATTR); @@ -712,11 +711,11 @@ ntfs_fget(struct ntfsmount *ntmp, struct ntnode *ip, int attrtype, { struct fnode *fp; - DPRINTF("ntfs_fget: ino: %d, attrtype: 0x%x, attrname: %s\n", + DPRINTF("ntfs_fget: ino: %u, attrtype: 0x%x, attrname: %s\n", ip->i_number, attrtype, attrname ? attrname : ""); *fpp = NULL; LIST_FOREACH(fp, &ip->i_fnlist, f_fnlist) { - DPRINTF("ntfs_fget: fnode: attrtype: %d, attrname: %s\n", + DPRINTF("ntfs_fget: fnode: attrtype: %u, attrname: %s\n", fp->f_attrtype, fp->f_attrname ? fp->f_attrname : ""); if ((attrtype == fp->f_attrtype) && @@ -758,7 +757,7 @@ ntfs_frele(struct fnode *fp) { struct ntnode *ip = FTONT(fp); - DPRINTF("ntfs_frele: fnode: %p for %d: %p\n", fp, ip->i_number, ip); + DPRINTF("ntfs_frele: fnode: %p for %u: %p\n", fp, ip->i_number, ip); DPRINTF("ntfs_frele: deallocating fnode\n"); LIST_REMOVE(fp,f_fnlist); @@ -874,13 +873,13 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, } blsize = vap->va_a_iroot->ir_size; - DPRINTF("ntfs_ntlookupfile: blksz: %d\n", blsize); + DPRINTF("ntfs_ntlookupfile: blksz: %u\n", blsize); rdbuf = malloc(blsize, M_TEMP, M_WAITOK); loop: rdsize = vap->va_datalen; - DPRINTF("ntfs_ntlookupfile: rdsz: %d\n", rdsize); + DPRINTF("ntfs_ntlookupfile: rdsz: %u\n", rdsize); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30", 0, rdsize, rdbuf, NULL); @@ -896,8 +895,8 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, aoff += iep->reclen, iep = (struct attr_indexentry *) (rdbuf + aoff)) { - DDPRINTF("scan: %d, %d\n", (u_int32_t)iep->ie_number, - (u_int32_t)iep->ie_fnametype); + DDPRINTF("scan: %u, %u\n", iep->ie_number, + iep->ie_fnametype); /* check the name - the case-insensitive check * has to come first, to break from this for loop @@ -1063,7 +1062,7 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, cn = 0; /* need zero, used by lookup_ctx */ DDPRINTF("ntfs_ntlookupfile: fullscan performed for: %.*s\n", - (int)fnamelen, fname); + (unsigned int)fnamelen, fname); goto loop; } @@ -1138,7 +1137,7 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, u_int32_t num, int error = ENOENT; u_int32_t aoff, cnum; - DPRINTF("ntfs_ntreaddir: read ino: %d, num: %d\n", ip->i_number, num); + DPRINTF("ntfs_ntreaddir: read ino: %u, num: %u\n", ip->i_number, num); error = ntfs_ntget(ip, p); if (error) return (error); @@ -1158,7 +1157,7 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, u_int32_t num, blsize = fp->f_dirblsz; rdbuf = fp->f_dirblbuf; - DPRINTF("ntfs_ntreaddir: rdbuf: %p, blsize: %d\n", rdbuf, blsize); + DPRINTF("ntfs_ntreaddir: rdbuf: %p, blsize: %u\n", rdbuf, blsize); if (vap->va_a_iroot->ir_flag & NTFS_IRFLAG_INDXALLOC) { error = ntfs_ntvattrget(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", @@ -1180,7 +1179,7 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, u_int32_t num, goto fail; } cpbl = ntfs_btocn(blsize + ntfs_cntob(1) - 1); - DPRINTF("ntfs_ntreaddir: indexalloc: %d, cpbl: %d\n", + DPRINTF("ntfs_ntreaddir: indexalloc: %u, cpbl: %u\n", iavap->va_datalen, cpbl); } else { DPRINTF("ntfs_ntreadidir: w/o BitMap and IndexAllocation\n"); @@ -1202,8 +1201,8 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, u_int32_t num, } do { - DPRINTF("ntfs_ntreaddir: scan: 0x%x, %d, %d, %d, %d\n", - attrnum, (u_int32_t)blnum, cnum, num, aoff); + DPRINTF("ntfs_ntreaddir: scan: 0x%x, %u, %u, %u, %u\n", + attrnum, blnum, cnum, num, aoff); rdsize = (attrnum == NTFS_A_INDXROOT) ? vap->va_datalen : blsize; error = ntfs_readattr(ntmp, ip, attrnum, "$I30", ntfs_cntob(blnum * cpbl), rdsize, rdbuf, NULL); @@ -1258,8 +1257,7 @@ ntfs_ntreaddir(struct ntfsmount *ntmp, struct fnode *fp, u_int32_t num, aoff = 0; if (ntfs_cntob(blnum * cpbl) >= iavap->va_datalen) break; - DPRINTF("ntfs_ntreaddir: blnum: %d\n", - (u_int32_t)blnum); + DPRINTF("ntfs_ntreaddir: blnum: %u\n", blnum); } } while (iavap); @@ -1311,7 +1309,7 @@ ntfs_filesize(struct ntfsmount *ntmp, struct fnode *fp, u_int64_t *size, u_int64_t sz, bn; int error; - DPRINTF("ntfs_filesize: ino: %d\n", ip->i_number); + DPRINTF("ntfs_filesize: ino: %u\n", ip->i_number); error = ntfs_ntvattrget(ntmp, ip, fp->f_attrtype, fp->f_attrname, 0, &vap); @@ -1321,8 +1319,7 @@ ntfs_filesize(struct ntfsmount *ntmp, struct fnode *fp, u_int64_t *size, bn = vap->va_allocated; sz = vap->va_datalen; - DPRINTF("ntfs_filesize: %d bytes (%d bytes allocated)\n", - (u_int32_t)sz, (u_int32_t)bn); + DPRINTF("ntfs_filesize: %llu bytes (%llu bytes allocated)\n", sz, bn); if (size) *size = sz; @@ -1355,9 +1352,9 @@ ntfs_writeattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, if (error) return (error); towrite = MIN(left, ntfs_cntob(vap->va_vcnend + 1) - off); - DDPRINTF("ntfs_writeattr_plain: o: %d, s: %d (%d - %d)\n", - (u_int32_t)off, (u_int32_t)towrite, - (u_int32_t)vap->va_vcnstart, (u_int32_t)vap->va_vcnend); + DDPRINTF("ntfs_writeattr_plain: o: %lld, s: %lld " + "(%llu - %llu)\n", off, towrite, + vap->va_vcnstart, vap->va_vcnend); error = ntfs_writentvattr_plain(ntmp, ip, vap, off - ntfs_cntob(vap->va_vcnstart), towrite, data, &init, uio); @@ -1418,9 +1415,8 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, ccn = vap->va_vruncn[cnt]; ccl = vap->va_vruncl[cnt]; - DDPRINTF("ntfs_writentvattr_plain: left %d, cn: 0x%x, cl: %d, " - "off: %d\n", (u_int32_t)left, (u_int32_t)ccn, - (u_int32_t)ccl, (u_int32_t)off); + DDPRINTF("ntfs_writentvattr_plain: left %llu, cn: 0x%llx, " + "cl: %llu, off: %lld\n", left, ccn, ccl, off); if (ntfs_cntob(ccl) < off) { off -= ntfs_cntob(ccl); @@ -1444,10 +1440,9 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, tocopy = MIN(left, ntfs_cntob(1) - off); cl = ntfs_btocl(tocopy + off); KASSERT(cl == 1 && tocopy <= ntfs_cntob(1)); - DDPRINTF("ntfs_writentvattr_plain: write: cn: 0x%x " - "cl: %d, off: %d len: %d, left: %d\n", - (u_int32_t)cn, (u_int32_t)cl, (u_int32_t)off, - (u_int32_t) tocopy, (u_int32_t)left); + DDPRINTF("ntfs_writentvattr_plain: write: cn: 0x%llx " + "cl: %llu, off: %lld len: %llu, left: %llu\n", + cn, cl, off, tocopy, left); if ((off == 0) && (tocopy == ntfs_cntob(cl))) { bp = getblk(ntmp->ntm_devvp, ntfs_cntobn(cn), @@ -1518,9 +1513,9 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, ccn = vap->va_vruncn[cnt]; ccl = vap->va_vruncl[cnt]; - DDPRINTF("ntfs_readntvattr_plain: left %d, cn: 0x%x, " - "cl: %d, off: %d\n", (u_int32_t)left, - (u_int32_t)ccn, (u_int32_t)ccl, (u_int32_t)off); + DDPRINTF("ntfs_readntvattr_plain: left %llu, " + "cn: 0x%llx, cl: %llu, off: %lld\n", + left, ccn, ccl, off); if (ntfs_cntob(ccl) < off) { off -= ntfs_cntob(ccl); @@ -1547,11 +1542,10 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, tocopy <= ntfs_cntob(1)); DDPRINTF("ntfs_readntvattr_plain: " - "read: cn: 0x%x cl: %d, off: %d, " - "len: %d, left: %d\n", - (u_int32_t)cn, (u_int32_t)cl, - (u_int32_t)off, (u_int32_t)tocopy, - (u_int32_t)left); + "read: cn: 0x%llx cl: %llu, " + "off: %lld, len: %llu, " + "left: %llu\n", + cn, cl, off, tocopy, left); error = bread(ntmp->ntm_devvp, ntfs_cntobn(cn), ntfs_cntob(cl), @@ -1580,11 +1574,9 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, } else { tocopy = MIN(left, ntfs_cntob(ccl) - off); DDPRINTF("ntfs_readntvattr_plain: hole: " - "ccn: 0x%x ccl: %d, off: %d, len: %d, " - "left: %d\n", - (u_int32_t)ccn, (u_int32_t)ccl, - (u_int32_t)off, (u_int32_t)tocopy, - (u_int32_t)left); + "ccn: 0x%llx ccl: %llu, off: %lld, " + "len: %llu, left: %llu\n", + ccn, ccl, off, tocopy, left); left -= tocopy; off = 0; if (uio) { @@ -1639,9 +1631,9 @@ ntfs_readattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, if (error) return (error); toread = MIN(left, ntfs_cntob(vap->va_vcnend + 1) - off); - DDPRINTF("ntfs_readattr_plain: o: %d, s: %d (%d - %d)\n", - (u_int32_t)off, (u_int32_t)toread, - (u_int32_t)vap->va_vcnstart, (u_int32_t)vap->va_vcnend); + DDPRINTF("ntfs_readattr_plain: o: %lld, s: %lld " + "(%llu - %llu)\n", off, toread, + vap->va_vcnstart, vap->va_vcnend); error = ntfs_readntvattr_plain(ntmp, ip, vap, off - ntfs_cntob(vap->va_vcnstart), toread, data, &init, uio); @@ -1676,8 +1668,8 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum, struct ntvattr *vap; size_t init; - DDPRINTF("ntfs_readattr: reading %d: 0x%x, from %d size %d bytes\n", - ip->i_number, attrnum, (u_int32_t)roff, (u_int32_t)rsize); + DDPRINTF("ntfs_readattr: reading %u: 0x%x, from %lld size %zu bytes\n", + ip->i_number, attrnum, roff, rsize); error = ntfs_ntvattrget(ntmp, ip, attrnum, attrname, 0, &vap); if (error) @@ -1685,9 +1677,8 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum, if ((roff > vap->va_datalen) || (roff + rsize > vap->va_datalen)) { - printf("ntfs_readattr: offset too big: %ld (%ld) > %ld\n", - (long int) roff, (long int) roff + rsize, - (long int) vap->va_datalen); + printf("ntfs_readattr: offset too big: %lld (%lld) > %u\n", + roff, roff + rsize, vap->va_datalen); ntfs_ntvattrrele(vap); return (E2BIG); } @@ -1698,7 +1689,7 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum, caddr_t data = rdata; cn_t cn; - DDPRINTF("ntfs_ntreadattr: compression: %d\n", + DDPRINTF("ntfs_ntreadattr: compression: %u\n", vap->va_compressalg); cup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL), M_NTFSDECOMP, diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c index 915f8b46953..dfb62456cc1 100644 --- a/sys/ntfs/ntfs_vfsops.c +++ b/sys/ntfs/ntfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vfsops.c,v 1.36 2013/11/24 16:02:30 jsing Exp $ */ +/* $OpenBSD: ntfs_vfsops.c,v 1.37 2013/12/02 16:05:07 jsing Exp $ */ /* $NetBSD: ntfs_vfsops.c,v 1.7 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -334,12 +334,12 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, else ntmp->ntm_bpmftrec = (1 << (-cpr)) / ntmp->ntm_bps; } - DPRINTF("ntfs_mountfs(): bps: %d, spc: %d, media: %x, " - "mftrecsz: %d (%d sects)\n", ntmp->ntm_bps, ntmp->ntm_spc, + DPRINTF("ntfs_mountfs(): bps: %u, spc: %u, media: %x, " + "mftrecsz: %u (%u sects)\n", ntmp->ntm_bps, ntmp->ntm_spc, ntmp->ntm_bootfile.bf_media, ntmp->ntm_mftrecsz, ntmp->ntm_bpmftrec); - DPRINTF("ntfs_mountfs(): mftcn: 0x%x|0x%x\n", - (u_int32_t)ntmp->ntm_mftcn, (u_int32_t)ntmp->ntm_mftmirrcn); + DPRINTF("ntfs_mountfs(): mftcn: 0x%llx|0x%llx\n", + ntmp->ntm_mftcn, ntmp->ntm_mftmirrcn); ntmp->ntm_mountp = mp; ntmp->ntm_dev = dev; @@ -643,7 +643,7 @@ ntfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) struct ntfid *ntfhp = (struct ntfid *)fhp; int error; - DDPRINTF("ntfs_fhtovp(): %s: %d\n", + DDPRINTF("ntfs_fhtovp(): %s: %u\n", mp->mnt_stat.f_mntonname, ntfhp->ntfid_ino); error = ntfs_vgetex(mp, ntfhp->ntfid_ino, ntfhp->ntfid_attr, NULL, @@ -691,9 +691,8 @@ ntfs_vgetex(struct mount *mp, ntfsino_t ino, u_int32_t attrtype, char *attrname, struct vnode *vp; enum vtype f_type; - DPRINTF("ntfs_vgetex: ino: %d, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", - ino, attrtype, attrname ? attrname : "", (u_long)lkflags, - (u_long)flags); + DPRINTF("ntfs_vgetex: ino: %u, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", + ino, attrtype, attrname ? attrname : "", lkflags, flags); ntmp = VFSTONTFS(mp); *vpp = NULL; @@ -771,7 +770,7 @@ ntfs_vgetex(struct mount *mp, ntfsino_t ino, u_int32_t attrtype, char *attrname, return (error); } - DPRINTF("ntfs_vget: vnode: %p for ntnode: %d\n", vp, ino); + DPRINTF("ntfs_vget: vnode: %p for ntnode: %u\n", vp, ino); fp->f_vp = vp; vp->v_data = fp; diff --git a/sys/ntfs/ntfs_vnops.c b/sys/ntfs/ntfs_vnops.c index f132f12ed6b..c8245f350fa 100644 --- a/sys/ntfs/ntfs_vnops.c +++ b/sys/ntfs/ntfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vnops.c,v 1.32 2013/11/24 16:02:30 jsing Exp $ */ +/* $OpenBSD: ntfs_vnops.c,v 1.33 2013/12/02 16:05:07 jsing Exp $ */ /* $NetBSD: ntfs_vnops.c,v 1.6 2003/04/10 21:57:26 jdolecek Exp $ */ /* @@ -81,7 +81,8 @@ int ntfs_bmap(void *v) { struct vop_bmap_args *ap = v; - DPRINTF("ntfs_bmap: vn: %p, blk: %d\n", ap->a_vp, (u_int32_t)ap->a_bn); + DPRINTF("ntfs_bmap: vn: %p, blk: %lld\n", + ap->a_vp, (long long)ap->a_bn); if (ap->a_vpp != NULL) *ap->a_vpp = ap->a_vp; if (ap->a_bnp != NULL) @@ -103,19 +104,18 @@ ntfs_read(void *v) u_int64_t toread; int error; - DPRINTF("ntfs_read: ino: %d, off: %d resid: %d, segflg: %d\n", - ip->i_number, (u_int32_t)uio->uio_offset, uio->uio_resid, - uio->uio_segflg); + DPRINTF("ntfs_read: ino: %u, off: %lld resid: %zu, segflg: %d\n", + ip->i_number, uio->uio_offset, uio->uio_resid, uio->uio_segflg); - DPRINTF("ntfs_read: filesize: %d", (u_int32_t)fp->f_size); + DPRINTF("ntfs_read: filesize: %llu", fp->f_size); /* don't allow reading after end of file */ if (uio->uio_offset > fp->f_size) toread = 0; else - toread = MIN(uio->uio_resid, fp->f_size - uio->uio_offset ); + toread = MIN(uio->uio_resid, fp->f_size - uio->uio_offset); - DPRINTF(", toread: %d\n", (u_int32_t)toread); + DPRINTF(", toread: %llu\n", toread); if (toread == 0) return (0); @@ -139,7 +139,7 @@ ntfs_getattr(void *v) struct ntnode *ip = FTONT(fp); struct vattr *vap = ap->a_vap; - DPRINTF("ntfs_getattr: %d, flags: %d\n", ip->i_number, ip->i_flag); + DPRINTF("ntfs_getattr: %u, flags: %u\n", ip->i_number, ip->i_flag); vap->va_fsid = ip->i_dev; vap->va_fileid = ip->i_number; @@ -185,7 +185,7 @@ ntfs_inactive(void *v) struct ntnode *ip = VTONT(vp); #endif - DPRINTF("ntfs_inactive: vnode: %p, ntnode: %d\n", vp, ip->i_number); + DPRINTF("ntfs_inactive: vnode: %p, ntnode: %u\n", vp, ip->i_number); #ifdef DIAGNOSTIC if (ntfs_prtactive && vp->v_usecount != 0) @@ -213,7 +213,7 @@ ntfs_reclaim(void *v) struct proc *p = ap->a_p; int error; - DPRINTF("ntfs_reclaim: vnode: %p, ntnode: %d\n", vp, ip->i_number); + DPRINTF("ntfs_reclaim: vnode: %p, ntnode: %u\n", vp, ip->i_number); #ifdef DIAGNOSTIC if (ntfs_prtactive && vp->v_usecount != 0) @@ -261,11 +261,11 @@ ntfs_strategy(void *v) struct ntfsmount *ntmp = ip->i_mp; int error, s; - DPRINTF("ntfs_strategy: blkno: %d, lblkno: %d\n", - (u_int32_t)bp->b_blkno, (u_int32_t)bp->b_lblkno); + DPRINTF("ntfs_strategy: blkno: %lld, lblkno: %lld\n", + (long long)bp->b_blkno, (long long)bp->b_lblkno); - DPRINTF("strategy: bcount: %u flags: 0x%x\n", - (u_int32_t)bp->b_bcount, bp->b_flags); + DPRINTF("strategy: bcount: %ld flags: 0x%lx\n", + bp->b_bcount, bp->b_flags); if (bp->b_flags & B_READ) { u_int32_t toread; @@ -276,8 +276,8 @@ ntfs_strategy(void *v) } else { toread = MIN(bp->b_bcount, fp->f_size - ntfs_cntob(bp->b_blkno)); - DPRINTF("ntfs_strategy: toread: %d, fsize: %d\n", - toread, (u_int32_t)fp->f_size); + DPRINTF("ntfs_strategy: toread: %u, fsize: %llu\n", + toread, fp->f_size); error = ntfs_readattr(ntmp, ip, fp->f_attrtype, fp->f_attrname, ntfs_cntob(bp->b_blkno), @@ -302,8 +302,8 @@ ntfs_strategy(void *v) } else { towrite = MIN(bp->b_bcount, fp->f_size - ntfs_cntob(bp->b_blkno)); - DPRINTF("ntfs_strategy: towrite: %d, fsize: %d\n", - towrite, (u_int32_t)fp->f_size); + DPRINTF("ntfs_strategy: towrite: %u, fsize: %llu\n", + towrite, fp->f_size); error = ntfs_writeattr_plain(ntmp, ip, fp->f_attrtype, fp->f_attrname, ntfs_cntob(bp->b_blkno),towrite, @@ -335,10 +335,9 @@ ntfs_write(void *v) size_t written; int error; - DPRINTF("ntfs_write: ino: %d, off: %d resid: %d, segflg: %d\n", - ip->i_number, (u_int32_t)uio->uio_offset, uio->uio_resid, - uio->uio_segflg); - DPRINTF("ntfs_write: filesize: %d", (u_int32_t)fp->f_size); + DPRINTF("ntfs_write: ino: %u, off: %lld resid: %zu, segflg: %d\n", + ip->i_number, uio->uio_offset, uio->uio_resid, uio->uio_segflg); + DPRINTF("ntfs_write: filesize: %llu", fp->f_size); if (uio->uio_resid + uio->uio_offset > fp->f_size) { printf("ntfs_write: CAN'T WRITE BEYOND END OF FILE\n"); @@ -347,7 +346,7 @@ ntfs_write(void *v) towrite = MIN(uio->uio_resid, fp->f_size - uio->uio_offset); - DPRINTF(", towrite: %d\n", (u_int32_t)towrite); + DPRINTF(", towrite: %llu\n", towrite); error = ntfs_writeattr_plain(ntmp, ip, fp->f_attrtype, fp->f_attrname, uio->uio_offset, towrite, NULL, &written, uio); @@ -370,7 +369,7 @@ ntfs_access(void *v) gid_t *gp; int i; - DPRINTF("ntfs_access: %d\n", ip->i_number); + DPRINTF("ntfs_access: %u\n", ip->i_number); /* * Disallow write attempts on read-only file systems; @@ -483,7 +482,7 @@ ntfs_readdir(void *v) struct dirent *cde; off_t off; - DPRINTF("ntfs_readdir %d off: %lld resid: %d\n", ip->i_number, + DPRINTF("ntfs_readdir %u off: %lld resid: %zu\n", ip->i_number, uio->uio_offset, uio->uio_resid); off = uio->uio_offset; @@ -548,8 +547,8 @@ ntfs_readdir(void *v) remains -= sz; } *fname = '\0'; - DPRINTF("ntfs_readdir: elem: %d, fname:[%s] type: %d, " - "flag: %d, ", + DPRINTF("ntfs_readdir: elem: %u, fname:[%s] type: %u, " + "flag: %u, ", num, cde->d_name, iep->ie_fnametype, iep->ie_flag); cde->d_namlen = fname - (char *) cde->d_name; cde->d_fileno = iep->ie_number; @@ -564,10 +563,10 @@ ntfs_readdir(void *v) } } - DPRINTF("ntfs_readdir: %d entries (%d bytes) read\n", - num, (u_int)(uio->uio_offset - off)); - DPRINTF("ntfs_readdir: off: %d resid: %d\n", - (u_int32_t)uio->uio_offset, uio->uio_resid); + DPRINTF("ntfs_readdir: %u entries (%lld bytes) read\n", + num, uio->uio_offset - off); + DPRINTF("ntfs_readdir: off: %lld resid: %zu\n", + uio->uio_offset, uio->uio_resid); /* if (ap->a_eofflag) @@ -597,8 +596,8 @@ ntfs_lookup(void *v) #if NTFS_DEBUG int wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT); #endif - DPRINTF("ntfs_lookup: \"%.*s\" (%ld bytes) in %d, lp: %d, wp: %d \n", - (int)cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_namelen, + DPRINTF("ntfs_lookup: \"%.*s\" (%ld bytes) in %u, lp: %d, wp: %d \n", + (unsigned int)cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_namelen, dip->i_number, lockparent, wantparent); error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_proc); @@ -622,7 +621,7 @@ ntfs_lookup(void *v) return (error); if(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { - DPRINTF("ntfs_lookup: faking . directory in %d\n", + DPRINTF("ntfs_lookup: faking . directory in %u\n", dip->i_number); vref(dvp); @@ -631,7 +630,7 @@ ntfs_lookup(void *v) } else if (cnp->cn_flags & ISDOTDOT) { struct ntvattr *vap; - DPRINTF("ntfs_lookup: faking .. directory in %d\n", + DPRINTF("ntfs_lookup: faking .. directory in %u\n", dip->i_number); VOP_UNLOCK(dvp, 0, p); @@ -641,7 +640,7 @@ ntfs_lookup(void *v) if(error) return (error); - DPRINTF("ntfs_lookup: parentdir: %d\n", + DPRINTF("ntfs_lookup: parentdir: %u\n", vap->va_a_name->n_pnumber); error = VFS_VGET(ntmp->ntm_mountp, vap->va_a_name->n_pnumber,ap->a_vpp); @@ -667,7 +666,7 @@ ntfs_lookup(void *v) return (error); } - DPRINTF("ntfs_lookup: found ino: %d\n", + DPRINTF("ntfs_lookup: found ino: %u\n", VTONT(*ap->a_vpp)->i_number); if(!lockparent || (cnp->cn_flags & ISLASTCN) == 0) { |