summaryrefslogtreecommitdiff
path: root/sys/ntfs/ntfs_subr.c
diff options
context:
space:
mode:
authorStefan Kempf <stefan@cvs.openbsd.org>2016-02-07 09:31:15 +0000
committerStefan Kempf <stefan@cvs.openbsd.org>2016-02-07 09:31:15 +0000
commit000ab557e6de31cee4f0c422790e3e3782ec4285 (patch)
tree56a96d2c88834665ebb85e0a8c32073e6773dff2 /sys/ntfs/ntfs_subr.c
parent3f165897ac301bbf946a15ff82ff3260ae36cb20 (diff)
Convert to uiomove. While there, use size_t consistently for
variables 'left' and 'tocopy' and adapt printf and DPRINTF format strings accordingly. From Martin Natano.
Diffstat (limited to 'sys/ntfs/ntfs_subr.c')
-rw-r--r--sys/ntfs/ntfs_subr.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c
index 1ed82730962..773e36d21a7 100644
--- a/sys/ntfs/ntfs_subr.c
+++ b/sys/ntfs/ntfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_subr.c,v 1.44 2015/03/14 03:38:52 jsg Exp $ */
+/* $OpenBSD: ntfs_subr.c,v 1.45 2016/02/07 09:31:14 stefan Exp $ */
/* $NetBSD: ntfs_subr.c,v 1.4 2003/04/10 21:37:32 jdolecek Exp $ */
/*-
@@ -1340,7 +1340,8 @@ ntfs_writeattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
{
size_t init;
int error = 0;
- off_t off = roff, left = rsize, towrite;
+ off_t off = roff;
+ size_t left = rsize, towrite;
caddr_t data = rdata;
struct ntvattr *vap;
*initp = 0;
@@ -1351,7 +1352,7 @@ 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: %lld, s: %lld "
+ DDPRINTF("ntfs_writeattr_plain: o: %lld, s: %zu "
"(%llu - %llu)\n", off, towrite,
vap->va_vcnstart, vap->va_vcnend);
error = ntfs_writentvattr_plain(ntmp, ip, vap,
@@ -1359,11 +1360,9 @@ ntfs_writeattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
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);
+ "failed: o: %lld, s: %zu\n", off, towrite);
+ DPRINTF("ntfs_writeattr_plain: attrib: %llu - %llu\n",
+ vap->va_vcnstart, vap->va_vcnend);
ntfs_ntvattrrele(vap);
break;
}
@@ -1390,10 +1389,10 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
int error = 0;
off_t off;
int cnt;
- cn_t ccn, ccl, cn, left, cl;
+ cn_t ccn, ccl, cn, cl;
caddr_t data = rdata;
struct buf *bp;
- size_t tocopy;
+ size_t left, tocopy;
*initp = 0;
@@ -1414,7 +1413,7 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
ccn = vap->va_vruncn[cnt];
ccl = vap->va_vruncl[cnt];
- DDPRINTF("ntfs_writentvattr_plain: left %llu, cn: 0x%llx, "
+ DDPRINTF("ntfs_writentvattr_plain: left %zu, cn: 0x%llx, "
"cl: %llu, off: %lld\n", left, ccn, ccl, off);
if (ntfs_cntob(ccl) < off) {
@@ -1440,7 +1439,7 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
cl = ntfs_btocl(tocopy + off);
KASSERT(cl == 1 && tocopy <= ntfs_cntob(1));
DDPRINTF("ntfs_writentvattr_plain: write: cn: 0x%llx "
- "cl: %llu, off: %lld len: %llu, left: %llu\n",
+ "cl: %llu, off: %lld len: %zu, left: %zu\n",
cn, cl, off, tocopy, left);
if ((off == 0) && (tocopy == ntfs_cntob(cl)))
{
@@ -1456,7 +1455,7 @@ ntfs_writentvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
}
}
if (uio) {
- error = uiomovei(bp->b_data + off, tocopy, uio);
+ error = uiomove(bp->b_data + off, tocopy, uio);
if (error != 0)
break;
} else
@@ -1495,10 +1494,10 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
*initp = 0;
if (vap->va_flag & NTFS_AF_INRUN) {
int cnt;
- cn_t ccn, ccl, cn, left, cl;
+ cn_t ccn, ccl, cn, cl;
caddr_t data = rdata;
struct buf *bp;
- size_t tocopy;
+ size_t left, tocopy;
DDPRINTF("ntfs_readntvattr_plain: data in run: %lu chains\n",
vap->va_vruncnt);
@@ -1512,7 +1511,7 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
ccn = vap->va_vruncn[cnt];
ccl = vap->va_vruncl[cnt];
- DDPRINTF("ntfs_readntvattr_plain: left %llu, "
+ DDPRINTF("ntfs_readntvattr_plain: left %zu, "
"cn: 0x%llx, cl: %llu, off: %lld\n",
left, ccn, ccl, off);
@@ -1542,8 +1541,8 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
DDPRINTF("ntfs_readntvattr_plain: "
"read: cn: 0x%llx cl: %llu, "
- "off: %lld, len: %llu, "
- "left: %llu\n",
+ "off: %lld, len: %zu, "
+ "left: %zu\n",
cn, cl, off, tocopy, left);
error = bread(ntmp->ntm_devvp,
ntfs_cntobn(cn),
@@ -1554,7 +1553,7 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
return (error);
}
if (uio) {
- error = uiomovei(bp->b_data + off,
+ error = uiomove(bp->b_data + off,
tocopy, uio);
if (error != 0)
break;
@@ -1574,7 +1573,7 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
tocopy = MIN(left, ntfs_cntob(ccl) - off);
DDPRINTF("ntfs_readntvattr_plain: hole: "
"ccn: 0x%llx ccl: %llu, off: %lld, "
- "len: %llu, left: %llu\n",
+ "len: %zu, left: %zu\n",
ccn, ccl, off, tocopy, left);
left -= tocopy;
off = 0;
@@ -1600,7 +1599,7 @@ ntfs_readntvattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
} else {
DDPRINTF("ntfs_readnvattr_plain: data is in mft record\n");
if (uio)
- error = uiomovei(vap->va_datap + roff, rsize, uio);
+ error = uiomove(vap->va_datap + roff, rsize, uio);
else
memcpy(rdata, vap->va_datap + roff, rsize);
*initp += rsize;
@@ -1619,7 +1618,8 @@ ntfs_readattr_plain(struct ntfsmount *ntmp, struct ntnode *ip,
{
size_t init;
int error = 0;
- off_t off = roff, left = rsize, toread;
+ off_t off = roff;
+ size_t left = rsize, toread;
caddr_t data = rdata;
struct ntvattr *vap;
*initp = 0;
@@ -1630,19 +1630,17 @@ 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: %lld, s: %lld "
+ DDPRINTF("ntfs_readattr_plain: o: %lld, s: %zu "
"(%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);
if (error) {
- printf("ntfs_readattr_plain: " \
- "ntfs_readntvattr_plain failed: o: %d, s: %d\n",
- (u_int32_t) off, (u_int32_t) toread);
- printf("ntfs_readattr_plain: attrib: %d - %d\n",
- (u_int32_t) vap->va_vcnstart,
- (u_int32_t) vap->va_vcnend);
+ printf("ntfs_readattr_plain: ntfs_readntvattr_plain "
+ "failed: o: %lld, s: %zu\n", off, toread);
+ printf("ntfs_readattr_plain: attrib: %llu - %llu\n",
+ vap->va_vcnstart, vap->va_vcnend);
ntfs_ntvattrrele(vap);
break;
}
@@ -1684,9 +1682,10 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum,
if (vap->va_compression && vap->va_compressalg) {
u_int8_t *cup;
u_int8_t *uup;
- off_t off = roff, left = rsize, tocopy;
+ off_t off = roff;
caddr_t data = rdata;
cn_t cn;
+ size_t left = rsize, tocopy;
DDPRINTF("ntfs_ntreadattr: compression: %u\n",
vap->va_compressalg);
@@ -1711,7 +1710,7 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum,
if (init == ntfs_cntob(NTFS_COMPUNIT_CL)) {
if (uio)
- error = uiomovei(cup + off, tocopy, uio);
+ error = uiomove(cup + off, tocopy, uio);
else
memcpy(data, cup + off, tocopy);
} else if (init == 0) {
@@ -1730,7 +1729,7 @@ ntfs_readattr(struct ntfsmount *ntmp, struct ntnode *ip, u_int32_t attrnum,
if (error)
break;
if (uio)
- error = uiomovei(uup + off, tocopy, uio);
+ error = uiomove(uup + off, tocopy, uio);
else
memcpy(data, uup + off, tocopy);
}