From 8089741c909e84020e644ac05c58d3a4bb9cc1e2 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 9 Aug 2017 20:05:56 -0500 Subject: [PATCH] SOLARIS: Reorder definitions for vnode callbacks Currently, many of the functions for our vnode ops are forward-declared, right before they are referenced in the relevant vnop template array. Move the function definitions to before the references, so we can simply get rid of the forward declarations. These functions are also all only referenced in this file, so declare them 'static'. Reviewed-on: https://gerrit.openafs.org/12693 Reviewed-by: Mark Vitale Reviewed-by: Michael Meffie Reviewed-by: Marcio Brito Barbosa Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Tested-by: Mark Vitale (cherry picked from commit 41a22dbf719629e0977fa963b3d19c6594d0d729) Change-Id: I5840fef98d2ce15525c4981636fad6e5990cbad2 Reviewed-on: https://gerrit.openafs.org/13525 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- src/afs/SOLARIS/osi_vnodeops.c | 382 ++++++++++++++------------------- 1 file changed, 166 insertions(+), 216 deletions(-) diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index bd03bd105..9fe9d47fd 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -1275,205 +1275,8 @@ afs_getsecattr(struct vnode *vp, vsecattr_t *vsecattr, int flag, struct cred *cr #endif #ifdef AFS_GLOBAL_SUNLOCK -extern int gafs_open(struct vcache **avcp, afs_int32 aflags, - afs_ucred_t *acred); -extern int gafs_close(struct vcache *avc, afs_int32 aflags, - int count, offset_t offset, afs_ucred_t *acred); -extern int afs_ioctl(struct vnode *vnp, int com, int arg, int flag, - cred_t *credp, int *rvalp); -extern int gafs_access(struct vcache *avc, afs_int32 amode, - int flags, afs_ucred_t *acred); -extern int gafs_getattr(struct vcache *avc, - struct vattr *attrs, int flags, - afs_ucred_t *acred); -extern int gafs_setattr(struct vcache *avc, - struct vattr *attrs, int flags, - afs_ucred_t *acred); -extern int gafs_lookup(struct vcache *adp, char *aname, - struct vcache **avcp, struct pathname *pnp, - int flags, struct vnode *rdir, afs_ucred_t *acred); -extern int gafs_remove(struct vcache *adp, char *aname, - afs_ucred_t *acred); -extern int gafs_link(struct vcache *adp, struct vcache *avc, - char *aname, afs_ucred_t *acred); -extern int gafs_rename(struct vcache *aodp, char *aname1, - struct vcache *andp, char *aname2, - afs_ucred_t *acred); -extern int gafs_symlink(struct vcache *adp, char *aname, - struct vattr *attrs, char *atargetName, - afs_ucred_t *acred); -extern int gafs_rmdir(struct vcache *adp, char *aname, - struct vnode *cdirp, afs_ucred_t *acred); -extern int gafs_mkdir(struct vcache *adp, char *aname, - struct vattr *attrs, struct vcache **avcp, - afs_ucred_t *acred); -extern int gafs_fsync(struct vcache *avc, int flag, afs_ucred_t *acred); -extern int gafs_readlink(struct vcache *avc, struct uio *auio, - afs_ucred_t *acred); -extern int gafs_readdir(struct vcache *avc, struct uio *auio, - afs_ucred_t *acred, int *eofp); -extern void gafs_inactive(struct vcache *avc, - afs_ucred_t *acred); -extern int gafs_fid(struct vcache *avc, struct fid **fidpp); -extern int gafs_create(struct vcache *adp, char *aname, - struct vattr *attrs, enum vcexcl aexcl, int amode, - struct vcache **avcp, afs_ucred_t *acred); -#ifdef AFS_SUN511_ENV -extern int afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap, - afs_ucred_t *credp, caller_context_t *ct); -#else -extern int afs_pathconf(struct vnode *vp, int cmd, u_long *outdatap, - afs_ucred_t *credp); -#endif /* AFS_SUN511_ENV */ -#if defined(AFS_SUN511_ENV) -/* The following list must always be NULL-terminated */ -const fs_operation_def_t afs_vnodeops_template[] = { - VOPNAME_OPEN, { .vop_open = gafs_open }, - VOPNAME_CLOSE, { .vop_close = gafs_close }, - VOPNAME_READ, { .vop_read = afs_vmread }, - VOPNAME_WRITE, { .vop_write = afs_vmwrite }, - VOPNAME_IOCTL, { .vop_ioctl = afs_ioctl }, - VOPNAME_SETFL, { .vop_setfl = fs_setfl }, - VOPNAME_GETATTR, { .vop_getattr = gafs_getattr }, - VOPNAME_SETATTR, { .vop_setattr = gafs_setattr }, - VOPNAME_ACCESS, { .vop_access = gafs_access }, - VOPNAME_LOOKUP, { .vop_lookup = gafs_lookup }, - VOPNAME_CREATE, { .vop_create = gafs_create }, - VOPNAME_REMOVE, { .vop_remove = gafs_remove }, - VOPNAME_LINK, { .vop_link = gafs_link }, - VOPNAME_RENAME, { .vop_rename = gafs_rename }, - VOPNAME_MKDIR, { .vop_mkdir = gafs_mkdir }, - VOPNAME_RMDIR, { .vop_rmdir = gafs_rmdir }, - VOPNAME_READDIR, { .vop_readdir = gafs_readdir }, - VOPNAME_SYMLINK, { .vop_symlink = gafs_symlink }, - VOPNAME_READLINK, { .vop_readlink = gafs_readlink }, - VOPNAME_FSYNC, { .vop_fsync = gafs_fsync }, - VOPNAME_INACTIVE, { .vop_inactive = gafs_inactive }, - VOPNAME_FID, { .vop_fid = gafs_fid }, - VOPNAME_RWLOCK, { .vop_rwlock = afs_rwlock }, - VOPNAME_RWUNLOCK, { .vop_rwunlock = afs_rwunlock }, - VOPNAME_SEEK, { .vop_seek = afs_seek }, - VOPNAME_CMP, { .vop_cmp = afs_cmp }, - VOPNAME_FRLOCK, { .vop_frlock = afs_frlock }, - VOPNAME_SPACE, { .vop_space = afs_space }, - VOPNAME_REALVP, { .vop_realvp = afs_realvp }, - VOPNAME_GETPAGE, { .vop_getpage = afs_getpage }, - VOPNAME_PUTPAGE, { .vop_putpage = afs_putpage }, - VOPNAME_MAP, { .vop_map = afs_map }, - VOPNAME_ADDMAP, { .vop_addmap = afs_addmap }, - VOPNAME_DELMAP, { .vop_delmap = afs_delmap }, - VOPNAME_POLL, { .vop_poll = fs_poll }, - VOPNAME_PATHCONF, { .vop_pathconf = afs_pathconf }, - VOPNAME_PAGEIO, { .vop_pageio = afs_pageio }, - VOPNAME_DUMP, { .vop_dump = afs_dump }, - VOPNAME_DUMPCTL, { .vop_dumpctl = afs_dumpctl }, - VOPNAME_DISPOSE, { .vop_dispose = afs_dispose }, - VOPNAME_GETSECATTR, { .vop_getsecattr = afs_getsecattr }, - VOPNAME_SETSECATTR, { .vop_setsecattr = afs_setsecattr }, - VOPNAME_SHRLOCK, { .vop_shrlock = fs_shrlock }, - NULL, NULL -}; -vnodeops_t *afs_ops; -#elif defined(AFS_SUN510_ENV) -/* The following list must always be NULL-terminated */ -const fs_operation_def_t afs_vnodeops_template[] = { - VOPNAME_OPEN, gafs_open, - VOPNAME_CLOSE, gafs_close, - VOPNAME_READ, afs_vmread, - VOPNAME_WRITE, afs_vmwrite, - VOPNAME_IOCTL, afs_ioctl, - VOPNAME_SETFL, fs_setfl, - VOPNAME_GETATTR, gafs_getattr, - VOPNAME_SETATTR, gafs_setattr, - VOPNAME_ACCESS, gafs_access, - VOPNAME_LOOKUP, gafs_lookup, - VOPNAME_CREATE, gafs_create, - VOPNAME_REMOVE, gafs_remove, - VOPNAME_LINK, gafs_link, - VOPNAME_RENAME, gafs_rename, - VOPNAME_MKDIR, gafs_mkdir, - VOPNAME_RMDIR, gafs_rmdir, - VOPNAME_READDIR, gafs_readdir, - VOPNAME_SYMLINK, gafs_symlink, - VOPNAME_READLINK, gafs_readlink, - VOPNAME_FSYNC, gafs_fsync, - VOPNAME_INACTIVE, gafs_inactive, - VOPNAME_FID, gafs_fid, - VOPNAME_RWLOCK, afs_rwlock, - VOPNAME_RWUNLOCK, afs_rwunlock, - VOPNAME_SEEK, afs_seek, - VOPNAME_CMP, afs_cmp, - VOPNAME_FRLOCK, afs_frlock, - VOPNAME_SPACE, afs_space, - VOPNAME_REALVP, afs_realvp, - VOPNAME_GETPAGE, afs_getpage, - VOPNAME_PUTPAGE, afs_putpage, - VOPNAME_MAP, afs_map, - VOPNAME_ADDMAP, afs_addmap, - VOPNAME_DELMAP, afs_delmap, - VOPNAME_POLL, fs_poll, - VOPNAME_DUMP, afs_dump, - VOPNAME_PATHCONF, afs_pathconf, - VOPNAME_PAGEIO, afs_pageio, - VOPNAME_DUMPCTL, afs_dumpctl, - VOPNAME_DISPOSE, afs_dispose, - VOPNAME_GETSECATTR, afs_getsecattr, - VOPNAME_SETSECATTR, afs_setsecattr, - VOPNAME_SHRLOCK, fs_shrlock, - NULL, NULL -}; -struct vnodeops *afs_ops; -#else -struct vnodeops Afs_vnodeops = { - gafs_open, - gafs_close, - afs_vmread, - afs_vmwrite, - afs_ioctl, - fs_setfl, - gafs_getattr, - gafs_setattr, - gafs_access, - gafs_lookup, - gafs_create, - gafs_remove, - gafs_link, - gafs_rename, - gafs_mkdir, - gafs_rmdir, - gafs_readdir, - gafs_symlink, - gafs_readlink, - gafs_fsync, - gafs_inactive, - gafs_fid, - afs_rwlock, - afs_rwunlock, - afs_seek, - afs_cmp, - afs_frlock, - afs_space, - afs_realvp, - afs_getpage, - afs_putpage, - afs_map, - afs_addmap, - afs_delmap, - fs_poll, - afs_dump, - afs_pathconf, - afs_pageio, - afs_dumpctl, - afs_dispose, - afs_setsecattr, - afs_getsecattr, - fs_shrlock, -}; -struct vnodeops *afs_ops = &Afs_vnodeops; -#endif - -int +static int gafs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred) { @@ -1485,7 +1288,7 @@ gafs_open(struct vcache **avcp, afs_int32 aflags, return (code); } -int +static int gafs_close(struct vcache *avc, afs_int32 aflags, int count, offset_t offset, afs_ucred_t *acred) { @@ -1497,7 +1300,7 @@ gafs_close(struct vcache *avc, afs_int32 aflags, int count, return (code); } -int +static int gafs_getattr(struct vcache *avc, struct vattr *attrs, int flags, afs_ucred_t *acred) { @@ -1510,7 +1313,7 @@ gafs_getattr(struct vcache *avc, struct vattr *attrs, } -int +static int gafs_setattr(struct vcache *avc, struct vattr *attrs, int flags, afs_ucred_t *acred) { @@ -1523,7 +1326,7 @@ gafs_setattr(struct vcache *avc, struct vattr *attrs, } -int +static int gafs_access(struct vcache *avc, afs_int32 amode, int flags, afs_ucred_t *acred) { @@ -1536,7 +1339,7 @@ gafs_access(struct vcache *avc, afs_int32 amode, int flags, } -int +static int gafs_lookup(struct vcache *adp, char *aname, struct vcache **avcp, struct pathname *pnp, int flags, struct vnode *rdir, afs_ucred_t *acred) @@ -1550,7 +1353,7 @@ gafs_lookup(struct vcache *adp, char *aname, } -int +static int gafs_create(struct vcache *adp, char *aname, struct vattr *attrs, enum vcexcl aexcl, int amode, struct vcache **avcp, afs_ucred_t *acred) @@ -1563,7 +1366,7 @@ gafs_create(struct vcache *adp, char *aname, struct vattr *attrs, return (code); } -int +static int gafs_remove(struct vcache *adp, char *aname, afs_ucred_t *acred) { int code; @@ -1574,7 +1377,7 @@ gafs_remove(struct vcache *adp, char *aname, afs_ucred_t *acred) return (code); } -int +static int gafs_link(struct vcache *adp, struct vcache *avc, char *aname, afs_ucred_t *acred) { @@ -1586,7 +1389,7 @@ gafs_link(struct vcache *adp, struct vcache *avc, return (code); } -int +static int gafs_rename(struct vcache *aodp, char *aname1, struct vcache *andp, char *aname2, afs_ucred_t *acred) @@ -1623,7 +1426,7 @@ gafs_rename(struct vcache *aodp, char *aname1, return (code); } -int +static int gafs_mkdir(struct vcache *adp, char *aname, struct vattr *attrs, struct vcache **avcp, afs_ucred_t *acred) { @@ -1635,7 +1438,7 @@ gafs_mkdir(struct vcache *adp, char *aname, struct vattr *attrs, return (code); } -int +static int gafs_rmdir(struct vcache *adp, char *aname, struct vnode *cdirp, afs_ucred_t *acred) { @@ -1648,7 +1451,7 @@ gafs_rmdir(struct vcache *adp, char *aname, struct vnode *cdirp, } -int +static int gafs_readdir(struct vcache *avc, struct uio *auio, afs_ucred_t *acred, int *eofp) { @@ -1660,7 +1463,7 @@ gafs_readdir(struct vcache *avc, struct uio *auio, return (code); } -int +static int gafs_symlink(struct vcache *adp, char *aname, struct vattr *attrs, char *atargetName, afs_ucred_t *acred) { @@ -1673,7 +1476,7 @@ gafs_symlink(struct vcache *adp, char *aname, struct vattr *attrs, } -int +static int gafs_readlink(struct vcache *avc, struct uio *auio, afs_ucred_t *acred) { int code; @@ -1684,7 +1487,7 @@ gafs_readlink(struct vcache *avc, struct uio *auio, afs_ucred_t *acred) return (code); } -int +static int gafs_fsync(struct vcache *avc, int flag, afs_ucred_t *acred) { int code; @@ -1695,7 +1498,7 @@ gafs_fsync(struct vcache *avc, int flag, afs_ucred_t *acred) return (code); } -int +static int afs_inactive(struct vcache *avc, afs_ucred_t *acred) { struct vnode *vp = AFSTOV(avc); @@ -1744,7 +1547,7 @@ afs_inactive(struct vcache *avc, afs_ucred_t *acred) return 0; } -void +static void gafs_inactive(struct vcache *avc, afs_ucred_t *acred) { AFS_GLOCK(); @@ -1753,7 +1556,7 @@ gafs_inactive(struct vcache *avc, afs_ucred_t *acred) } -int +static int gafs_fid(struct vcache *avc, struct fid **fidpp) { int code; @@ -1764,4 +1567,151 @@ gafs_fid(struct vcache *avc, struct fid **fidpp) return (code); } +#if defined(AFS_SUN511_ENV) +/* The following list must always be NULL-terminated */ +const fs_operation_def_t afs_vnodeops_template[] = { + VOPNAME_OPEN, { .vop_open = gafs_open }, + VOPNAME_CLOSE, { .vop_close = gafs_close }, + VOPNAME_READ, { .vop_read = afs_vmread }, + VOPNAME_WRITE, { .vop_write = afs_vmwrite }, + VOPNAME_IOCTL, { .vop_ioctl = afs_ioctl }, + VOPNAME_SETFL, { .vop_setfl = fs_setfl }, + VOPNAME_GETATTR, { .vop_getattr = gafs_getattr }, + VOPNAME_SETATTR, { .vop_setattr = gafs_setattr }, + VOPNAME_ACCESS, { .vop_access = gafs_access }, + VOPNAME_LOOKUP, { .vop_lookup = gafs_lookup }, + VOPNAME_CREATE, { .vop_create = gafs_create }, + VOPNAME_REMOVE, { .vop_remove = gafs_remove }, + VOPNAME_LINK, { .vop_link = gafs_link }, + VOPNAME_RENAME, { .vop_rename = gafs_rename }, + VOPNAME_MKDIR, { .vop_mkdir = gafs_mkdir }, + VOPNAME_RMDIR, { .vop_rmdir = gafs_rmdir }, + VOPNAME_READDIR, { .vop_readdir = gafs_readdir }, + VOPNAME_SYMLINK, { .vop_symlink = gafs_symlink }, + VOPNAME_READLINK, { .vop_readlink = gafs_readlink }, + VOPNAME_FSYNC, { .vop_fsync = gafs_fsync }, + VOPNAME_INACTIVE, { .vop_inactive = gafs_inactive }, + VOPNAME_FID, { .vop_fid = gafs_fid }, + VOPNAME_RWLOCK, { .vop_rwlock = afs_rwlock }, + VOPNAME_RWUNLOCK, { .vop_rwunlock = afs_rwunlock }, + VOPNAME_SEEK, { .vop_seek = afs_seek }, + VOPNAME_CMP, { .vop_cmp = afs_cmp }, + VOPNAME_FRLOCK, { .vop_frlock = afs_frlock }, + VOPNAME_SPACE, { .vop_space = afs_space }, + VOPNAME_REALVP, { .vop_realvp = afs_realvp }, + VOPNAME_GETPAGE, { .vop_getpage = afs_getpage }, + VOPNAME_PUTPAGE, { .vop_putpage = afs_putpage }, + VOPNAME_MAP, { .vop_map = afs_map }, + VOPNAME_ADDMAP, { .vop_addmap = afs_addmap }, + VOPNAME_DELMAP, { .vop_delmap = afs_delmap }, + VOPNAME_POLL, { .vop_poll = fs_poll }, + VOPNAME_PATHCONF, { .vop_pathconf = afs_pathconf }, + VOPNAME_PAGEIO, { .vop_pageio = afs_pageio }, + VOPNAME_DUMP, { .vop_dump = afs_dump }, + VOPNAME_DUMPCTL, { .vop_dumpctl = afs_dumpctl }, + VOPNAME_DISPOSE, { .vop_dispose = afs_dispose }, + VOPNAME_GETSECATTR, { .vop_getsecattr = afs_getsecattr }, + VOPNAME_SETSECATTR, { .vop_setsecattr = afs_setsecattr }, + VOPNAME_SHRLOCK, { .vop_shrlock = fs_shrlock }, + NULL, NULL +}; +vnodeops_t *afs_ops; +#elif defined(AFS_SUN510_ENV) +/* The following list must always be NULL-terminated */ +const fs_operation_def_t afs_vnodeops_template[] = { + VOPNAME_OPEN, gafs_open, + VOPNAME_CLOSE, gafs_close, + VOPNAME_READ, afs_vmread, + VOPNAME_WRITE, afs_vmwrite, + VOPNAME_IOCTL, afs_ioctl, + VOPNAME_SETFL, fs_setfl, + VOPNAME_GETATTR, gafs_getattr, + VOPNAME_SETATTR, gafs_setattr, + VOPNAME_ACCESS, gafs_access, + VOPNAME_LOOKUP, gafs_lookup, + VOPNAME_CREATE, gafs_create, + VOPNAME_REMOVE, gafs_remove, + VOPNAME_LINK, gafs_link, + VOPNAME_RENAME, gafs_rename, + VOPNAME_MKDIR, gafs_mkdir, + VOPNAME_RMDIR, gafs_rmdir, + VOPNAME_READDIR, gafs_readdir, + VOPNAME_SYMLINK, gafs_symlink, + VOPNAME_READLINK, gafs_readlink, + VOPNAME_FSYNC, gafs_fsync, + VOPNAME_INACTIVE, gafs_inactive, + VOPNAME_FID, gafs_fid, + VOPNAME_RWLOCK, afs_rwlock, + VOPNAME_RWUNLOCK, afs_rwunlock, + VOPNAME_SEEK, afs_seek, + VOPNAME_CMP, afs_cmp, + VOPNAME_FRLOCK, afs_frlock, + VOPNAME_SPACE, afs_space, + VOPNAME_REALVP, afs_realvp, + VOPNAME_GETPAGE, afs_getpage, + VOPNAME_PUTPAGE, afs_putpage, + VOPNAME_MAP, afs_map, + VOPNAME_ADDMAP, afs_addmap, + VOPNAME_DELMAP, afs_delmap, + VOPNAME_POLL, fs_poll, + VOPNAME_DUMP, afs_dump, + VOPNAME_PATHCONF, afs_pathconf, + VOPNAME_PAGEIO, afs_pageio, + VOPNAME_DUMPCTL, afs_dumpctl, + VOPNAME_DISPOSE, afs_dispose, + VOPNAME_GETSECATTR, afs_getsecattr, + VOPNAME_SETSECATTR, afs_setsecattr, + VOPNAME_SHRLOCK, fs_shrlock, + NULL, NULL +}; +struct vnodeops *afs_ops; +#else +struct vnodeops Afs_vnodeops = { + gafs_open, + gafs_close, + afs_vmread, + afs_vmwrite, + afs_ioctl, + fs_setfl, + gafs_getattr, + gafs_setattr, + gafs_access, + gafs_lookup, + gafs_create, + gafs_remove, + gafs_link, + gafs_rename, + gafs_mkdir, + gafs_rmdir, + gafs_readdir, + gafs_symlink, + gafs_readlink, + gafs_fsync, + gafs_inactive, + gafs_fid, + afs_rwlock, + afs_rwunlock, + afs_seek, + afs_cmp, + afs_frlock, + afs_space, + afs_realvp, + afs_getpage, + afs_putpage, + afs_map, + afs_addmap, + afs_delmap, + fs_poll, + afs_dump, + afs_pathconf, + afs_pageio, + afs_dumpctl, + afs_dispose, + afs_setsecattr, + afs_getsecattr, + fs_shrlock, +}; +struct vnodeops *afs_ops = &Afs_vnodeops; +#endif + #endif /* AFS_GLOBAL_SUNLOCK */ -- 2.39.5