diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2013-11-24 16:02:31 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2013-11-24 16:02:31 +0000 |
commit | cd311cef49499bea9f78c24ffbadfd431deced6e (patch) | |
tree | 3f4dc71efdc7e9305d1a62130b47d7373573facd /sys | |
parent | ed928a2b17edc445bcb0fcd087e74dc840880697 (diff) |
Clean up the NTFS debug code - use uppercase names for the debug macros,
especially since 'dprintf' now has another meaning (at least outside of
the kernel). Tweak the macro syntax so we can avoid having to double
bracket all invocations. Also apply a good dose of style(9).
ok krw@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ntfs/ntfs.h | 14 | ||||
-rw-r--r-- | sys/ntfs/ntfs_compr.c | 10 | ||||
-rw-r--r-- | sys/ntfs/ntfs_conv.c | 8 | ||||
-rw-r--r-- | sys/ntfs/ntfs_subr.c | 264 | ||||
-rw-r--r-- | sys/ntfs/ntfs_vfsops.c | 57 | ||||
-rw-r--r-- | sys/ntfs/ntfs_vnops.c | 89 |
6 files changed, 217 insertions, 225 deletions
diff --git a/sys/ntfs/ntfs.h b/sys/ntfs/ntfs.h index 5e02e8fb4b6..0e30899d3a4 100644 --- a/sys/ntfs/ntfs.h +++ b/sys/ntfs/ntfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs.h,v 1.16 2013/06/11 16:42:17 deraadt Exp $ */ +/* $OpenBSD: ntfs.h,v 1.17 2013/11/24 16:02:30 jsing Exp $ */ /* $NetBSD: ntfs.h,v 1.5 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -302,13 +302,13 @@ struct ntfsmount { #ifdef _KERNEL #if defined(NTFS_DEBUG) extern int ntfs_debug; -#define DPRINTF(X, Y) do { if(ntfs_debug >= (X)) printf Y; } while(0) -#define dprintf(a) DPRINTF(1, a) -#define ddprintf(a) DPRINTF(2, a) +#define DNPRINTF(n, x...) do { if(ntfs_debug >= (n)) printf(x); } while(0) +#define DPRINTF(x...) DNPRINTF(1, x) +#define DDPRINTF(x...) DNPRINTF(2, x) #else /* NTFS_DEBUG */ -#define DPRINTF(X, Y) -#define dprintf(a) -#define ddprintf(a) +#define DNPRINTF(n, x...) +#define DPRINTF(x...) +#define DDPRINTF(x...) #endif extern struct vops ntfs_vops; diff --git a/sys/ntfs/ntfs_compr.c b/sys/ntfs/ntfs_compr.c index ac9e3260a86..b2e0a6de430 100644 --- a/sys/ntfs/ntfs_compr.c +++ b/sys/ntfs/ntfs_compr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_compr.c,v 1.6 2013/01/14 02:41:03 jsing Exp $ */ +/* $OpenBSD: ntfs_compr.c,v 1.7 2013/11/24 16:02:30 jsing Exp $ */ /* $NetBSD: ntfs_compr.c,v 1.1 2002/12/23 17:38:31 jdolecek Exp $ */ /*- @@ -48,13 +48,13 @@ ntfs_uncompblock(u_int8_t *buf, u_int8_t *cbuf) int pos, cpos; len = GET_UINT16(cbuf) & 0xFFF; - dprintf(("ntfs_uncompblock: block length: %d + 3, 0x%x,0x%04x\n", - len, len, GET_UINT16(cbuf))); + DPRINTF("ntfs_uncompblock: block length: %d + 3, 0x%x,0x%04x\n", + len, len, GET_UINT16(cbuf)); if (!(GET_UINT16(cbuf) & 0x8000)) { if ((len + 1) != NTFS_COMPBLOCK_SIZE) { - dprintf(("ntfs_uncompblock: len: %x instead of %d\n", - len, 0xfff)); + DPRINTF("ntfs_uncompblock: len: %x instead of %d\n", + len, 0xfff); } memcpy(buf, cbuf + 2, len + 1); bzero(buf + len + 1, NTFS_COMPBLOCK_SIZE - 1 - len); diff --git a/sys/ntfs/ntfs_conv.c b/sys/ntfs/ntfs_conv.c index 1eab868c013..70d2b103eac 100644 --- a/sys/ntfs/ntfs_conv.c +++ b/sys/ntfs/ntfs_conv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_conv.c,v 1.8 2010/08/12 04:26:56 tedu Exp $ */ +/* $OpenBSD: ntfs_conv.c,v 1.9 2013/11/24 16:02:30 jsing Exp $ */ /* $NetBSD: ntfs_conv.c,v 1.1 2002/12/23 17:38:32 jdolecek Exp $ */ /*- @@ -100,7 +100,7 @@ ntfs_utf8_wput(char *s, size_t n, wchar wc) if (wc & 0xf800) { if (n < 3) { /* bound check failure */ - ddprintf(("ntfs_utf8_wput: need 3 bytes\n")); + DDPRINTF("ntfs_utf8_wput: need 3 bytes\n"); return 0; } @@ -112,7 +112,7 @@ ntfs_utf8_wput(char *s, size_t n, wchar wc) if (wc & 0x0780) { if (n < 2) { /* bound check failure */ - ddprintf(("ntfs_utf8_wput: need 2 bytes\n")); + DDPRINTF("ntfs_utf8_wput: need 2 bytes\n"); return 0; } @@ -122,7 +122,7 @@ ntfs_utf8_wput(char *s, size_t n, wchar wc) } else { if (n < 1) { /* bound check failure */ - ddprintf(("ntfs_utf8_wput: need 1 byte\n")); + DDPRINTF("ntfs_utf8_wput: need 1 byte\n"); return 0; } diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c index 4fd10e99af8..279e47d0942 100644 --- a/sys/ntfs/ntfs_subr.c +++ b/sys/ntfs/ntfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_subr.c,v 1.32 2013/06/11 16:42:17 deraadt Exp $ */ +/* $OpenBSD: ntfs_subr.c,v 1.33 2013/11/24 16:02:30 jsing Exp $ */ /* $NetBSD: ntfs_subr.c,v 1.4 2003/04/10 21:37:32 jdolecek Exp $ */ /*- @@ -87,8 +87,8 @@ static signed int ntfs_toupper_usecount; int ntfs_ntvattrrele(struct ntvattr *vap) { - dprintf(("ntfs_ntvattrrele: ino: %d, type: 0x%x\n", - vap->va_ip->i_number, vap->va_type)); + DPRINTF("ntfs_ntvattrrele: ino: %d, type: 0x%x\n", + vap->va_ip->i_number, vap->va_type); ntfs_ntrele(vap->va_ip); @@ -107,8 +107,8 @@ 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", - ip->i_number)); + DPRINTF("ntfs_findvattr: node not loaded, ino: %d\n", + ip->i_number); error = ntfs_loadntnode(ntmp,ip); if (error) { printf("ntfs_findvattr: FAILED TO LOAD INO: %d\n", @@ -124,9 +124,9 @@ 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: %d - %d\n", + vap->va_type, (u_int32_t)vap->va_vcnstart, + (u_int32_t)vap->va_vcnend); if ((vap->va_type == type) && (vap->va_vcnstart <= vcn) && (vap->va_vcnend >= vcn) && (vap->va_namelen == namelen) && @@ -165,14 +165,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: %d, type: 0x%x, name: %s, " + "vcn: %d\n", ip->i_number, type, name, (u_int32_t)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: %d, type: 0x%x, vcn: %d\n", + ip->i_number, type, (u_int32_t)vcn); name = ""; namelen = 0; } @@ -182,9 +180,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: %d, " + "type: 0x%x, name: %s, vcn: %d\n", ip->i_number, type, + name, (u_int32_t)vcn); return (ENOENT); } /* Scan $ATTRIBUTE_LIST for requested attribute */ @@ -199,10 +197,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: %d, attr: 0x%x, " + "vcn: %d\n", aalp->al_inumber, aalp->al_type, + (u_int32_t)aalp->al_vcnstart); if (len > aalp->reclen) { nextaalp = NTFS_NEXTREC(aalp, struct attr_attrlist *); @@ -216,8 +213,8 @@ 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", - aalp->al_inumber)); + DPRINTF("ntfs_ntvattrget: attribute in ino: %d\n", + aalp->al_inumber); /* this is not a main record, so we can't use just plain vget() */ @@ -241,9 +238,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: %d, type: 0x%x, " + "name: %.*s, vcn: %d\n", ip->i_number, type, (int)namelen, name, + (u_int32_t)vcn); out: free(alpool, M_TEMP); return (error); @@ -264,7 +261,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: %d\n", ip->i_number); KASSERT((ip->i_flag & IN_LOADED) == 0); @@ -273,8 +270,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: %d\n", oip->i_number); KASSERT((oip->i_flag & IN_LOADED)); oip->i_flag &= ~IN_LOADED; @@ -289,7 +285,7 @@ ntfs_loadntnode(struct ntfsmount *ntmp, struct ntnode *ip) if (ip->i_number < NTFS_SYSNODESNUM) { struct buf *bp; - dprintf(("ntfs_loadntnode: read system node\n")); + DPRINTF("ntfs_loadntnode: read system node\n"); bn = ntfs_cntobn(ntmp->ntm_mftcn) + ntmp->ntm_bpmftrec * ip->i_number; @@ -325,7 +321,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: %d\n", ip->i_number); off = mfrp->fr_attroff; ap = (struct attr *) ((caddr_t)mfrp + off); @@ -370,8 +366,8 @@ out: int ntfs_ntget(struct ntnode *ip, struct proc *p) { - dprintf(("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", - ip->i_number, ip, ip->i_usecount)); + DPRINTF("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", + ip->i_number, ip, ip->i_usecount); ip->i_usecount++; @@ -393,20 +389,20 @@ 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 %d\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", - ino, ip, ip->i_usecount)); + DPRINTF("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n", + ino, ip, ip->i_usecount); *ipp = ip; return (0); } } 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: %d: %p\n", ino, ip); /* Generic initialization */ ip->i_devvp = ntmp->ntm_devvp; @@ -427,8 +423,8 @@ ntfs_ntlookup(struct ntfsmount *ntmp, ntfsino_t ino, struct ntnode **ipp, *ipp = ip; - dprintf(("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n", - ino, ip, ip->i_usecount)); + DPRINTF("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n", + ino, ip, ip->i_usecount); return (0); } @@ -445,8 +441,8 @@ 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", - ip->i_number, ip, ip->i_usecount)); + DPRINTF("ntfs_ntput: rele ntnode %d: %p, usecount: %d\n", + ip->i_number, ip, ip->i_usecount); ip->i_usecount--; @@ -462,7 +458,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: %d\n", ip->i_number); if (LIST_FIRST(&ip->i_fnlist)) panic("ntfs_ntput: ntnode has fnodes"); @@ -492,9 +488,8 @@ ntfs_ntref(struct ntnode *ip) { ip->i_usecount++; - dprintf(("ntfs_ntref: ino %d, usecount: %d\n", - ip->i_number, ip->i_usecount)); - + DPRINTF("ntfs_ntref: ino %d, usecount: %d\n", + ip->i_number, ip->i_usecount); } /* @@ -503,8 +498,8 @@ ntfs_ntref(struct ntnode *ip) void ntfs_ntrele(struct ntnode *ip) { - dprintf(("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n", - ip->i_number, ip, ip->i_usecount)); + DPRINTF("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n", + ip->i_number, ip, ip->i_usecount); ip->i_usecount--; @@ -552,20 +547,20 @@ 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: %d", vap->va_type, vap->va_index); vap->va_namelen = rap->a_hdr.a_namelen; if (rap->a_hdr.a_namelen) { wchar *unp = (wchar *) ((caddr_t) rap + rap->a_hdr.a_nameoff); - ddprintf((", name:[")); + DDPRINTF(", name:["); for (i = 0; i < vap->va_namelen; i++) { vap->va_name[i] = unp[i]; - ddprintf(("%c", vap->va_name[i])); + DDPRINTF("%c", vap->va_name[i]); } - ddprintf(("]")); + DDPRINTF("]"); } if (vap->va_flag & NTFS_AF_INRUN) { - ddprintf((", nonres.")); + DDPRINTF(", nonres."); vap->va_datalen = rap->a_nr.a_datalen; vap->va_allocated = rap->a_nr.a_allocated; vap->va_vcnstart = rap->a_nr.a_vcnstart; @@ -576,7 +571,7 @@ ntfs_attrtontvattr(struct ntfsmount *ntmp, struct ntvattr **rvapp, (caddr_t) rap + rap->a_nr.a_dataoff); } else { vap->va_compressalg = 0; - ddprintf((", res.")); + DDPRINTF(", res."); vap->va_datalen = rap->a_r.a_datalen; vap->va_allocated = rap->a_r.a_datalen; vap->va_vcnstart = 0; @@ -585,14 +580,14 @@ 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: %d", vap->va_datalen); if (error) free(vap, M_NTFSNTVATTR); else *rvapp = vap; - ddprintf(("\n")); + DDPRINTF("\n"); return (error); } @@ -717,18 +712,18 @@ ntfs_fget(struct ntfsmount *ntmp, struct ntnode *ip, int attrtype, { struct fnode *fp; - dprintf(("ntfs_fget: ino: %d, attrtype: 0x%x, attrname: %s\n", - ip->i_number,attrtype, attrname?attrname:"")); + DPRINTF("ntfs_fget: ino: %d, 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", - fp->f_attrtype, fp->f_attrname?fp->f_attrname:"")); + DPRINTF("ntfs_fget: fnode: attrtype: %d, attrname: %s\n", + fp->f_attrtype, fp->f_attrname ? fp->f_attrname : ""); if ((attrtype == fp->f_attrtype) && ((!attrname && !fp->f_attrname) || (attrname && fp->f_attrname && !strcmp(attrname,fp->f_attrname)))){ - dprintf(("ntfs_fget: found existed: %p\n",fp)); + DPRINTF("ntfs_fget: found existed: %p\n", fp); *fpp = fp; } } @@ -737,7 +732,7 @@ ntfs_fget(struct ntfsmount *ntmp, struct ntnode *ip, int attrtype, return (0); fp = malloc(sizeof(*fp), M_NTFSFNODE, M_WAITOK | M_ZERO); - dprintf(("ntfs_fget: allocating fnode: %p\n",fp)); + DPRINTF("ntfs_fget: allocating fnode: %p\n", fp); fp->f_ip = ip; fp->f_attrname = attrname; @@ -763,9 +758,9 @@ 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 %d: %p\n", fp, ip->i_number, ip); - dprintf(("ntfs_frele: deallocating fnode\n")); + DPRINTF("ntfs_frele: deallocating fnode\n"); LIST_REMOVE(fp,f_fnlist); if (fp->f_flag & FN_AATTRNAME) free(fp->f_attrname, M_TEMP); @@ -873,19 +868,19 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, if(fname[fnamelen] == ':') { aname = fname + fnamelen + 1; anamelen = cnp->cn_namelen - fnamelen - 1; - dprintf(("ntfs_ntlookupfile: %s (%d), attr: %s (%d)\n", - fname, fnamelen, aname, anamelen)); + DPRINTF("ntfs_ntlookupfile: %s (%d), attr: %s (%d)\n", + fname, fnamelen, aname, anamelen); break; } blsize = vap->va_a_iroot->ir_size; - dprintf(("ntfs_ntlookupfile: blksz: %d\n", blsize)); + DPRINTF("ntfs_ntlookupfile: blksz: %d\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: %d\n", rdsize); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30", 0, rdsize, rdbuf, NULL); @@ -901,9 +896,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: %d, %d\n", (u_int32_t)iep->ie_number, + (u_int32_t)iep->ie_fnametype); /* check the name - the case-insensitive check * has to come first, to break from this for loop @@ -1017,7 +1011,7 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, /* Dive if possible */ if (iep->ie_flag & NTFS_IEFLAG_SUBNODE) { - dprintf(("ntfs_ntlookupfile: diving\n")); + DPRINTF("ntfs_ntlookupfile: diving\n"); cn = *(cn_t *) (rdbuf + aoff + iep->reclen - sizeof(cn_t)); @@ -1057,7 +1051,7 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, lookup_ctx = lookup_ctx->prev; free(tctx, M_TEMP); } else { - dprintf(("ntfs_ntlookupfile: nowhere to dive :-(\n")); + DPRINTF("ntfs_ntlookupfile: nowhere to dive :-(\n"); error = ENOENT; break; } @@ -1068,12 +1062,12 @@ ntfs_ntlookupfile(struct ntfsmount *ntmp, struct vnode *vp, fullscan = 1; cn = 0; /* need zero, used by lookup_ctx */ - ddprintf(("ntfs_ntlookupfile: fullscan performed for: %.*s\n", - (int) fnamelen, fname)); + DDPRINTF("ntfs_ntlookupfile: fullscan performed for: %.*s\n", + (int)fnamelen, fname); goto loop; } - dprintf(("finish\n")); + DPRINTF("finish\n"); fail: if (vap) @@ -1104,7 +1098,7 @@ ntfs_isnamepermitted(struct ntfsmount *ntmp, struct attr_indexentry *iep) switch (iep->ie_fnametype) { case 2: - ddprintf(("ntfs_isnamepermitted: skipped DOS name\n")); + DDPRINTF("ntfs_isnamepermitted: skipped DOS name\n"); return 0; case 0: case 1: case 3: return 1; @@ -1144,7 +1138,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: %d, num: %d\n", ip->i_number, num); error = ntfs_ntget(ip, p); if (error) return (error); @@ -1164,7 +1158,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: %d\n", rdbuf, blsize); if (vap->va_a_iroot->ir_flag & NTFS_IRFLAG_INDXALLOC) { error = ntfs_ntvattrget(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", @@ -1186,10 +1180,10 @@ 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", - iavap->va_datalen, cpbl)); + DPRINTF("ntfs_ntreaddir: indexalloc: %d, cpbl: %d\n", + iavap->va_datalen, cpbl); } else { - dprintf(("ntfs_ntreadidir: w/o BitMap and IndexAllocation\n")); + DPRINTF("ntfs_ntreadidir: w/o BitMap and IndexAllocation\n"); iavap = bmvap = NULL; bmp = NULL; } @@ -1208,8 +1202,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, %d, %d, %d, %d\n", + attrnum, (u_int32_t)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); @@ -1264,7 +1258,8 @@ 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: %d\n", + (u_int32_t)blnum); } } while (iavap); @@ -1316,7 +1311,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: %d\n", ip->i_number); error = ntfs_ntvattrget(ntmp, ip, fp->f_attrtype, fp->f_attrname, 0, &vap); @@ -1326,8 +1321,8 @@ 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: %d bytes (%d bytes allocated)\n", + (u_int32_t)sz, (u_int32_t)bn); if (size) *size = sz; @@ -1360,20 +1355,19 @@ 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: %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); error = ntfs_writentvattr_plain(ntmp, ip, vap, off - ntfs_cntob(vap->va_vcnstart), towrite, data, &init, uio); if (error) { - dprintf(("ntfs_writeattr_plain: " \ - "ntfs_writentvattr_plain failed: o: %d, s: %d\n", - (u_int32_t) off, (u_int32_t) towrite)); - dprintf(("ntfs_writeattr_plain: attrib: %d - %d\n", - (u_int32_t) vap->va_vcnstart, - (u_int32_t) vap->va_vcnend)); + DPRINTF("ntfs_writeattr_plain: ntfs_writentvattr_plain " + "failed: o: %d, s: %d\n", + (u_int32_t)off, (u_int32_t)towrite); + DPRINTF("ntfs_writeattr_plain: attrib: %d - %d\n", + (u_int32_t)vap->va_vcnstart, + (u_int32_t)vap->va_vcnend); ntfs_ntvattrrele(vap); break; } @@ -1408,12 +1402,12 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, *initp = 0; if ((vap->va_flag & NTFS_AF_INRUN) == 0) { - dprintf(("ntfs_writevattr_plain: CAN'T WRITE RES. ATTRIBUTE\n")); + DPRINTF("ntfs_writevattr_plain: CAN'T WRITE RES. ATTRIBUTE\n"); return ENOTTY; } - ddprintf(("ntfs_writentvattr_plain: data in run: %lu chains\n", - vap->va_vruncnt)); + DDPRINTF("ntfs_writentvattr_plain: data in run: %lu chains\n", + vap->va_vruncnt); off = roff; left = rsize; @@ -1424,10 +1418,9 @@ 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 %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); if (ntfs_cntob(ccl) < off) { off -= ntfs_cntob(ccl); @@ -1451,11 +1444,10 @@ 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%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); if ((off == 0) && (tocopy == ntfs_cntob(cl))) { bp = getblk(ntmp->ntm_devvp, ntfs_cntobn(cn), @@ -1514,8 +1506,8 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, struct buf *bp; size_t tocopy; - ddprintf(("ntfs_readntvattr_plain: data in run: %lu chains\n", - vap->va_vruncnt)); + DDPRINTF("ntfs_readntvattr_plain: data in run: %lu chains\n", + vap->va_vruncnt); off = roff; left = rsize; @@ -1526,10 +1518,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 %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); if (ntfs_cntob(ccl) < off) { off -= ntfs_cntob(ccl); @@ -1555,14 +1546,12 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, KASSERT(cl == 1 && 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)); + 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); error = bread(ntmp->ntm_devvp, ntfs_cntobn(cn), ntfs_cntob(cl), @@ -1590,12 +1579,12 @@ 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)); + 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); left -= tocopy; off = 0; if (uio) { @@ -1618,7 +1607,7 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip, error = E2BIG; } } else { - ddprintf(("ntfs_readnvattr_plain: data is in mft record\n")); + DDPRINTF("ntfs_readnvattr_plain: data is in mft record\n"); if (uio) error = uiomove(vap->va_datap + roff, rsize, uio); else @@ -1650,10 +1639,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: %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); error = ntfs_readntvattr_plain(ntmp, ip, vap, off - ntfs_cntob(vap->va_vcnstart), toread, data, &init, uio); @@ -1688,8 +1676,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 %d: 0x%x, from %d size %d bytes\n", + ip->i_number, attrnum, (u_int32_t)roff, (u_int32_t)rsize); error = ntfs_ntvattrget(ntmp, ip, attrnum, attrname, 0, &vap); if (error) @@ -1710,8 +1698,8 @@ 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", - vap->va_compressalg)); + DDPRINTF("ntfs_ntreadattr: compression: %d\n", + vap->va_compressalg); cup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL), M_NTFSDECOMP, M_WAITOK); diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c index a1b959e12f5..915f8b46953 100644 --- a/sys/ntfs/ntfs_vfsops.c +++ b/sys/ntfs/ntfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vfsops.c,v 1.35 2013/05/30 20:11:06 guenther Exp $ */ +/* $OpenBSD: ntfs_vfsops.c,v 1.36 2013/11/24 16:02:30 jsing Exp $ */ /* $NetBSD: ntfs_vfsops.c,v 1.7 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -323,7 +323,7 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, if (strncmp(ntmp->ntm_bootfile.bf_sysid, NTFS_BBID, NTFS_BBIDLEN)) { error = EINVAL; - dprintf(("ntfs_mountfs: invalid boot block\n")); + DPRINTF("ntfs_mountfs: invalid boot block\n"); goto out; } @@ -334,11 +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,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(): bps: %d, spc: %d, media: %x, " + "mftrecsz: %d (%d 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); ntmp->ntm_mountp = mp; ntmp->ntm_dev = dev; @@ -355,10 +356,10 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, ntmp->ntm_wput = ntfs_utf8_wput; ntmp->ntm_wcmp = ntfs_utf8_wcmp; - dprintf(("ntfs_mountfs(): case-%s,%s uid: %d, gid: %d, mode: %o\n", - (ntmp->ntm_flag & NTFS_MFLAG_CASEINS)?"insens.":"sens.", - (ntmp->ntm_flag & NTFS_MFLAG_ALLNAMES)?" allnames,":"", - ntmp->ntm_uid, ntmp->ntm_gid, ntmp->ntm_mode)); + DPRINTF("ntfs_mountfs(): case-%s,%s uid: %d, gid: %d, mode: %o\n", + (ntmp->ntm_flag & NTFS_MFLAG_CASEINS) ? "insens." : "sens.", + (ntmp->ntm_flag & NTFS_MFLAG_ALLNAMES) ? " allnames," : "", + ntmp->ntm_uid, ntmp->ntm_gid, ntmp->ntm_mode); /* * We read in some system nodes to do not allow @@ -449,7 +450,7 @@ out1: vrele(ntmp->ntm_sysvn[i]); if (vflush(mp,NULLVP,0)) - dprintf(("ntfs_mountfs: vflush failed\n")); + DPRINTF("ntfs_mountfs: vflush failed\n"); out: devvp->v_specmountpoint = NULL; @@ -483,17 +484,17 @@ ntfs_unmount(struct mount *mp, int mntflags, struct proc *p) struct ntfsmount *ntmp; int error, ronly = 0, flags, i; - dprintf(("ntfs_unmount: unmounting...\n")); + DPRINTF("ntfs_unmount: unmounting...\n"); ntmp = VFSTONTFS(mp); flags = 0; if(mntflags & MNT_FORCE) flags |= FORCECLOSE; - dprintf(("ntfs_unmount: vflushing...\n")); + DPRINTF("ntfs_unmount: vflushing...\n"); error = vflush(mp,NULLVP,flags | SKIPSYSTEM); if (error) { - dprintf(("ntfs_unmount: vflush failed: %d\n",error)); + DPRINTF("ntfs_unmount: vflush failed: %d\n", error); return (error); } @@ -534,7 +535,7 @@ ntfs_unmount(struct mount *mp, int mntflags, struct proc *p) /* free the toupper table, if this has been last mounted ntfs volume */ ntfs_toupper_unuse(p); - dprintf(("ntfs_unmount: freeing memory...\n")); + DPRINTF("ntfs_unmount: freeing memory...\n"); mp->mnt_data = NULL; mp->mnt_flag &= ~MNT_LOCAL; free(ntmp->ntm_ad, M_NTFSMNT); @@ -548,8 +549,8 @@ ntfs_root(struct mount *mp, struct vnode **vpp) struct vnode *nvp; int error = 0; - dprintf(("ntfs_root(): sysvn: %p\n", - VFSTONTFS(mp)->ntm_sysvn[NTFS_ROOTINO])); + DPRINTF("ntfs_root(): sysvn: %p\n", + VFSTONTFS(mp)->ntm_sysvn[NTFS_ROOTINO]); error = VFS_VGET(mp, (ino_t)NTFS_ROOTINO, &nvp); if(error) { printf("ntfs_root: VFS_VGET failed: %d\n",error); @@ -606,7 +607,7 @@ ntfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) struct ntfsmount *ntmp = VFSTONTFS(mp); u_int64_t mftallocated; - dprintf(("ntfs_statfs():\n")); + DPRINTF("ntfs_statfs():\n"); mftallocated = VTOF(ntmp->ntm_sysvn[NTFS_MFTINO])->f_allocated; @@ -632,7 +633,7 @@ ntfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) int ntfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct proc *p) { - /*dprintf(("ntfs_sync():\n"));*/ + /*DPRINTF("ntfs_sync():\n");*/ return (0); } @@ -642,8 +643,8 @@ 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", mp->mnt_stat.f_mntonname, - ntfhp->ntfid_ino)); + DDPRINTF("ntfs_fhtovp(): %s: %d\n", + mp->mnt_stat.f_mntonname, ntfhp->ntfid_ino); error = ntfs_vgetex(mp, ntfhp->ntfid_ino, ntfhp->ntfid_attr, NULL, LK_EXCLUSIVE | LK_RETRY, 0, curproc, vpp); /* XXX */ @@ -664,8 +665,8 @@ ntfs_vptofh(struct vnode *vp, struct fid *fhp) struct ntfid *ntfhp; struct fnode *fn; - ddprintf(("ntfs_fhtovp(): %s: %p\n", vp->v_mount->mnt_stat.f_mntonname, - vp)); + DDPRINTF("ntfs_fhtovp(): %s: %p\n", + vp->v_mount->mnt_stat.f_mntonname, vp); fn = VTOF(vp); ntp = VTONT(vp); @@ -690,9 +691,9 @@ 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: %d, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", + ino, attrtype, attrname ? attrname : "", (u_long)lkflags, + (u_long)flags); ntmp = VFSTONTFS(mp); *vpp = NULL; @@ -770,7 +771,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: %d\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 bbaa72d08f1..f132f12ed6b 100644 --- a/sys/ntfs/ntfs_vnops.c +++ b/sys/ntfs/ntfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vnops.c,v 1.31 2013/08/13 05:52:26 guenther Exp $ */ +/* $OpenBSD: ntfs_vnops.c,v 1.32 2013/11/24 16:02:30 jsing Exp $ */ /* $NetBSD: ntfs_vnops.c,v 1.6 2003/04/10 21:57:26 jdolecek Exp $ */ /* @@ -81,7 +81,7 @@ 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: %d\n", ap->a_vp, (u_int32_t)ap->a_bn); if (ap->a_vpp != NULL) *ap->a_vpp = ap->a_vp; if (ap->a_bnp != NULL) @@ -103,9 +103,11 @@ 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: %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: filesize: %d",(u_int32_t)fp->f_size)); + DPRINTF("ntfs_read: filesize: %d", (u_int32_t)fp->f_size); /* don't allow reading after end of file */ if (uio->uio_offset > fp->f_size) @@ -113,7 +115,7 @@ ntfs_read(void *v) else toread = MIN(uio->uio_resid, fp->f_size - uio->uio_offset ); - dprintf((", toread: %d\n",(u_int32_t)toread)); + DPRINTF(", toread: %d\n", (u_int32_t)toread); if (toread == 0) return (0); @@ -137,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: %d, flags: %d\n", ip->i_number, ip->i_flag); vap->va_fsid = ip->i_dev; vap->va_fileid = ip->i_number; @@ -183,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: %d\n", vp, ip->i_number); #ifdef DIAGNOSTIC if (ntfs_prtactive && vp->v_usecount != 0) @@ -211,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: %d\n", vp, ip->i_number); #ifdef DIAGNOSTIC if (ntfs_prtactive && vp->v_usecount != 0) @@ -259,12 +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: %d, lblkno: %d\n", + (u_int32_t)bp->b_blkno, (u_int32_t)bp->b_lblkno); - dprintf(("strategy: bcount: %u flags: 0x%x\n", - (u_int32_t)bp->b_bcount,bp->b_flags)); + DPRINTF("strategy: bcount: %u flags: 0x%x\n", + (u_int32_t)bp->b_bcount, bp->b_flags); if (bp->b_flags & B_READ) { u_int32_t toread; @@ -275,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: %d, fsize: %d\n", + toread, (u_int32_t)fp->f_size); error = ntfs_readattr(ntmp, ip, fp->f_attrtype, fp->f_attrname, ntfs_cntob(bp->b_blkno), @@ -301,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: %d, fsize: %d\n", + towrite, (u_int32_t)fp->f_size); error = ntfs_writeattr_plain(ntmp, ip, fp->f_attrtype, fp->f_attrname, ntfs_cntob(bp->b_blkno),towrite, @@ -334,8 +335,10 @@ 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: %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); if (uio->uio_resid + uio->uio_offset > fp->f_size) { printf("ntfs_write: CAN'T WRITE BEYOND END OF FILE\n"); @@ -344,7 +347,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: %d\n", (u_int32_t)towrite); error = ntfs_writeattr_plain(ntmp, ip, fp->f_attrtype, fp->f_attrname, uio->uio_offset, towrite, NULL, &written, uio); @@ -367,7 +370,7 @@ ntfs_access(void *v) gid_t *gp; int i; - dprintf(("ntfs_access: %d\n",ip->i_number)); + DPRINTF("ntfs_access: %d\n", ip->i_number); /* * Disallow write attempts on read-only file systems; @@ -480,8 +483,8 @@ ntfs_readdir(void *v) struct dirent *cde; off_t off; - dprintf(("ntfs_readdir %d off: %lld resid: %d\n", ip->i_number, - uio->uio_offset, uio->uio_resid)); + DPRINTF("ntfs_readdir %d off: %lld resid: %d\n", ip->i_number, + uio->uio_offset, uio->uio_resid); off = uio->uio_offset; @@ -545,14 +548,14 @@ ntfs_readdir(void *v) remains -= sz; } *fname = '\0'; - dprintf(("ntfs_readdir: elem: %d, fname:[%s] type: %d, flag: %d, ", - num, cde->d_name, iep->ie_fnametype, - iep->ie_flag)); + DPRINTF("ntfs_readdir: elem: %d, fname:[%s] type: %d, " + "flag: %d, ", + num, cde->d_name, iep->ie_fnametype, iep->ie_flag); cde->d_namlen = fname - (char *) cde->d_name; cde->d_fileno = iep->ie_number; cde->d_type = (iep->ie_fflag & NTFS_FFLAG_DIR) ? DT_DIR : DT_REG; cde->d_reclen = sizeof(struct dirent); - dprintf(("%s\n", (cde->d_type == DT_DIR) ? "dir":"reg")); + DPRINTF("%s\n", cde->d_type == DT_DIR ? "dir" : "reg"); error = uiomove((void *)cde, sizeof(struct dirent), uio); if (error) @@ -561,10 +564,10 @@ ntfs_readdir(void *v) } } - dprintf(("ntfs_readdir: %d entries (%d bytes) read\n", - ncookies,(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: %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); /* if (ap->a_eofflag) @@ -594,9 +597,9 @@ 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, - dip->i_number, lockparent, wantparent)); + DPRINTF("ntfs_lookup: \"%.*s\" (%ld bytes) in %d, lp: %d, wp: %d \n", + (int)cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_namelen, + dip->i_number, lockparent, wantparent); error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_proc); if(error) @@ -619,8 +622,8 @@ ntfs_lookup(void *v) return (error); if(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { - dprintf(("ntfs_lookup: faking . directory in %d\n", - dip->i_number)); + DPRINTF("ntfs_lookup: faking . directory in %d\n", + dip->i_number); vref(dvp); *ap->a_vpp = dvp; @@ -628,8 +631,8 @@ ntfs_lookup(void *v) } else if (cnp->cn_flags & ISDOTDOT) { struct ntvattr *vap; - dprintf(("ntfs_lookup: faking .. directory in %d\n", - dip->i_number)); + DPRINTF("ntfs_lookup: faking .. directory in %d\n", + dip->i_number); VOP_UNLOCK(dvp, 0, p); cnp->cn_flags |= PDIRUNLOCK; @@ -638,8 +641,8 @@ ntfs_lookup(void *v) if(error) return (error); - dprintf(("ntfs_lookup: parentdir: %d\n", - vap->va_a_name->n_pnumber)); + DPRINTF("ntfs_lookup: parentdir: %d\n", + vap->va_a_name->n_pnumber); error = VFS_VGET(ntmp->ntm_mountp, vap->va_a_name->n_pnumber,ap->a_vpp); ntfs_ntvattrrele(vap); @@ -660,12 +663,12 @@ ntfs_lookup(void *v) } else { error = ntfs_ntlookupfile(ntmp, dvp, cnp, ap->a_vpp, p); if (error) { - dprintf(("ntfs_ntlookupfile: returned %d\n", error)); + DPRINTF("ntfs_ntlookupfile: returned %d\n", error); return (error); } - dprintf(("ntfs_lookup: found ino: %d\n", - VTONT(*ap->a_vpp)->i_number)); + DPRINTF("ntfs_lookup: found ino: %d\n", + VTONT(*ap->a_vpp)->i_number); if(!lockparent || (cnp->cn_flags & ISLASTCN) == 0) { VOP_UNLOCK(dvp, 0, p); |