From 394f27b845bb8f3ea95f4f172b46575d7240f824 Mon Sep 17 00:00:00 2001 From: mdf Date: Thu, 27 Sep 2012 23:30:49 +0000 Subject: Fix up kernel sources to be ready for a 64-bit ino_t. Original code by: Gleb Kurtsou --- sys/fs/ext2fs/ext2_alloc.c | 4 +- sys/fs/ext2fs/ext2_inode_cnv.c | 2 +- sys/fs/hpfs/hpfs_vfsops.c | 2 +- sys/fs/ntfs/ntfs_subr.c | 102 +++++++++++++++++++++-------------------- sys/fs/ntfs/ntfs_vfsops.c | 12 ++--- sys/fs/ntfs/ntfs_vnops.c | 18 +++++--- sys/fs/tmpfs/tmpfs_vfsops.c | 3 +- 7 files changed, 76 insertions(+), 67 deletions(-) (limited to 'sys/fs') diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 15d938c..7867a87 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -1026,8 +1026,8 @@ ext2_vfree(pvp, ino, mode) fs = pip->i_e2fs; ump = pip->i_ump; if ((u_int)ino > fs->e2fs_ipg * fs->e2fs_gcount) - panic("ext2_vfree: range: devvp = %p, ino = %d, fs = %s", - pip->i_devvp, ino, fs->e2fs_fsmnt); + panic("ext2_vfree: range: devvp = %p, ino = %ju, fs = %s", + pip->i_devvp, (uintmax_t)ino, fs->e2fs_fsmnt); cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index 20361a7..aff44d9 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -45,7 +45,7 @@ ext2_print_inode( in ) { int i; - printf( "Inode: %5d", in->i_number); + printf( "Inode: %5ju", (uintmax_t)in->i_number); printf( /* "Inode: %5d" */ " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", "n/a", in->i_mode, in->i_flags, in->i_gen); diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 67355e2..edc37b2 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -512,7 +512,7 @@ hpfs_vget( error = bread(hpmp->hpm_devvp, ino, FNODESIZE, NOCRED, &bp); if (error) { - printf("hpfs_vget: can't read ino %d\n",ino); + printf("hpfs_vget: can't read ino %ju\n", (uintmax_t)ino); vput(vp); return (error); } diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index f3ac646..dae7777 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -84,8 +84,8 @@ int ntfs_ntvattrrele(vap) struct ntvattr * vap; { - dprintf(("ntfs_ntvattrrele: ino: %d, type: 0x%x\n", - vap->va_ip->i_number, vap->va_type)); + dprintf(("ntfs_ntvattrrele: ino: %ju, type: 0x%x\n", + (uintmax_t)vap->va_ip->i_number, vap->va_type)); ntfs_ntrele(vap->va_ip); @@ -109,12 +109,12 @@ ntfs_findvattr(ntmp, ip, lvapp, vapp, type, name, namelen, vcn) 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: %ju\n", + (uintmax_t)ip->i_number)); error = ntfs_loadntnode(ntmp,ip); if (error) { - printf("ntfs_findvattr: FAILED TO LOAD INO: %d\n", - ip->i_number); + printf("ntfs_findvattr: FAILED TO LOAD INO: %ju\n", + (uintmax_t)ip->i_number); return (error); } } @@ -169,13 +169,13 @@ ntfs_ntvattrget( if (name) { dprintf(("ntfs_ntvattrget: " \ - "ino: %d, type: 0x%x, name: %s, vcn: %d\n", \ - ip->i_number, type, name, (u_int32_t) vcn)); + "ino: %ju, type: 0x%x, name: %s, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, name, (uint32_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)); + "ino: %ju, type: 0x%x, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, (uint32_t)vcn)); name = ""; namelen = 0; } @@ -186,8 +186,8 @@ ntfs_ntvattrget( 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)); + "ino: %ju, type: 0x%x, name: %s, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, name, (uint32_t)vcn)); return (ENOENT); } /* Scan $ATTRIBUTE_LIST for requested attribute */ @@ -203,9 +203,9 @@ ntfs_ntvattrget( 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)); + "attrlist: ino: %ju, attr: 0x%x, vcn: %d\n", \ + (uintmax_t)aalp->al_inumber, aalp->al_type, \ + (uint32_t)aalp->al_vcnstart)); if (len > aalp->reclen) { nextaalp = NTFS_NEXTREC(aalp, struct attr_attrlist *); @@ -219,8 +219,8 @@ ntfs_ntvattrget( NTFS_AALPCMP(nextaalp, type, name, namelen))) continue; - dprintf(("ntfs_ntvattrget: attribute in ino: %d\n", - aalp->al_inumber)); + dprintf(("ntfs_ntvattrget: attribute in ino: %ju\n", + (uintmax_t)aalp->al_inumber)); /* this is not a main record, so we can't use just plain vget() */ @@ -228,8 +228,8 @@ ntfs_ntvattrget( NTFS_A_DATA, NULL, LK_EXCLUSIVE, VG_EXT, curthread, &newvp); if (error) { - printf("ntfs_ntvattrget: CAN'T VGET INO: %d\n", - aalp->al_inumber); + printf("ntfs_ntvattrget: CAN'T VGET INO: %ju\n", + (uintmax_t)aalp->al_inumber); goto out; } newip = VTONT(newvp); @@ -245,8 +245,8 @@ ntfs_ntvattrget( 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)); + "ino: %ju, type: 0x%x, name: %.*s, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, (int)namelen, name, (uint32_t)vcn)); out: free(alpool, M_TEMP); return (error); @@ -268,7 +268,8 @@ ntfs_loadntnode( struct attr *ap; struct ntvattr *nvap; - dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number)); + dprintf(("ntfs_loadntnode: loading ino: %ju\n", + (uintmax_t)ip->i_number)); mfrp = malloc(ntfs_bntob(ntmp->ntm_bpmftrec), M_TEMP, M_WAITOK); @@ -309,12 +310,13 @@ ntfs_loadntnode( error = ntfs_procfixups(ntmp, NTFS_FILEMAGIC, (caddr_t)mfrp, ntfs_bntob(ntmp->ntm_bpmftrec)); if (error) { - printf("ntfs_loadntnode: BAD MFT RECORD %d\n", - (u_int32_t) ip->i_number); + printf("ntfs_loadntnode: BAD MFT RECORD %ju\n", + (uintmax_t)ip->i_number); goto out; } - dprintf(("ntfs_loadntnode: load attrs for ino: %d\n",ip->i_number)); + dprintf(("ntfs_loadntnode: load attrs for ino: %ju\n", + (uintmax_t)ip->i_number)); off = mfrp->fr_attroff; ap = (struct attr *) ((caddr_t)mfrp + off); @@ -332,8 +334,8 @@ ntfs_loadntnode( ap = (struct attr *) ((caddr_t)mfrp + off); } if (error) { - printf("ntfs_loadntnode: failed to load attr ino: %d\n", - ip->i_number); + printf("ntfs_loadntnode: failed to load attr ino: %ju\n", + (uintmax_t)ip->i_number); goto out; } @@ -356,8 +358,8 @@ int ntfs_ntget(ip) struct ntnode *ip; { - dprintf(("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", - ip->i_number, ip, ip->i_usecount)); + dprintf(("ntfs_ntget: get ntnode %ju: %p, usecount: %d\n", + (uintmax_t)ip->i_number, ip, ip->i_usecount)); mtx_lock(&ip->i_interlock); ip->i_usecount++; @@ -436,16 +438,16 @@ ntfs_ntput(ip) { 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 %ju: %p, usecount: %d\n", + (uintmax_t)ip->i_number, ip, ip->i_usecount)); mtx_lock(&ip->i_interlock); ip->i_usecount--; #ifdef DIAGNOSTIC if (ip->i_usecount < 0) { - panic("ntfs_ntput: ino: %d usecount: %d \n", - ip->i_number,ip->i_usecount); + panic("ntfs_ntput: ino: %ju usecount: %d \n", + (uintmax_t)ip->i_number, ip->i_usecount); } #endif @@ -454,7 +456,8 @@ ntfs_ntput(ip) return; } - dprintf(("ntfs_ntput: deallocating ntnode: %d\n", ip->i_number)); + dprintf(("ntfs_ntput: deallocating ntnode: %ju\n", + (uintmax_t)ip->i_number)); if (LIST_FIRST(&ip->i_fnlist)) panic("ntfs_ntput: ntnode has fnodes\n"); @@ -483,9 +486,8 @@ ntfs_ntref(ip) ip->i_usecount++; mtx_unlock(&ip->i_interlock); - dprintf(("ntfs_ntref: ino %d, usecount: %d\n", - ip->i_number, ip->i_usecount)); - + dprintf(("ntfs_ntref: ino %ju, usecount: %d\n", + (uintmax_t)ip->i_number, ip->i_usecount)); } /* @@ -495,15 +497,15 @@ void ntfs_ntrele(ip) 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 %ju: %p, usecount: %d\n", + (uintmax_t)ip->i_number, ip, ip->i_usecount)); mtx_lock(&ip->i_interlock); ip->i_usecount--; if (ip->i_usecount < 0) - panic("ntfs_ntrele: ino: %d usecount: %d \n", - ip->i_number,ip->i_usecount); + panic("ntfs_ntrele: ino: %ju usecount: %d \n", + (uintmax_t)ip->i_number, ip->i_usecount); mtx_unlock(&ip->i_interlock); } @@ -744,8 +746,8 @@ ntfs_fget( { struct fnode *fp; - dprintf(("ntfs_fget: ino: %d, attrtype: 0x%x, attrname: %s\n", - ip->i_number,attrtype, attrname?attrname:"")); + dprintf(("ntfs_fget: ino: %ju, attrtype: 0x%x, attrname: %s\n", + (uintmax_t)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", @@ -796,7 +798,8 @@ ntfs_frele( { 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 %ju: %p\n", + fp, (uintmax_t)ip->i_number, ip)); dprintf(("ntfs_frele: deallocating fnode\n")); LIST_REMOVE(fp,f_fnlist); @@ -1126,7 +1129,8 @@ ntfs_ntreaddir( 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: %ju, num: %d\n", + (uintmax_t)ip->i_number, num)); error = ntfs_ntget(ip); if (error) return (error); @@ -1294,7 +1298,7 @@ ntfs_times( struct ntvattr *vap; int error; - dprintf(("ntfs_times: ino: %d...\n", ip->i_number)); + dprintf(("ntfs_times: ino: %ju...\n", (uintmax_t)ip->i_number)); error = ntfs_ntget(ip); if (error) @@ -1329,7 +1333,7 @@ ntfs_filesize( u_int64_t sz, bn; int error; - dprintf(("ntfs_filesize: ino: %d\n", ip->i_number)); + dprintf(("ntfs_filesize: ino: %ju\n", (uintmax_t)ip->i_number)); error = ntfs_ntvattrget(ntmp, ip, fp->f_attrtype, fp->f_attrname, 0, &vap); @@ -1562,8 +1566,8 @@ ntfs_readattr( 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 %ju: 0x%x, from %jd size %zu bytes\n", + (uintmax_t)ip->i_number, attrnum, (intmax_t)roff, rsize)); error = ntfs_ntvattrget(ntmp, ip, attrnum, attrname, 0, &vap); if (error) diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 81822fa..c0408dd 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -639,9 +639,9 @@ ntfs_vgetex( 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: %ju, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", + (uintmax_t)ino, attrtype, attrname ? attrname : "", lkflags, + (u_long)flags)); ntmp = VFSTONTFS(mp); *vpp = NULL; @@ -657,8 +657,8 @@ ntfs_vgetex( if (!(flags & VG_DONTLOADIN) && !(ip->i_flag & IN_LOADED)) { error = ntfs_loadntnode(ntmp, ip); if(error) { - printf("ntfs_vget: CAN'T LOAD ATTRIBUTES FOR INO: %d\n", - ip->i_number); + printf("ntfs_vget: CAN'T LOAD ATTRIBUTES FOR INO: %ju\n", + (uintmax_t)ip->i_number); ntfs_ntput(ip); return (error); } @@ -713,7 +713,7 @@ ntfs_vgetex( ntfs_ntput(ip); return (error); } - dprintf(("ntfs_vget: vnode: %p for ntnode: %d\n", vp,ino)); + dprintf(("ntfs_vget: vnode: %p for ntnode: %ju\n", vp, (uintmax_t)ino)); fp->f_vp = vp; vp->v_data = fp; diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index edcf137..e78dcef 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -127,7 +127,9 @@ ntfs_read(ap) int resid, off, 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: %ju, off: %jd resid: %d, segflg: %d\n", + (uintmax_t)ip->i_number, (intmax_t)uio->uio_offset, + uio->uio_resid, uio->uio_segflg)); dprintf(("ntfs_read: filesize: %d",(u_int32_t)fp->f_size)); @@ -179,7 +181,8 @@ ntfs_getattr(ap) register struct ntnode *ip = FTONT(fp); register struct vattr *vap = ap->a_vap; - dprintf(("ntfs_getattr: %d, flags: %d\n",ip->i_number,ip->i_flag)); + dprintf(("ntfs_getattr: %ju, flags: %d\n", + (uintmax_t)ip->i_number, ip->i_flag)); vap->va_fsid = dev2udev(ip->i_dev); vap->va_fileid = ip->i_number; @@ -214,8 +217,8 @@ ntfs_inactive(ap) register struct ntnode *ip = VTONT(ap->a_vp); #endif - dprintf(("ntfs_inactive: vnode: %p, ntnode: %d\n", ap->a_vp, - ip->i_number)); + dprintf(("ntfs_inactive: vnode: %p, ntnode: %ju\n", ap->a_vp, + (uintmax_t)ip->i_number)); /* XXX since we don't support any filesystem changes * right now, nothing more needs to be done @@ -237,7 +240,8 @@ ntfs_reclaim(ap) register struct ntnode *ip = FTONT(fp); int error; - dprintf(("ntfs_reclaim: vnode: %p, ntnode: %d\n", vp, ip->i_number)); + dprintf(("ntfs_reclaim: vnode: %p, ntnode: %ju\n", + vp, (uintmax_t)ip->i_number)); /* * Destroy the vm object and flush associated pages. @@ -600,8 +604,8 @@ ntfs_lookup(ap) return (error); } - dprintf(("ntfs_lookup: found ino: %d\n", - VTONT(*ap->a_vpp)->i_number)); + dprintf(("ntfs_lookup: found ino: %ju\n", + (uintmax_t)VTONT(*ap->a_vpp)->i_number)); } if (cnp->cn_flags & MAKEENTRY) diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index a08dafa..445112d 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -247,7 +247,8 @@ tmpfs_mount(struct mount *mp) free(tmp, M_TMPFSMNT); return error; } - KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %d", root->tn_id)); + KASSERT(root->tn_id == 2, + ("tmpfs root with invalid ino: %ju", (uintmax_t)root->tn_id)); tmp->tm_root = root; MNT_ILOCK(mp); -- cgit v1.1