From 51c0387aaa5ec507c6e29063ef56d98e2931402d Mon Sep 17 00:00:00 2001 From: Marcio Barbosa Date: Wed, 23 Mar 2022 16:04:46 -0300 Subject: [PATCH] UKERNEL: Remove flock -> usr_flock redirection In order to replace 'struck flock' with 'struct usr_flock' and 'flock()' with 'usr_flock()', the current version of src/afs/UKERNEL/sysincludes.h defines flock to usr_flock. This can cause problems when trying to use libroken in UKERNEL code, because roken.h redefines flock. To avoid conflicts with libroken (included in a future commit), add a new UKERNEL specific AFS_FLOCK -> usr_flock redirection. Doing so, the flock -> usr_flock redirection can be removed. While here, also remove 'usr_flock()' as it shouldn't be called and is not defined in any header file. Change-Id: Ia71811513ab6655f60d8b63fc18b26be663ab4dc Reviewed-on: https://gerrit.openafs.org/14913 Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/UKERNEL/afs_usrops.c | 11 ----------- src/afs/UKERNEL/sysincludes.h | 4 +--- src/afs/afs.h | 16 ++++++++-------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 8fbc109f7e..501a5c7610 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -181,17 +181,6 @@ afs_suser(afs_ucred_t *credp) * These are no-ops in user space */ -/* - * xflock should never fall through, the only files we know - * about are AFS files - */ -int -usr_flock(void) -{ - usr_assert(0); - return 0; -} - /* * ioctl should never fall through, the only files we know * about are AFS files diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index 76409b1ce9..dcf6886d46 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -201,7 +201,6 @@ typedef unsigned int fsblkcnt_t; #define statfs usr_statfs #define file usr_file #define dirent usr_dirent -#define flock usr_flock #define fid usr_fid #define sysent usr_sysent #define ifaddr usr_ifaddr @@ -1101,7 +1100,6 @@ struct usr_buf { struct vcache; #define afs_ucred_t struct usr_ucred -#define AFS_FLOCK flock struct usr_vnodeops { @@ -1136,7 +1134,7 @@ struct usr_vnodeops { int (*vn_strategy) (void); int (*vn_bread) (void); int (*vn_brelse) (void); - int (*vn_lockctl) (struct vcache *, struct AFS_FLOCK *, int, + int (*vn_lockctl) (struct vcache *, struct usr_flock *, int, afs_ucred_t *); int (*vn_fid) (struct vcache *avc, struct fid **); }; diff --git a/src/afs/afs.h b/src/afs/afs.h index ae18a3b10e..6735c8450c 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -70,15 +70,15 @@ extern enum afs_shutdown_state afs_shuttingdown; #define AFS_VFS_FAKEFREE (2147483647) /* Moved from VNOPS/afs_vnop_flocks so can be used in prototypes */ -#if defined(AFS_HPUX102_ENV) -#define AFS_FLOCK k_flock +#if defined(UKERNEL) +# define AFS_FLOCK usr_flock +#elif defined(AFS_HPUX102_ENV) +# define AFS_FLOCK k_flock +#elif defined(AFS_SUN5_ENV) || (defined(AFS_LINUX_ENV) && !defined(AFS_LINUX_64BIT_KERNEL)) +# define AFS_FLOCK flock64 #else -#if defined(AFS_SUN5_ENV) || (defined(AFS_LINUX_ENV) && !defined(AFS_LINUX_64BIT_KERNEL)) -#define AFS_FLOCK flock64 -#else -#define AFS_FLOCK flock -#endif /* AFS_SUN65_ENV */ -#endif /* AFS_HPUX102_ENV */ +# define AFS_FLOCK flock +#endif /* UKERNEL */ /* The following are various levels of afs debugging */ #define AFSDEB_GENERAL 1 /* Standard debugging */