[OpenAFS-devel] porting openafs to another linux - problems with vRefcount type.. .

Derek Atkins warlord@MIT.EDU
05 Oct 2001 14:54:43 -0400


Well, i_count is an 'unsigned int' on Linux 2.2, but changed to an
'atomic_t' in 2.4.  An atomic_t is defined as follows for x86:
	typedef struct { volatile int counter; } atomic_t;

Honestly, I don't know why this works at all on 2.4, except for the fact
that alignment works.  But the compiler should be complaining when you
try to increment/decrement a 'structure'.

-derek

"Neulinger, Nathan" <nneul@umr.edu> writes:

> I've got it mostly building, except for anything to do with reference
> counts:
> 
> ../afs/afs_callback.c: In function `SRXAFSCB_GetCE':
> ../afs/afs_callback.c:160: incompatible types in assignment
> make[1]: *** [afs_callback.o] Error 1
> ../afs/afs_daemons.c: In function `afs_BQueue':
> ../afs/afs_daemons.c:535: wrong type argument to increment
> make[1]: *** [afs_daemons.o] Error 1
> ../afs/afs_osidnlc.c: In function `osi_dnlc_lookup':
> ../afs/afs_osidnlc.c:250: wrong type argument to increment
> make[1]: *** [afs_osidnlc.o] Error 1
> ../afs/afs_util.c: In function `afs_CheckLocks':
> ../afs/afs_util.c:185: invalid operands to binary !=
> make[1]: *** [afs_util.o] Error 1
> ../afs/afs_vcache.c: In function `afs_NewVCache':
> ../afs/afs_vcache.c:585: invalid operands to binary !=
> ../afs/afs_vcache.c:723: invalid operands to binary ==
> ../afs/afs_vcache.c:818: incompatible types in assignment
> ../afs/afs_vcache.c: In function `afs_FlushActiveVcaches':
> ../afs/afs_vcache.c:1036: wrong type argument to increment
> ../afs/afs_vcache.c:1075: wrong type argument to increment
> ../afs/afs_vcache.c: In function `afs_GetRootVCache':
> ../afs/afs_vcache.c:1951: wrong type argument to increment
> ../afs/afs_vcache.c: In function `afs_FindVCache':
> ../afs/afs_vcache.c:2381: wrong type argument to increment
> ../afs/afs_vcache.c: In function `afs_NFSFindVCache':
> ../afs/afs_vcache.c:2527: wrong type argument to increment
> make[1]: *** [afs_vcache.o] Error 1
> 
> 
> Those are almost all (or all) references to vnhold or similar, which
> increments the reference count.
> 
> If I change vrefCount to vrefCount.counter they get past the error. (Or
> simpler, if I add .counter to the references to i_count in osi_vfs.h.) I've
> got it ifdef'd currently, but I'm curious as to why this is necessary.
> 
> What is going on special on parisc-linux (or on i386_linux) that allows it
> to work on one, but not on the other? Both look to have the same definition
> for atomic_t.
> 
> -- Nathan
> 
> ------------------------------------------------------------
> Nathan Neulinger                       EMail:  nneul@umr.edu
> University of Missouri - Rolla         Phone: (573) 341-4841
> Computing Services                       Fax: (573) 341-4216
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-devel

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available