From: Tomohiro Kusumi Date: Sun, 28 Aug 2016 09:08:02 +0000 (+0900) Subject: sys/vfs/hammer: Use typedef'd for struct hammer_inode* X-Git-Tag: v4.8.0rc~1146 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/e106786207dbc1d42397a79dde09a00ead066600 sys/vfs/hammer: Use typedef'd for struct hammer_inode* The whole hammer code is mix of using struct and typedef'd. Use typedef'd because majority of the code use typedef'd. --- diff --git a/sys/vfs/hammer/hammer.h b/sys/vfs/hammer/hammer.h index 4fa2c40221..f42e3f3c50 100644 --- a/sys/vfs/hammer/hammer.h +++ b/sys/vfs/hammer/hammer.h @@ -419,7 +419,7 @@ struct hammer_inode { typedef struct hammer_inode *hammer_inode_t; -#define VTOI(vp) ((struct hammer_inode *)(vp)->v_data) +#define VTOI(vp) ((hammer_inode_t)(vp)->v_data) /* * NOTE: DDIRTY does not include atime or mtime and does not include @@ -538,8 +538,8 @@ struct hammer_record { hammer_record_type_t type; struct hammer_lock lock; struct hammer_reserve *resv; - struct hammer_inode *ip; - struct hammer_inode *target_ip; + hammer_inode_t ip; + hammer_inode_t target_ip; struct hammer_btree_leaf_elm leaf; hammer_data_ondisk_t data; int flags; @@ -1059,26 +1059,26 @@ void hammer_critical_error(hammer_mount_t hmp, hammer_inode_t ip, int error, const char *msg); int hammer_vop_inactive(struct vop_inactive_args *); int hammer_vop_reclaim(struct vop_reclaim_args *); -int hammer_get_vnode(struct hammer_inode *ip, struct vnode **vpp); -struct hammer_inode *hammer_get_inode(hammer_transaction_t trans, +int hammer_get_vnode(hammer_inode_t ip, struct vnode **vpp); +hammer_inode_t hammer_get_inode(hammer_transaction_t trans, hammer_inode_t dip, int64_t obj_id, hammer_tid_t asof, uint32_t localization, int flags, int *errorp); -struct hammer_inode *hammer_get_dummy_inode(hammer_transaction_t trans, +hammer_inode_t hammer_get_dummy_inode(hammer_transaction_t trans, hammer_inode_t dip, int64_t obj_id, hammer_tid_t asof, uint32_t localization, int flags, int *errorp); -struct hammer_inode *hammer_find_inode(hammer_transaction_t trans, +hammer_inode_t hammer_find_inode(hammer_transaction_t trans, int64_t obj_id, hammer_tid_t asof, uint32_t localization); void hammer_scan_inode_snapshots(hammer_mount_t hmp, hammer_inode_info_t iinfo, int (*callback)(hammer_inode_t ip, void *data), void *data); -void hammer_put_inode(struct hammer_inode *ip); -void hammer_put_inode_ref(struct hammer_inode *ip); +void hammer_put_inode(hammer_inode_t ip); +void hammer_put_inode_ref(hammer_inode_t ip); void hammer_inode_waitreclaims(hammer_transaction_t trans); -void hammer_inode_dirty(struct hammer_inode *ip); +void hammer_inode_dirty(hammer_inode_t ip); int hammer_unload_volume(hammer_volume_t volume, void *data); int hammer_adjust_volume_mode(hammer_volume_t volume, void *data __unused); @@ -1362,10 +1362,10 @@ void hammer_flush_inode_done(hammer_inode_t ip, int error); void hammer_wait_inode(hammer_inode_t ip); int hammer_create_inode(hammer_transaction_t trans, struct vattr *vap, - struct ucred *cred, struct hammer_inode *dip, + struct ucred *cred, hammer_inode_t dip, const char *name, int namelen, hammer_pseudofs_inmem_t pfsm, - struct hammer_inode **ipp); + hammer_inode_t *ipp); void hammer_rel_inode(hammer_inode_t ip, int flush); int hammer_reload_inode(hammer_inode_t ip, void *arg __unused); int hammer_ino_rb_compare(hammer_inode_t ip1, hammer_inode_t ip2); @@ -1386,7 +1386,7 @@ int hammer_ip_del_direntry(hammer_transaction_t trans, void hammer_ip_replace_bulk(hammer_mount_t hmp, hammer_record_t record); hammer_record_t hammer_ip_add_bulk(hammer_inode_t ip, off_t file_offset, void *data, int bytes, int *errorp); -int hammer_ip_frontend_trunc(struct hammer_inode *ip, off_t file_size); +int hammer_ip_frontend_trunc(hammer_inode_t ip, off_t file_size); int hammer_ip_add_record(hammer_transaction_t trans, hammer_record_t record); int hammer_ip_delete_range(hammer_cursor_t cursor, hammer_inode_t ip, diff --git a/sys/vfs/hammer/hammer_cursor.h b/sys/vfs/hammer/hammer_cursor.h index d6f9d81300..25d8e3f743 100644 --- a/sys/vfs/hammer/hammer_cursor.h +++ b/sys/vfs/hammer/hammer_cursor.h @@ -113,7 +113,7 @@ struct hammer_cursor { /* * Merged in-memory/on-disk iterations also use these fields. */ - struct hammer_inode *ip; + hammer_inode_t ip; struct hammer_record *iprec; }; diff --git a/sys/vfs/hammer/hammer_inode.c b/sys/vfs/hammer/hammer_inode.c index 0857f3c906..7ae1af4ca5 100644 --- a/sys/vfs/hammer/hammer_inode.c +++ b/sys/vfs/hammer/hammer_inode.c @@ -36,7 +36,7 @@ #include "hammer.h" -static int hammer_unload_inode(struct hammer_inode *ip); +static int hammer_unload_inode(hammer_inode_t ip); static void hammer_free_inode(hammer_inode_t ip); static void hammer_flush_inode_core(hammer_inode_t ip, hammer_flush_group_t flg, int flags); @@ -51,7 +51,7 @@ static int hammer_setup_parent_inodes_helper(hammer_record_t record, static void hammer_inode_wakereclaims(hammer_inode_t ip); static struct hammer_inostats *hammer_inode_inostats(hammer_mount_t hmp, pid_t pid); -static struct hammer_inode *__hammer_find_inode(hammer_transaction_t trans, +static hammer_inode_t __hammer_find_inode(hammer_transaction_t trans, int64_t obj_id, hammer_tid_t asof, uint32_t localization); @@ -176,7 +176,7 @@ RB_GENERATE2(hammer_pfs_rb_tree, hammer_pseudofs_inmem, rb_node, int hammer_vop_inactive(struct vop_inactive_args *ap) { - struct hammer_inode *ip = VTOI(ap->a_vp); + hammer_inode_t ip = VTOI(ap->a_vp); hammer_mount_t hmp; /* @@ -223,7 +223,7 @@ hammer_vop_inactive(struct vop_inactive_args *ap) int hammer_vop_reclaim(struct vop_reclaim_args *ap) { - struct hammer_inode *ip; + hammer_inode_t ip; hammer_mount_t hmp; struct vnode *vp; @@ -259,7 +259,7 @@ hammer_vop_reclaim(struct vop_reclaim_args *ap) * should be stable without having to acquire any new locks. */ void -hammer_inode_dirty(struct hammer_inode *ip) +hammer_inode_dirty(hammer_inode_t ip) { struct vnode *vp; @@ -278,7 +278,7 @@ hammer_inode_dirty(struct hammer_inode *ip) * Called from the frontend. */ int -hammer_get_vnode(struct hammer_inode *ip, struct vnode **vpp) +hammer_get_vnode(hammer_inode_t ip, struct vnode **vpp) { hammer_mount_t hmp; struct vnode *vp; @@ -415,7 +415,7 @@ hammer_scan_inode_snapshots(hammer_mount_t hmp, hammer_inode_info_t iinfo, * * Called from the frontend. */ -struct hammer_inode * +hammer_inode_t hammer_get_inode(hammer_transaction_t trans, hammer_inode_t dip, int64_t obj_id, hammer_tid_t asof, uint32_t localization, int flags, int *errorp) @@ -423,7 +423,7 @@ hammer_get_inode(hammer_transaction_t trans, hammer_inode_t dip, hammer_mount_t hmp = trans->hmp; struct hammer_node_cache *cachep; struct hammer_cursor cursor; - struct hammer_inode *ip; + hammer_inode_t ip; /* @@ -603,13 +603,13 @@ retry: /* * Get a dummy inode to placemark a broken directory entry. */ -struct hammer_inode * +hammer_inode_t hammer_get_dummy_inode(hammer_transaction_t trans, hammer_inode_t dip, int64_t obj_id, hammer_tid_t asof, uint32_t localization, int flags, int *errorp) { hammer_mount_t hmp = trans->hmp; - struct hammer_inode *ip; + hammer_inode_t ip; /* * Determine if we already have an inode cached. If we do then @@ -710,11 +710,11 @@ loop: * Return a referenced inode only if it is in our inode cache. * Dummy inodes do not count. */ -struct hammer_inode * +hammer_inode_t hammer_find_inode(hammer_transaction_t trans, int64_t obj_id, hammer_tid_t asof, uint32_t localization) { - struct hammer_inode *ip; + hammer_inode_t ip; ip = __hammer_find_inode(trans, obj_id, asof, localization); if (ip) { @@ -730,13 +730,13 @@ hammer_find_inode(hammer_transaction_t trans, int64_t obj_id, * Return a referenced inode only if it is in our inode cache. * This function does not reference inode. */ -static struct hammer_inode * +static hammer_inode_t __hammer_find_inode(hammer_transaction_t trans, int64_t obj_id, hammer_tid_t asof, uint32_t localization) { hammer_mount_t hmp = trans->hmp; struct hammer_inode_info iinfo; - struct hammer_inode *ip; + hammer_inode_t ip; iinfo.obj_id = obj_id; iinfo.obj_asof = asof; @@ -758,7 +758,7 @@ int hammer_create_inode(hammer_transaction_t trans, struct vattr *vap, struct ucred *cred, hammer_inode_t dip, const char *name, int namelen, - hammer_pseudofs_inmem_t pfsm, struct hammer_inode **ipp) + hammer_pseudofs_inmem_t pfsm, hammer_inode_t *ipp) { hammer_mount_t hmp; hammer_inode_t ip; @@ -1479,7 +1479,7 @@ retry: * disposition. */ void -hammer_rel_inode(struct hammer_inode *ip, int flush) +hammer_rel_inode(hammer_inode_t ip, int flush) { /* * Handle disposition when dropping the last ref. @@ -1522,7 +1522,7 @@ hammer_rel_inode(struct hammer_inode *ip, int flush) * The inode must be completely clean. */ static int -hammer_unload_inode(struct hammer_inode *ip) +hammer_unload_inode(hammer_inode_t ip) { hammer_mount_t hmp = ip->hmp; @@ -1555,7 +1555,7 @@ hammer_unload_inode(struct hammer_inode *ip) * release and asserts that the inode is gone. */ int -hammer_destroy_inode_callback(struct hammer_inode *ip, void *data __unused) +hammer_destroy_inode_callback(hammer_inode_t ip, void *data __unused) { hammer_record_t rec; diff --git a/sys/vfs/hammer/hammer_object.c b/sys/vfs/hammer/hammer_object.c index ddc38210c2..6806bc01a0 100644 --- a/sys/vfs/hammer/hammer_object.c +++ b/sys/vfs/hammer/hammer_object.c @@ -657,8 +657,8 @@ hammer_mem_first(hammer_cursor_t cursor) */ int hammer_ip_add_direntry(hammer_transaction_t trans, - struct hammer_inode *dip, const char *name, int bytes, - struct hammer_inode *ip) + hammer_inode_t dip, const char *name, int bytes, + hammer_inode_t ip) { struct hammer_cursor cursor; hammer_record_t record; @@ -760,8 +760,8 @@ failed: */ int hammer_ip_del_direntry(hammer_transaction_t trans, - hammer_cursor_t cursor, struct hammer_inode *dip, - struct hammer_inode *ip) + hammer_cursor_t cursor, hammer_inode_t dip, + hammer_inode_t ip) { hammer_record_t record; int error; @@ -1061,7 +1061,7 @@ hammer_ip_replace_bulk(hammer_mount_t hmp, hammer_record_t record) * This code is only called on regular files. */ int -hammer_ip_frontend_trunc(struct hammer_inode *ip, off_t file_size) +hammer_ip_frontend_trunc(hammer_inode_t ip, off_t file_size) { struct rec_trunc_info info; diff --git a/sys/vfs/hammer/hammer_ondisk.c b/sys/vfs/hammer/hammer_ondisk.c index a050636fce..eff7921c4e 100644 --- a/sys/vfs/hammer/hammer_ondisk.c +++ b/sys/vfs/hammer/hammer_ondisk.c @@ -1773,7 +1773,7 @@ static int hammer_sync_scan2(struct mount *mp, struct vnode *vp, void *data) { struct hammer_sync_info *info = data; - struct hammer_inode *ip; + hammer_inode_t ip; int error; ip = VTOI(vp); diff --git a/sys/vfs/hammer/hammer_recover.c b/sys/vfs/hammer/hammer_recover.c index ac4eb59a5e..e7d07f654f 100644 --- a/sys/vfs/hammer/hammer_recover.c +++ b/sys/vfs/hammer/hammer_recover.c @@ -1299,7 +1299,7 @@ hammer_recover_redo_exec(hammer_mount_t hmp, hammer_fifo_redo_t redo) { struct hammer_transaction trans; struct vattr va; - struct hammer_inode *ip; + hammer_inode_t ip; struct vnode *vp = NULL; int error; diff --git a/sys/vfs/hammer/hammer_vfsops.c b/sys/vfs/hammer/hammer_vfsops.c index 1fa5dba47a..9b5d701ce8 100644 --- a/sys/vfs/hammer/hammer_vfsops.c +++ b/sys/vfs/hammer/hammer_vfsops.c @@ -967,7 +967,7 @@ hammer_vfs_vget(struct mount *mp, struct vnode *dvp, { struct hammer_transaction trans; struct hammer_mount *hmp = (void *)mp->mnt_data; - struct hammer_inode *ip; + hammer_inode_t ip; int error; uint32_t localization; @@ -1152,7 +1152,7 @@ hammer_vfs_fhtovp(struct mount *mp, struct vnode *rootvp, { hammer_mount_t hmp = (void *)mp->mnt_data; struct hammer_transaction trans; - struct hammer_inode *ip; + hammer_inode_t ip; struct hammer_inode_info info; int error; uint32_t localization; diff --git a/sys/vfs/hammer/hammer_vnops.c b/sys/vfs/hammer/hammer_vnops.c index 11a2b16bc7..75ce8ad07e 100644 --- a/sys/vfs/hammer/hammer_vnops.c +++ b/sys/vfs/hammer/hammer_vnops.c @@ -490,7 +490,7 @@ int hammer_vop_write(struct vop_write_args *ap) { struct hammer_transaction trans; - struct hammer_inode *ip; + hammer_inode_t ip; hammer_mount_t hmp; thread_t td; struct uio *uio; @@ -836,7 +836,7 @@ static int hammer_vop_access(struct vop_access_args *ap) { - struct hammer_inode *ip = VTOI(ap->a_vp); + hammer_inode_t ip = VTOI(ap->a_vp); uid_t uid; gid_t gid; int error; @@ -904,8 +904,8 @@ int hammer_vop_ncreate(struct vop_ncreate_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; - struct hammer_inode *nip; + hammer_inode_t dip; + hammer_inode_t nip; struct nchandle *nch; hammer_mount_t hmp; int error; @@ -987,7 +987,7 @@ static int hammer_vop_getattr(struct vop_getattr_args *ap) { - struct hammer_inode *ip = VTOI(ap->a_vp); + hammer_inode_t ip = VTOI(ap->a_vp); struct vattr *vap = ap->a_vap; /* @@ -1304,8 +1304,8 @@ int hammer_vop_nlookupdotdot(struct vop_nlookupdotdot_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; - struct hammer_inode *ip; + hammer_inode_t dip; + hammer_inode_t ip; hammer_mount_t hmp; int64_t parent_obj_id; uint32_t parent_obj_localization; @@ -1370,8 +1370,8 @@ int hammer_vop_nlink(struct vop_nlink_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; - struct hammer_inode *ip; + hammer_inode_t dip; + hammer_inode_t ip; struct nchandle *nch; hammer_mount_t hmp; int error; @@ -1435,8 +1435,8 @@ int hammer_vop_nmkdir(struct vop_nmkdir_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; - struct hammer_inode *nip; + hammer_inode_t dip; + hammer_inode_t nip; struct nchandle *nch; hammer_mount_t hmp; int error; @@ -1512,8 +1512,8 @@ int hammer_vop_nmknod(struct vop_nmknod_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; - struct hammer_inode *nip; + hammer_inode_t dip; + hammer_inode_t nip; struct nchandle *nch; hammer_mount_t hmp; int error; @@ -1617,7 +1617,7 @@ hammer_vop_readdir(struct vop_readdir_args *ap) { struct hammer_transaction trans; struct hammer_cursor cursor; - struct hammer_inode *ip; + hammer_inode_t ip; hammer_mount_t hmp; struct uio *uio; hammer_base_elm_t base; @@ -1773,7 +1773,7 @@ hammer_vop_readlink(struct vop_readlink_args *ap) { struct hammer_transaction trans; struct hammer_cursor cursor; - struct hammer_inode *ip; + hammer_inode_t ip; hammer_mount_t hmp; char buf[32]; uint32_t localization; @@ -1885,7 +1885,7 @@ int hammer_vop_nremove(struct vop_nremove_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; + hammer_inode_t dip; hammer_mount_t hmp; int error; @@ -1918,9 +1918,9 @@ hammer_vop_nrename(struct vop_nrename_args *ap) struct hammer_transaction trans; struct namecache *fncp; struct namecache *tncp; - struct hammer_inode *fdip; - struct hammer_inode *tdip; - struct hammer_inode *ip; + hammer_inode_t fdip; + hammer_inode_t tdip; + hammer_inode_t ip; hammer_mount_t hmp; struct hammer_cursor cursor; int64_t namekey; @@ -2088,7 +2088,7 @@ int hammer_vop_nrmdir(struct vop_nrmdir_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; + hammer_inode_t dip; hammer_mount_t hmp; int error; @@ -2119,7 +2119,7 @@ int hammer_vop_markatime(struct vop_markatime_args *ap) { struct hammer_transaction trans; - struct hammer_inode *ip; + hammer_inode_t ip; hammer_mount_t hmp; ip = VTOI(ap->a_vp); @@ -2150,7 +2150,7 @@ int hammer_vop_setattr(struct vop_setattr_args *ap) { struct hammer_transaction trans; - struct hammer_inode *ip; + hammer_inode_t ip; struct vattr *vap; hammer_mount_t hmp; int modflags; @@ -2379,8 +2379,8 @@ int hammer_vop_nsymlink(struct vop_nsymlink_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; - struct hammer_inode *nip; + hammer_inode_t dip; + hammer_inode_t nip; hammer_record_t record; struct nchandle *nch; hammer_mount_t hmp; @@ -2483,7 +2483,7 @@ int hammer_vop_nwhiteout(struct vop_nwhiteout_args *ap) { struct hammer_transaction trans; - struct hammer_inode *dip; + hammer_inode_t dip; hammer_mount_t hmp; int error; @@ -2513,7 +2513,7 @@ static int hammer_vop_ioctl(struct vop_ioctl_args *ap) { - struct hammer_inode *ip = ap->a_vp->v_data; + hammer_inode_t ip = ap->a_vp->v_data; hammer_mount_t hmp = ip->hmp; int error; @@ -2639,8 +2639,8 @@ int hammer_vop_strategy_read(struct vop_strategy_args *ap) { struct hammer_transaction trans; - struct hammer_inode *ip; - struct hammer_inode *dip; + hammer_inode_t ip; + hammer_inode_t dip; hammer_mount_t hmp; struct hammer_cursor cursor; hammer_base_elm_t base; @@ -2974,7 +2974,7 @@ int hammer_vop_bmap(struct vop_bmap_args *ap) { struct hammer_transaction trans; - struct hammer_inode *ip; + hammer_inode_t ip; hammer_mount_t hmp; struct hammer_cursor cursor; hammer_base_elm_t base;