From e5821239cde138f74f73bec1bd9a3880d08ac3df Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 7 Mar 2012 16:36:57 -0600 Subject: [PATCH] afs: Never #define away afsd_dynamic_vcaches Some versions of the Solaris Studio compiler on SPARC (at least 12.2 and possibly others, but not 12.3) get a little confused by code like this: extern int foo; int somefunc(void) { if (0) return foo; return 0; } When optimization is turned off, this results in an undefined symbol reference to 'foo' (which is normal), but the resulting object file lacks a relocation entry for the symbol 'foo', so the symbol remains undefined after linking. In the OpenAFS tree, this occurs in afs_daemons.c which references afs_vcount and afs_cacheStats in this manner due to afsd_dynamic_vcaches being defined as '0' on Solaris. The end result is that the libafs kernel module is not loadable, since it complains about afs_vcount and afs_cacheStats being undefined, even though the symbol definitions are also in the module. While this is a bug in Solaris Studio and has since been fixed, it is simple to work around this so we are usable with more compilers. If we just always declare afsd_dynamic_vcaches as a regular variable, it works around this issue and keeps the code a tiny bit simpler. So, do that. Change-Id: I3f8fc6aafd52487d729289e393fc59dac84d36ea Reviewed-on: http://gerrit.openafs.org/6888 Tested-by: Michael Meffie Reviewed-by: Michael Meffie Reviewed-by: Derrick Brashear --- src/afs/afs.h | 5 ----- src/afs/afs_init.c | 2 -- 2 files changed, 7 deletions(-) diff --git a/src/afs/afs.h b/src/afs/afs.h index dd45066..95b4351 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -1493,12 +1493,7 @@ struct afs_fakestat_state { }; extern int afs_fakestat_enable; - -#ifdef AFS_MAXVCOUNT_ENV extern int afsd_dynamic_vcaches; -#else -#define afsd_dynamic_vcaches 0 -#endif /* * Wrappers for access to credentials structure members diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index 12f3852..3c33296 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -57,9 +57,7 @@ const struct cred *cache_creds; #endif /* This is the kernel side of the dynamic vcache setting */ -#ifdef AFS_MAXVCOUNT_ENV int afsd_dynamic_vcaches = 0; /* Enable dynamic-vcache support */ -#endif /* * Initialization order is important. Must first call afs_CacheInit, -- 1.9.4