[OpenAFS-devel] "struct buf" in src/afs (libafs/libuafs)

Nathan Neulinger nneul@umr.edu
Tue, 12 Mar 2002 18:25:45 -0600


Nathan Neulinger wrote:
> 
> Where is this defined? Digging around, the only thing I've been able to
> find is that when using UKERNEL/, "buf" gets changed to "usr_buf", and
> there is a definition of struct usr_buf in UKERNEL/sysincludes.h.
> 
> Reason I ask is that it's playing hell with prototype work.
> 
> Am I missing something here?

Figured it out - this is really sick but it looks like all of the
references to "struct buf" are being passed around as pointers in
non-libuafs code, so even though it is a structure that is totally
undefined all over the place, the code still compiled, but it isn't
suitable for prototyping.

It only appears to actually using the elements of the structure or
dereferencing it in UKERNEL code. 

Adding something like this in afs.h took care of the issue:

#if !defined(UKERNEL)
struct buf {
        int bogus; 
};
#endif


Frankly, that's just plain sick, but it appears to work ok, and I
suppose it's cleaner than having two versions of every function
prototype. 

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216