diff options
| -rw-r--r-- | fs/xfs/libxfs/xfs_btree.c | 8 | ||||
| -rw-r--r-- | fs/xfs/libxfs/xfs_format.h | 66 | ||||
| -rw-r--r-- | fs/xfs/xfs_error.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_error.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_ioctl.c | 11 | ||||
| -rw-r--r-- | fs/xfs/xfs_ondisk.h | 2 |
6 files changed, 60 insertions, 31 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c index a6779b3e873c..07eeb0b4ca74 100644 --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c | |||
| @@ -543,12 +543,12 @@ xfs_btree_ptr_addr( | |||
| 543 | */ | 543 | */ |
| 544 | STATIC struct xfs_btree_block * | 544 | STATIC struct xfs_btree_block * |
| 545 | xfs_btree_get_iroot( | 545 | xfs_btree_get_iroot( |
| 546 | struct xfs_btree_cur *cur) | 546 | struct xfs_btree_cur *cur) |
| 547 | { | 547 | { |
| 548 | struct xfs_ifork *ifp; | 548 | struct xfs_ifork *ifp; |
| 549 | 549 | ||
| 550 | ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, cur->bc_private.b.whichfork); | 550 | ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, cur->bc_private.b.whichfork); |
| 551 | return (struct xfs_btree_block *)ifp->if_broot; | 551 | return (struct xfs_btree_block *)ifp->if_broot; |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | /* | 554 | /* |
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index dc97eb21af07..adb204d40f22 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h | |||
| @@ -1435,41 +1435,57 @@ typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; | |||
| 1435 | * with the crc feature bit, and all accesses to them must be conditional on | 1435 | * with the crc feature bit, and all accesses to them must be conditional on |
| 1436 | * that flag. | 1436 | * that flag. |
| 1437 | */ | 1437 | */ |
| 1438 | /* short form block header */ | ||
| 1439 | struct xfs_btree_block_shdr { | ||
| 1440 | __be32 bb_leftsib; | ||
| 1441 | __be32 bb_rightsib; | ||
| 1442 | |||
| 1443 | __be64 bb_blkno; | ||
| 1444 | __be64 bb_lsn; | ||
| 1445 | uuid_t bb_uuid; | ||
| 1446 | __be32 bb_owner; | ||
| 1447 | __le32 bb_crc; | ||
| 1448 | }; | ||
| 1449 | |||
| 1450 | /* long form block header */ | ||
| 1451 | struct xfs_btree_block_lhdr { | ||
| 1452 | __be64 bb_leftsib; | ||
| 1453 | __be64 bb_rightsib; | ||
| 1454 | |||
| 1455 | __be64 bb_blkno; | ||
| 1456 | __be64 bb_lsn; | ||
| 1457 | uuid_t bb_uuid; | ||
| 1458 | __be64 bb_owner; | ||
| 1459 | __le32 bb_crc; | ||
| 1460 | __be32 bb_pad; /* padding for alignment */ | ||
| 1461 | }; | ||
| 1462 | |||
| 1438 | struct xfs_btree_block { | 1463 | struct xfs_btree_block { |
| 1439 | __be32 bb_magic; /* magic number for block type */ | 1464 | __be32 bb_magic; /* magic number for block type */ |
| 1440 | __be16 bb_level; /* 0 is a leaf */ | 1465 | __be16 bb_level; /* 0 is a leaf */ |
| 1441 | __be16 bb_numrecs; /* current # of data records */ | 1466 | __be16 bb_numrecs; /* current # of data records */ |
| 1442 | union { | 1467 | union { |
| 1443 | struct { | 1468 | struct xfs_btree_block_shdr s; |
| 1444 | __be32 bb_leftsib; | 1469 | struct xfs_btree_block_lhdr l; |
| 1445 | __be32 bb_rightsib; | ||
| 1446 | |||
| 1447 | __be64 bb_blkno; | ||
| 1448 | __be64 bb_lsn; | ||
| 1449 | uuid_t bb_uuid; | ||
| 1450 | __be32 bb_owner; | ||
| 1451 | __le32 bb_crc; | ||
| 1452 | } s; /* short form pointers */ | ||
| 1453 | struct { | ||
| 1454 | __be64 bb_leftsib; | ||
| 1455 | __be64 bb_rightsib; | ||
| 1456 | |||
| 1457 | __be64 bb_blkno; | ||
| 1458 | __be64 bb_lsn; | ||
| 1459 | uuid_t bb_uuid; | ||
| 1460 | __be64 bb_owner; | ||
| 1461 | __le32 bb_crc; | ||
| 1462 | __be32 bb_pad; /* padding for alignment */ | ||
| 1463 | } l; /* long form pointers */ | ||
| 1464 | } bb_u; /* rest */ | 1470 | } bb_u; /* rest */ |
| 1465 | }; | 1471 | }; |
| 1466 | 1472 | ||
| 1467 | #define XFS_BTREE_SBLOCK_LEN 16 /* size of a short form block */ | 1473 | /* size of a short form block */ |
| 1468 | #define XFS_BTREE_LBLOCK_LEN 24 /* size of a long form block */ | 1474 | #define XFS_BTREE_SBLOCK_LEN \ |
| 1475 | (offsetof(struct xfs_btree_block, bb_u) + \ | ||
| 1476 | offsetof(struct xfs_btree_block_shdr, bb_blkno)) | ||
| 1477 | /* size of a long form block */ | ||
| 1478 | #define XFS_BTREE_LBLOCK_LEN \ | ||
| 1479 | (offsetof(struct xfs_btree_block, bb_u) + \ | ||
| 1480 | offsetof(struct xfs_btree_block_lhdr, bb_blkno)) | ||
| 1469 | 1481 | ||
| 1470 | /* sizes of CRC enabled btree blocks */ | 1482 | /* sizes of CRC enabled btree blocks */ |
| 1471 | #define XFS_BTREE_SBLOCK_CRC_LEN (XFS_BTREE_SBLOCK_LEN + 40) | 1483 | #define XFS_BTREE_SBLOCK_CRC_LEN \ |
| 1472 | #define XFS_BTREE_LBLOCK_CRC_LEN (XFS_BTREE_LBLOCK_LEN + 48) | 1484 | (offsetof(struct xfs_btree_block, bb_u) + \ |
| 1485 | sizeof(struct xfs_btree_block_shdr)) | ||
| 1486 | #define XFS_BTREE_LBLOCK_CRC_LEN \ | ||
| 1487 | (offsetof(struct xfs_btree_block, bb_u) + \ | ||
| 1488 | sizeof(struct xfs_btree_block_lhdr)) | ||
| 1473 | 1489 | ||
| 1474 | #define XFS_BTREE_SBLOCK_CRC_OFF \ | 1490 | #define XFS_BTREE_SBLOCK_CRC_OFF \ |
| 1475 | offsetof(struct xfs_btree_block, bb_u.s.bb_crc) | 1491 | offsetof(struct xfs_btree_block, bb_u.s.bb_crc) |
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 355619ae5e3e..ed7ee4e8af73 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c | |||
| @@ -55,7 +55,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression, | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | int | 57 | int |
| 58 | xfs_errortag_add(int error_tag, xfs_mount_t *mp) | 58 | xfs_errortag_add(unsigned int error_tag, xfs_mount_t *mp) |
| 59 | { | 59 | { |
| 60 | int i; | 60 | int i; |
| 61 | int len; | 61 | int len; |
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h index 4ed3042a0f16..2e4f67f68856 100644 --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h | |||
| @@ -128,7 +128,7 @@ extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); | |||
| 128 | xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \ | 128 | xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \ |
| 129 | (rf)))) | 129 | (rf)))) |
| 130 | 130 | ||
| 131 | extern int xfs_errortag_add(int error_tag, struct xfs_mount *mp); | 131 | extern int xfs_errortag_add(unsigned int error_tag, struct xfs_mount *mp); |
| 132 | extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud); | 132 | extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud); |
| 133 | #else | 133 | #else |
| 134 | #define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) | 134 | #define XFS_TEST_ERROR(expr, mp, tag, rf) (expr) |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index dbca7375deef..408f3ad348ab 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
| @@ -1575,6 +1575,17 @@ xfs_ioc_swapext( | |||
| 1575 | goto out_put_tmp_file; | 1575 | goto out_put_tmp_file; |
| 1576 | } | 1576 | } |
| 1577 | 1577 | ||
| 1578 | /* | ||
| 1579 | * We need to ensure that the fds passed in point to XFS inodes | ||
| 1580 | * before we cast and access them as XFS structures as we have no | ||
| 1581 | * control over what the user passes us here. | ||
| 1582 | */ | ||
| 1583 | if (f.file->f_op != &xfs_file_operations || | ||
| 1584 | tmp.file->f_op != &xfs_file_operations) { | ||
| 1585 | error = -EINVAL; | ||
| 1586 | goto out_put_tmp_file; | ||
| 1587 | } | ||
| 1588 | |||
| 1578 | ip = XFS_I(file_inode(f.file)); | 1589 | ip = XFS_I(file_inode(f.file)); |
| 1579 | tip = XFS_I(file_inode(tmp.file)); | 1590 | tip = XFS_I(file_inode(tmp.file)); |
| 1580 | 1591 | ||
diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h index 027230134098..17ec0248f771 100644 --- a/fs/xfs/xfs_ondisk.h +++ b/fs/xfs/xfs_ondisk.h | |||
| @@ -39,6 +39,8 @@ xfs_check_ondisk_structs(void) | |||
| 39 | XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_key, 8); | 39 | XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_key, 8); |
| 40 | XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_rec, 16); | 40 | XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_rec, 16); |
| 41 | XFS_CHECK_STRUCT_SIZE(struct xfs_bmdr_block, 4); | 41 | XFS_CHECK_STRUCT_SIZE(struct xfs_bmdr_block, 4); |
| 42 | XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block_shdr, 48); | ||
| 43 | XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block_lhdr, 64); | ||
| 42 | XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block, 72); | 44 | XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block, 72); |
| 43 | XFS_CHECK_STRUCT_SIZE(struct xfs_dinode, 176); | 45 | XFS_CHECK_STRUCT_SIZE(struct xfs_dinode, 176); |
| 44 | XFS_CHECK_STRUCT_SIZE(struct xfs_disk_dquot, 104); | 46 | XFS_CHECK_STRUCT_SIZE(struct xfs_disk_dquot, 104); |
