From: Nathan Scott Date: Wed, 17 Dec 2003 10:30:22 +0000 (+0000) Subject: Fix dev_t mangling in xfsprogs tools, use xfs_dev_t as its size is what we expect. X-Git-Tag: v2.7.0~147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63899e27a987affc700f73af24e44b576b2fc84c;p=thirdparty%2Fxfsprogs-dev.git Fix dev_t mangling in xfsprogs tools, use xfs_dev_t as its size is what we expect. --- diff --git a/VERSION b/VERSION index b599fbacc..224eedb86 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=6 -PKG_REVISION=1 +PKG_REVISION=2 PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 6eeca4198..6b2020432 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xfsprogs (2.6.2-1) unstable; urgency=low + + * New upstream release. + + -- Nathan Scott Wed, 17 Dec 2003 21:16:53 +1100 + xfsprogs (2.6.1-1) unstable; urgency=low * New upstream release. diff --git a/doc/CHANGES b/doc/CHANGES index fb803e8c5..c21cfce75 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,10 @@ +xfsprogs-2.6.2 (17 December 2003) + - Fix dev_t sizing issues in user tools - glibc uses a 64 + bit number and XFS has a 32 device bit number, confusion + reigns. Not much manipulates device numbers in the XFS + user tools though, hence hasn't really been seen before. + Thanks to Christoph for the patch. + xfsprogs-2.6.1 (27 November 2003) - Human-friendly xfs_io read/write bsize specifications. - Dump throughput and IOPs values after xfs_io reads/writes. diff --git a/include/libxfs.h b/include/libxfs.h index 12cc5954a..f61f1ef8f 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -360,7 +360,7 @@ typedef struct { } cred_t; extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, - ushort, dev_t, cred_t *, xfs_inode_t **); + ushort, xfs_dev_t, cred_t *, xfs_inode_t **); extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); extern void libxfs_idata_realloc (xfs_inode_t *, int, int); diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index 1b3915cb4..33732d073 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -514,8 +514,7 @@ typedef unsigned long long __psunsigned_t; #define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \ & IRIX_DEV_MAXMAJ)) #define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN)) -#define IRIX_MKDEV(major,minor) ((dev_t)(((major) << IRIX_DEV_BITSMINOR) \ +#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major) << IRIX_DEV_BITSMINOR) \ | (minor&IRIX_DEV_MAXMIN))) -#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev)) #endif /* __XFS_PLATFORM_DEFS_H__ */ diff --git a/libxfs/util.c b/libxfs/util.c index f1f338a86..0fb9671f4 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -46,7 +46,7 @@ libxfs_inode_alloc( xfs_inode_t *pip, mode_t mode, ushort nlink, - dev_t rdev, + xfs_dev_t rdev, cred_t *cr, xfs_inode_t **ipp) { @@ -134,7 +134,7 @@ libxfs_ialloc( xfs_inode_t *pip, mode_t mode, nlink_t nlink, - dev_t rdev, + xfs_dev_t rdev, cred_t *cr, xfs_prid_t prid, int okalloc, @@ -201,11 +201,13 @@ libxfs_ialloc( flags = XFS_ILOG_CORE; switch (mode & S_IFMT) { case S_IFIFO: + case S_IFSOCK: + /* doesn't make sense to set an rdev for these */ + rdev = 0; case S_IFCHR: case S_IFBLK: - case S_IFSOCK: ip->i_d.di_format = XFS_DINODE_FMT_DEV; - ip->i_df.if_u2.if_rdev = makedev(major(rdev), minor(rdev)); ip->i_df.if_flags = 0; + ip->i_df.if_u2.if_rdev = rdev; flags |= XFS_ILOG_DEV; break; case S_IFREG: diff --git a/libxfs/xfs.h b/libxfs/xfs.h index de54800e9..f960a95a0 100644 --- a/libxfs/xfs.h +++ b/libxfs/xfs.h @@ -245,7 +245,6 @@ typedef struct { dev_t dev; } xfs_buftarg_t; #define ktrace_t void #define m_ddev_targp m_dev #define unlikely(x) (x) -#define kdev_none(x) (!(x)) #define INIT_LIST_HEAD(x) #define KERN_WARNING #define XFS_ERROR(e) (e) @@ -395,7 +394,7 @@ static inline int xfs_btree_readahead (xfs_btree_cur_t *cur, int lev, int lr) /* xfs_inode.c */ -int xfs_ialloc (xfs_trans_t *, xfs_inode_t *, mode_t, nlink_t, dev_t, cred_t *, +int xfs_ialloc (xfs_trans_t *, xfs_inode_t *, mode_t, nlink_t, xfs_dev_t, cred_t *, xfs_prid_t, int, xfs_buf_t **, boolean_t *, xfs_inode_t **); int xfs_iread_extents (xfs_trans_t *, xfs_inode_t *, int); int xfs_imap (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, xfs_imap_t *, uint); diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index 4580909b3..b410aa1d6 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -952,7 +952,7 @@ The following are fields in the inode core: \f3version\f1: inode version, 1 or 2 .br \f3format\f1: format of \f3u\f1 union data -(0: dev_t, +(0: xfs_dev_t, 1: local file \- in-inode directory or symlink, 2: extent list, 3: Btree root, diff --git a/mkfs/proto.c b/mkfs/proto.c index f81511356..4bde45bb8 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -463,8 +463,8 @@ parseproto( case IF_REGULAR: buf = newregfile(pp, &len); getres(tp, XFS_B_TO_FSB(mp, len)); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, - mp->m_dev, &creds, &ip); + error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0, + &creds, &ip); if (error) fail(_("Inode allocation failed"), error); flags |= newfile(tp, ip, &flist, &first, 0, 0, buf, len); @@ -481,8 +481,8 @@ parseproto( llen = cvtnum(mp->m_sb.sb_blocksize, mp->m_sb.sb_sectsize, value); getres(tp, XFS_B_TO_FSB(mp, llen)); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, - mp->m_dev, &creds, &ip); + error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0, + &creds, &ip); if (error) fail(_("Inode pre-allocation failed"), error); @@ -505,7 +505,7 @@ parseproto( majdev = (int)getnum(pp); mindev = (int)getnum(pp); error = libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1, - makedev(majdev, mindev), &creds, &ip); + IRIX_MKDEV(majdev, mindev), &creds, &ip); if (error) { fail(_("Inode allocation failed"), error); } @@ -521,7 +521,7 @@ parseproto( majdev = (int)getnum(pp); mindev = (int)getnum(pp); error = libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1, - makedev(majdev, mindev), &creds, &ip); + IRIX_MKDEV(majdev, mindev), &creds, &ip); if (error) fail(_("Inode allocation failed"), error); libxfs_trans_ijoin(tp, pip, 0); @@ -533,8 +533,8 @@ parseproto( case IF_FIFO: getres(tp, 0); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, - mp->m_dev, &creds, &ip); + error = libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0, + &creds, &ip); if (error) fail(_("Inode allocation failed"), error); libxfs_trans_ijoin(tp, pip, 0); @@ -546,8 +546,8 @@ parseproto( buf = getstr(pp); len = (int)strlen(buf); getres(tp, XFS_B_TO_FSB(mp, len)); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, - mp->m_dev, &creds, &ip); + error = libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0, + &creds, &ip); if (error) fail(_("Inode allocation failed"), error); flags |= newfile(tp, ip, &flist, &first, 1, 1, buf, len); @@ -558,8 +558,8 @@ parseproto( break; case IF_DIRECTORY: getres(tp, 0); - error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, - mp->m_dev, &creds, &ip); + error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0, + &creds, &ip); if (error) fail(_("Inode allocation failed"), error); ip->i_d.di_nlink++; /* account for . */ @@ -642,8 +642,8 @@ rtinit( if ((i = libxfs_trans_reserve(tp, MKFS_BLOCKRES_INODE, 0, 0, 0, 0))) res_failed(i); bzero(&creds, sizeof(creds)); - error = libxfs_inode_alloc(&tp, mp->m_rootip, S_IFREG, 1, - mp->m_dev, &creds, &rbmip); + error = libxfs_inode_alloc(&tp, mp->m_rootip, S_IFREG, 1, 0, + &creds, &rbmip); if (error) { fail(_("Realtime bitmap inode allocation failed"), error); } @@ -660,8 +660,8 @@ rtinit( libxfs_mod_sb(tp, XFS_SB_RBMINO); libxfs_trans_ihold(tp, rbmip); mp->m_rbmip = rbmip; - error = libxfs_inode_alloc(&tp, mp->m_rootip, S_IFREG, 1, - mp->m_dev, &creds, &rsumip); + error = libxfs_inode_alloc(&tp, mp->m_rootip, S_IFREG, 1, 0, + &creds, &rsumip); if (error) { fail(_("Realtime summary inode allocation failed"), error); } diff --git a/repair/dinode.c b/repair/dinode.c index 9d7f96ab0..2579a269c 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -66,7 +66,7 @@ calc_attr_offset(xfs_mount_t *mp, xfs_dinode_t *dino) */ switch (dinoc->di_format) { case XFS_DINODE_FMT_DEV: - offset += sizeof(dev_t); + offset += sizeof(xfs_dev_t); break; case XFS_DINODE_FMT_LOCAL: offset += INT_GET(dinoc->di_size, ARCH_CONVERT); @@ -2290,12 +2290,12 @@ _("mismatch between format (%d) and size (%lld) in directory ino %llu\n"), switch (dinoc->di_format) { case XFS_DINODE_FMT_DEV: if (dinoc->di_forkoff != - (roundup(sizeof(dev_t), 8) >> 3)) { + (roundup(sizeof(xfs_dev_t), 8) >> 3)) { do_warn( _("bad attr fork offset %d in dev inode %llu, should be %d\n"), (int) dinoc->di_forkoff, lino, - (int) (roundup(sizeof(dev_t), 8) >> 3)); + (int) (roundup(sizeof(xfs_dev_t), 8) >> 3)); err = 1; } break; diff --git a/repair/phase6.c b/repair/phase6.c index 79c9b5c7a..4da14370c 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -753,7 +753,7 @@ mk_orphanage(xfs_mount_t *mp) i, ORPHANAGE); error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, - 1, mp->m_dev, &zerocr, &ip); + 1, 0, &zerocr, &ip); if (error) { do_error(_("%s inode allocation failed %d\n"),