get rid of some left-over typedefs from IRIX
Remove some of the weirder typedefs in the XFS tree.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/5 xfs: remove __psint_t and __psunsigned_t
Replace uses of __psint_t with the proper uintptr_t and ptrdiff_t types, and remove the defintions of __psint_t and __psunsigned_t.
--- fs/xfs/xfs_extfree_item.c | 2 +- fs/xfs/xfs_linux.h | 11 ----------- fs/xfs/xfs_log.c | 10 +++++----- fs/xfs/xfs_trans_ail.c | 6 +++--- 4 files changed, 9 insertions(+), 20 deletions(-)
fs/xfs/xfs_extfree_item.c +1 -1
@@ -239,7 +239,7 @@ xfs_efi_init(xfs_log_item_init (mp, &efip->efi_item,XFS_LI_EFI , &xfs_efi_item_ops); efip->efi_format.efi_nextents = nextents; - efip->efi_format.efi_id = (__psint_t )(void *)efip; + efip->efi_format.efi_id = (uintptr_t )(void *)efip;atomic_set (&efip->efi_next_extent,0 );atomic_set (&efip->efi_refcount,2 );
fs/xfs/xfs_linux.h +0 -11
@@ -41,17 +41,6 @@ typedef char * xfs_caddr_t; /* <core address> type */typedef __u32 xfs_dev_t ;typedef __u32 xfs_nlink_t ; -/* __psint_t is the same size as a pointer */ -#if (BITS_PER_LONG ==32 ) -typedef __int32_t __psint_t ; -typedef __uint32_t __psunsigned_t ; -#elif (BITS_PER_LONG ==64 ) -typedef __int64_t __psint_t ; -typedef __uint64_t __psunsigned_t ; -#else -#error BITS_PER_LONG must be 32 or 64 -#endif -#include "xfs_types.h" #include "kmem.h"
fs/xfs/xfs_log.c +5 -5
@@ -3766,7 +3766,7 @@ xlog_verify_iclog(xlog_in_core_2_t *xhdr;xfs_caddr_t ptr;xfs_caddr_t base_ptr; -__psint_t field_offset; +ptrdiff_t field_offset;__uint8_t clientid;int len, i, j, k, op_len;int idx;
@@ -3803,7 +3803,7 @@ xlog_verify_iclog( ophead = (xlog_op_header_t *)ptr;/* clientid is only 1 byte */ - field_offset = (__psint_t) + field_offset = (ptrdiff_t ) ((xfs_caddr_t )&(ophead->oh_clientid) - base_ptr);if (!syncing || (field_offset &0x1ff )) { clientid = ophead->oh_clientid;
@@ -3826,13 +3826,13 @@ xlog_verify_iclog( (unsigned long)field_offset);/* check length */ - field_offset = (__psint_t) + field_offset = (ptrdiff_t ) ((xfs_caddr_t )&(ophead->oh_len) - base_ptr);if (!syncing || (field_offset &0x1ff )) { op_len =be32_to_cpu (ophead->oh_len); }else { - idx =BTOBBT ((__psint_t )&ophead->oh_len - - (__psint_t )iclog->ic_datap); + idx =BTOBBT ((uintptr_t )&ophead->oh_len - + (uintptr_t )iclog->ic_datap);if (idx >= (XLOG_HEADER_CYCLE_SIZE /BBSIZE )) { j = idx / (XLOG_HEADER_CYCLE_SIZE /BBSIZE ); k = idx % (XLOG_HEADER_CYCLE_SIZE /BBSIZE );
fs/xfs/xfs_trans_ail.c +3 -3
@@ -159,7 +159,7 @@ xfs_trans_ail_cursor_next( {struct xfs_log_item *lip = cur->item; -if ((__psint_t )lip &1 ) +if ((uintptr_t )lip &1 ) lip =xfs_ail_min (ailp);if (lip) cur->item =xfs_ail_next (ailp, lip);
@@ -196,7 +196,7 @@ xfs_trans_ail_cursor_clear(list_for_each_entry (cur, &ailp->xa_cursors, list) {if (cur->item == lip) cur->item = (struct xfs_log_item *) - ((__psint_t )cur->item |1 ); + ((uintptr_t )cur->item |1 ); } }
@@ -287,7 +287,7 @@ xfs_ail_splice(* find the place in the AIL where the items belong. */ lip = cur ? cur->item :NULL ; -if (!lip || (__psint_t ) lip &1 ) +if (!lip || (uintptr_t )lip &1 ) lip =__xfs_trans_ail_cursor_last (ailp, lsn);/*
Signature · 6 lines
1.9.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/5 xfs: remove inst_t
In reply to Christoph HellwigWe can simply use a void pointer to pass a long return addresses in the debugging helpers.
--- fs/xfs/xfs_error.c | 4 ++-- fs/xfs/xfs_error.h | 4 ++-- fs/xfs/xfs_linux.h | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-)
fs/xfs/xfs_error.c +2 -2
@@ -127,7 +127,7 @@ xfs_error_report( struct xfs_mount *mp, const char *filename, int linenum, - inst_t *ra) + void *ra) { if (level <= xfs_error_level) { xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
@@ -146,7 +146,7 @@ xfs_corruption_error(void *p, const char *filename, int linenum, - inst_t *ra) + void *ra) { if (level <= xfs_error_level) xfs_hex_dump(p, 64);
fs/xfs/xfs_error.h +2 -2
@@ -21,10 +21,10 @@struct xfs_mount ;extern void xfs_error_report (const char *tag,int level,struct xfs_mount *mp, -const char *filename,int linenum,inst_t *ra); +const char *filename,int linenum,void *ra);extern void xfs_corruption_error (const char *tag,int level,struct xfs_mount *mp,void *p,const char *filename, -int linenum,inst_t *ra); +int linenum,void *ra);extern void xfs_verifier_error (struct xfs_buf *bp);#define XFS_ERROR_REPORT (e, lvl, mp) \
fs/xfs/xfs_linux.h +0 -2
@@ -32,8 +32,6 @@ typedef unsigned int __uint32_t;typedef signed long long int __int64_t ;typedef unsigned long long int __uint64_t ; -typedef __uint32_t inst_t ;/* an instruction */ -typedef __s64 xfs_off_t ;/* <file offset> type */ typedef unsigned long long xfs_ino_t ;/* <inode> type */ typedef __s64 xfs_daddr_t ;/* <disk address> type */
Signature · 6 lines
1.9.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/5 xfs: return a void pointer from xfs_buf_offset
In reply to Christoph HellwigThis avoids all kinds of unessecary casts in an envrionment like Linux where we can assume that pointer arithmetics are support on void pointers.
--- fs/xfs/libxfs/xfs_ialloc.h | 3 +-- fs/xfs/libxfs/xfs_inode_buf.c | 8 +++----- fs/xfs/xfs_buf.c | 6 +++--- fs/xfs/xfs_buf.h | 2 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_log_recover.c | 9 ++++----- 6 files changed, 13 insertions(+), 17 deletions(-)
fs/xfs/libxfs/xfs_ialloc.h +1 -2
@@ -51,8 +51,7 @@ xfs_icluster_size_fsb(static inline struct xfs_dinode *xfs_make_iptr (struct xfs_mount *mp,struct xfs_buf *b,int o) { -return (struct xfs_dinode *) - (xfs_buf_offset (b, o << (mp)->m_sb.sb_inodelog)); +return xfs_buf_offset (b, o << (mp)->m_sb.sb_inodelog); }/*
fs/xfs/libxfs/xfs_inode_buf.c +3 -5
@@ -46,8 +46,7 @@ xfs_inobp_check( j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog;for (i =0 ; i < j; i++) { - dip = (xfs_dinode_t *)xfs_buf_offset (bp, - i * mp->m_sb.sb_inodesize); + dip =xfs_buf_offset (bp, i * mp->m_sb.sb_inodesize);if (!dip->di_next_unlinked) { xfs_alert(mp, "Detected bogus zero next_unlinked field in inode %d buffer 0x%llx.",
@@ -86,8 +85,7 @@ xfs_inode_buf_verify(int di_ok;xfs_dinode_t *dip; - dip = (struct xfs_dinode *)xfs_buf_offset (bp, - (i << mp->m_sb.sb_inodelog)); + dip =xfs_buf_offset (bp, (i << mp->m_sb.sb_inodelog)); di_ok = dip->di_magic ==cpu_to_be16 (XFS_DINODE_MAGIC ) &&XFS_DINODE_GOOD_VERSION (dip->di_version); if (unlikely(XFS_TEST_ERROR(!di_ok, mp,
@@ -186,7 +184,7 @@ xfs_imap_to_bp( } *bpp = bp; - *dipp = (struct xfs_dinode *)xfs_buf_offset (bp, imap->im_boffset); + *dipp =xfs_buf_offset (bp, imap->im_boffset);return 0 ; }
fs/xfs/xfs_buf.c +3 -3
@@ -1419,9 +1419,9 @@ xfs_buf_submit_wait(return error; } -xfs_caddr_t +void *xfs_buf_offset ( -xfs_buf_t *bp, +struct xfs_buf *bp,size_t offset) {struct page *page;
@@ -1431,7 +1431,7 @@ xfs_buf_offset( offset += bp->b_offset; page = bp->b_pages[offset >>PAGE_SHIFT ]; -return (xfs_caddr_t )page_address (page) + (offset & (PAGE_SIZE -1 )); +return page_address (page) + (offset & (PAGE_SIZE -1 )); }/*
fs/xfs/xfs_buf.h +1 -1
@@ -299,7 +299,7 @@ extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *,xfs_buf_iomove ((bp), (off), (len),NULL ,XBRW_ZERO ) /* Buffer Utility Routines */ -extern xfs_caddr_t xfs_buf_offset (xfs_buf_t *,size_t ); +extern void *xfs_buf_offset (struct xfs_buf *,size_t );/* Delayed Write Buffer Routines */ extern bool xfs_buf_delwri_queue (struct xfs_buf *,struct list_head *);
fs/xfs/xfs_inode.c +1 -1
@@ -3392,7 +3392,7 @@ xfs_iflush_int(ASSERT (ip->i_d.di_version >1 );/* set *dip = inode's place in the buffer */ - dip = (xfs_dinode_t *)xfs_buf_offset (bp, ip->i_imap.im_boffset); + dip =xfs_buf_offset (bp, ip->i_imap.im_boffset);if (XFS_TEST_ERROR (dip->di_magic !=cpu_to_be16 (XFS_DINODE_MAGIC ), mp,XFS_ERRTAG_IFLUSH_1 ,XFS_RANDOM_IFLUSH_1 )) {
fs/xfs/xfs_log_recover.c +4 -5
@@ -1789,8 +1789,7 @@ xlog_recover_do_inode_buffer(return -EFSCORRUPTED ; } - buffer_nextp = (xfs_agino_t *)xfs_buf_offset (bp, - next_unlinked_offset); + buffer_nextp =xfs_buf_offset (bp, next_unlinked_offset); *buffer_nextp = *logged_nextp;/*
@@ -1798,7 +1797,7 @@ xlog_recover_do_inode_buffer(* have to leave the inode in a consistent state for whoever * reads it next.... */ -xfs_dinode_calc_crc (mp, (struct xfs_dinode *) +xfs_dinode_calc_crc (mp,xfs_buf_offset (bp, i * mp->m_sb.sb_inodesize)); }
@@ -2546,7 +2545,7 @@ xlog_recover_inode_pass2( goto out_release; }ASSERT (in_f->ilf_fields &XFS_ILOG_CORE ); - dip = (xfs_dinode_t *)xfs_buf_offset (bp, in_f->ilf_boffset); + dip =xfs_buf_offset (bp, in_f->ilf_boffset);/* * Make sure the place we're flushing out to really looks
@@ -2885,7 +2884,7 @@ xlog_recover_dquot_pass2(return error;ASSERT (bp); - ddq = (xfs_disk_dquot_t *)xfs_buf_offset (bp, dq_f->qlf_boffset); + ddq =xfs_buf_offset (bp, dq_f->qlf_boffset);/* * If the dquot has an LSN in it, recover the dquot only if it's less
Signature · 6 lines
1.9.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/5 xfs: use void pointers in log validation helpers
In reply to Christoph HellwigCompared to char pointers this saves us a lot of casting effort. Also add another local variable to make the code easier to read.
--- fs/xfs/xfs_log.c | 30 ++++++++++++++---------------- fs/xfs/xfs_log_priv.h | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-)
fs/xfs/xfs_log.c +14 -16
@@ -109,7 +109,7 @@ xlog_ungrant_log_space( STATIC voidxlog_verify_dest_ptr (struct xlog *log, -char *ptr); +void *ptr); STATIC voidxlog_verify_grant_tail (struct xlog *log);
@@ -1444,7 +1444,7 @@ xlog_alloc_log( iclog->ic_bp = bp; iclog->ic_data = bp->b_addr;#ifdef DEBUG - log->l_iclog_bak[i] = (xfs_caddr_t)&(iclog->ic_header); + log->l_iclog_bak[i] = &iclog->ic_header;#endif head = &iclog->ic_header;memset (head,0 ,sizeof (xlog_rec_header_t));
@@ -3661,7 +3661,7 @@ xlog_ticket_alloc(void xlog_verify_dest_ptr (struct xlog *log, -char *ptr) +void *ptr) {int i;int good_ptr =0 ;
@@ -3764,8 +3764,7 @@ xlog_verify_iclog(xlog_op_header_t *ophead;xlog_in_core_t *icptr;xlog_in_core_2_t *xhdr; -xfs_caddr_t ptr; -xfs_caddr_t base_ptr; +void *base_ptr, *ptr, *p;ptrdiff_t field_offset;__uint8_t clientid;int len, i, j, k, op_len;
@@ -3785,9 +3784,9 @@ xlog_verify_iclog(if (iclog->ic_header.h_magicno !=cpu_to_be32 (XLOG_HEADER_MAGIC_NUM ))xfs_emerg (log->l_mp,"%s: invalid magic num" , __func__); - ptr = (xfs_caddr_t) &iclog->ic_header; -for (ptr +=BBSIZE ; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; - ptr +=BBSIZE ) { + base_ptr = ptr = &iclog->ic_header; + p = &iclog->ic_header; +for (ptr +=BBSIZE ; ptr < base_ptr + count; ptr +=BBSIZE ) {if (*(__be32 *)ptr ==cpu_to_be32 (XLOG_HEADER_MAGIC_NUM ))xfs_emerg (log->l_mp,"%s: unexpected magic num" , __func__);
@@ -3795,16 +3794,15 @@ xlog_verify_iclog(/* check fields */ len =be32_to_cpu (iclog->ic_header.h_num_logops); - ptr = iclog->ic_datap; - base_ptr = ptr; - ophead = (xlog_op_header_t *)ptr; + base_ptr = ptr = iclog->ic_datap; + ophead = ptr; xhdr = iclog->ic_data;for (i =0 ; i < len; i++) { - ophead = (xlog_op_header_t *)ptr; + ophead = ptr;/* clientid is only 1 byte */ - field_offset = (ptrdiff_t ) - ((xfs_caddr_t )&(ophead->oh_clientid) - base_ptr); + p = &ophead->oh_clientid; + field_offset = p - base_ptr;if (!syncing || (field_offset &0x1ff )) { clientid = ophead->oh_clientid; }else {
@@ -3826,8 +3824,8 @@ xlog_verify_iclog( (unsigned long)field_offset);/* check length */ - field_offset = (ptrdiff_t ) - ((xfs_caddr_t )&(ophead->oh_len) - base_ptr); + p = &ophead->oh_len; + field_offset = p - base_ptr;if (!syncing || (field_offset &0x1ff )) { op_len =be32_to_cpu (ophead->oh_len); }else {
fs/xfs/xfs_log_priv.h +1 -1
@@ -409,7 +409,7 @@ struct xlog {/* The following field are used for debugging; need to hold icloglock */ #ifdef DEBUG -char *l_iclog_bak[XLOG_MAX_ICLOGS ]; +void *l_iclog_bak[XLOG_MAX_ICLOGS ];#endif };
Signature · 6 lines
1.9.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/5 xfs: remove xfs_caddr_t
In reply to Christoph HellwigJust use char pointers directly instead of the confusing typedef to a pointer type.
--- fs/xfs/xfs_linux.h | 1 - fs/xfs/xfs_log.c | 4 ++-- fs/xfs/xfs_log_recover.c | 54 ++++++++++++++++++++++++------------------------ 3 files changed, 29 insertions(+), 30 deletions(-)
fs/xfs/xfs_linux.h +0 -1
@@ -35,7 +35,6 @@ typedef unsigned long long int __uint64_t;typedef __s64 xfs_off_t ;/* <file offset> type */ typedef unsigned long long xfs_ino_t ;/* <inode> type */ typedef __s64 xfs_daddr_t ;/* <disk address> type */ -typedef char *xfs_caddr_t ;/* <core address> type */ typedef __u32 xfs_dev_t ;typedef __u32 xfs_nlink_t ;
fs/xfs/xfs_log.c +2 -2
@@ -1599,7 +1599,7 @@ xlog_pack_data(int i, j, k;int size = iclog->ic_offset + roundoff;__be32 cycle_lsn; -xfs_caddr_t dp; +char *dp; cycle_lsn =CYCLE_LSN_DISK (iclog->ic_header.h_lsn);
@@ -3806,7 +3806,7 @@ xlog_verify_iclog(if (!syncing || (field_offset &0x1ff )) { clientid = ophead->oh_clientid; }else { - idx =BTOBBT ((xfs_caddr_t )&(ophead->oh_clientid) - iclog->ic_datap); + idx =BTOBBT ((char *)&ophead->oh_clientid - iclog->ic_datap);if (idx >= (XLOG_HEADER_CYCLE_SIZE /BBSIZE )) { j = idx / (XLOG_HEADER_CYCLE_SIZE /BBSIZE ); k = idx % (XLOG_HEADER_CYCLE_SIZE /BBSIZE );
fs/xfs/xfs_log_recover.c +27 -27
190 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Brian Foster
Reviewed-byQuoted 2 lines · Christoph Hellwig
Remove some of the weirder typedefs in the XFS tree.
All 5 look fine to me:
Quoted 4 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs