UKERNEL: Remove flock -> usr_flock redirection 13/14913/6
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Wed, 23 Mar 2022 19:04:46 +0000 (16:04 -0300)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 13 May 2022 05:14:25 +0000 (01:14 -0400)
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 <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/afs/UKERNEL/afs_usrops.c
src/afs/UKERNEL/sysincludes.h
src/afs/afs.h

index 8fbc109..501a5c7 100644 (file)
@@ -182,17 +182,6 @@ afs_suser(afs_ucred_t *credp)
  */
 
 /*
- * 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
  */
index 76409b1..dcf6886 100644 (file)
@@ -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 **);
 };
index ae18a3b..6735c84 100644 (file)
@@ -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 */