[OpenAFS-port-darwin] openafs Mac OS 10.1 port

Brian Biswas bbiswas@email.unc.edu
Fri, 02 Nov 2001 15:49:10 -0500


--On Friday, November 2, 2001 10:56 AM -0500 Shantonu Sen <ssen@MIT.EDU> 
wrote:

>> kmodload: __ubc_getobject
>>
>> I don't see why one gets this error message since it is defined in the
>> kernel.
>
> Note the double "_". This would seem to indicate that it's being referred
> to in the source file as "_ubc_getobject". Indeed on line osi_vm.c:305,
> it is prepended with a "_" and nowhere else.
>
># ifdef UBC_NOREACTIVATE
>             if (ubc_getobject(&avc->v, (UBC_NOREACTIVATE|UBC_HOLDOBJECT)))
>                    panic("VM_Setup: null object");
># else
>             (void)_ubc_getobject(&avc->v, 1); /* return value not used */
># endif
>
> Was UBC_NOREACTIVATE #define'd in 10.0?
>
> Shantonu

Yep, you're right. Looks like a typo in the source code.
I removed the underscore, rebuilt, and re-installed libafs.nonfs.o. Then 
ran the
afs rc script. openafs starts right up. I've been running for a couple
hours now with no problems. openafs on Mac OS 10.1 This is super!

Without documentation from Apple as to any header file changes they may 
have made,
I can't be certain the changes (referencing structure members) I made are 
correct, but so
far so good.

For the record, this is what I ended up doing to build and install:

I configured as follows:

./configure  --enable-transarc-paths

I needed to make a couple of code changes to get openafs to compile
for Mac OS 10.1:

1.) In directory sys/afs/DARWIN, I changed source files "osi_vm.c" and 
"osi_vnodeops.c":

Changed a structure member named "ui_holdcnt" to "ui_refcount"
There is no structure member named "ui_holdcnt". This is in the ubc_info
structure which is defined in /usr/include/sys/ubc.h.

2.) In source file "osi_vm.c", I changed two function calls of the type:

                        ubc_getobject(vp);

to

                        ubc_getobject(vp, UBC_FLAGS_NONE);

3.) There is a typo on line 305 of the file osi_vm.c:

    (void)_ubc_getobject(&avc->v, 1); /* return value not used */

should be:

    (void)ubc_getobject(&avc->v, 1); /* return value not used */

(remove the underscore in front of ubc_getobject.)

Then build and install:
%make
%make install

When booting, the rc script /System/Library/StartupItems/OpenAFS/OpenAFS
runs which starts the afs daemon (the daemon itself lives in
/usr/sbin).

I installed the kernel module that gets loaded 
(src/libafs/MODLOAD/libafs.nonfs.o) as:
/var/db/openafs/etc/afs.kext/Contents/MacOS/afs