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

Neulinger, Nathan nneul@umr.edu
Wed, 13 Mar 2002 10:38:00 -0600


You'd then have to cast it all over the place where it was used, or copy
it to temp vars/etc.

For example, on all platforms with UKERNEL, it is #define'd to 'usr_buf'
instead of 'buf', and usr_buf is defined by ukernel/sysincludes.h.=20

On some platforms, elements are used, and structure is defined (FBSD for
example).

On other platforms, elements of structure are not used, and structure is
not defined. This really should be an error condition, but compiler
without prototype enforcement is ignoring it cause it is possible for it
to compile, even though it doesn't know the size/contents of the
structure.

Seems to me that the best approach would be to have an AFS typedef for
buffers.

#if NON_BUFFERS_ARCH
typedef void *afs_buffer_type;
#else if UKERNEL
typedef struct usr_buf { .... } *afs_buffer_type;
#else
typedef struct buf *afs_buffer_type;
#endif

-- Nathan

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


> -----Original Message-----
> From: Derek Atkins [mailto:warlord@MIT.EDU]=20
> Sent: Wednesday, March 13, 2002 10:03 AM
> To: Neulinger, Nathan
> Cc: Craig_Everhart@transarc.com; openafs-devel@openafs.org
> Subject: Re: [OpenAFS-devel] "struct buf" in src/afs (libafs/libuafs)
>=20
>=20
> Why not M-x replace-string "struct buf *" "void *"?
>=20
> -derek
>=20
> "Neulinger, Nathan" <nneul@umr.edu> writes:
>=20
> > Perhaps it's only present on some architectures, and not on others.
> > Seems to me that something similar to the dummy define I=20
> did would be
> > needed, but possibly in a big ifdef to check and see if=20
> it's defined or
> > not.
> >=20
> > I just checked, looks like it is defined on FBSD but not on Linux.
> > Haven't looked at solaris or hpux yet. So, probably something that
> > defines it in certain cases, and not in others would be worthwhile.=20
> >=20
> > Anyone interested in throwing together an autoconf check=20
> for struct buf
> > being known?
> >=20
> > -- Nathan
> >=20
> > ------------------------------------------------------------
> > Nathan Neulinger                       EMail:  nneul@umr.edu
> > University of Missouri - Rolla         Phone: (573) 341-4841
> > Computing Services                       Fax: (573) 341-4216
> >=20
> >=20
> > > -----Original Message-----
> > > From: Craig_Everhart@transarc.com=20
> > > [mailto:Craig_Everhart@transarc.com]=20
> > > Sent: Wednesday, March 13, 2002 9:31 AM
> > > To: Neulinger, Nathan
> > > Subject: Re: [OpenAFS-devel] "struct buf" in src/afs=20
> (libafs/libuafs)
> > >=20
> > >=20
> > > Hm.  There really is a "struct buf" in the kernel, defined in=20
> > > some file
> > > like /usr/include/sys/buf.h (on some kernels).  It's=20
> probably pretty
> > > important for the cache manager to run on the client=20
> side, to use the
> > > kernel version as opposed to a dummy version.
> > >=20
> > > 		Craig
> > >=20
> > _______________________________________________
> > OpenAFS-devel mailing list
> > OpenAFS-devel@openafs.org
> > https://lists.openafs.org/mailman/listinfo/openafs-devel
>=20
> --=20
>        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
>=20