libafs: Flush vcaches in afs_shutdown
[openafs.git] / src / afs / SOLARIS / osi_vfsops.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  * osi_vfsops.c for SOLARIS
12  */
13 #include <afsconfig.h>
14 #include "afs/param.h"
15
16
17 #include "afs/sysincludes.h"    /* Standard vendor system headers */
18 #include "afsincludes.h"        /* Afs-based standard headers */
19 #include "afs/afs_stats.h"      /* statistics stuff */
20 #include "h/modctl.h"
21 #include "h/syscall.h"
22 #if defined(AFS_SUN511_ENV)
23 #include <sys/vfs_opreg.h>
24 #endif
25 #include <sys/kobj.h>
26
27 #ifdef AFS_SUN58_ENV
28 # include <sys/mount.h>
29 #endif
30
31 struct vfs *afs_globalVFS = 0;
32 struct vcache *afs_globalVp = 0;
33
34 #if defined(AFS_SUN57_64BIT_ENV)
35 extern struct sysent sysent32[];
36 #endif
37
38 int afsfstype = 0;
39
40 int
41 afs_mount(struct vfs *afsp, struct vnode *amvp, struct mounta *uap,
42           afs_ucred_t *credp)
43 {
44
45     AFS_GLOCK();
46
47     AFS_STATCNT(afs_mount);
48
49 #if defined(AFS_SUN510_ENV)
50     if (secpolicy_fs_mount(credp, amvp, afsp) != 0) {
51 #else
52     if (!afs_osi_suser(credp)) {
53 #endif
54         AFS_GUNLOCK();
55         return (EPERM);
56     }
57     afsp->vfs_fstype = afsfstype;
58
59     if (afs_globalVFS) {        /* Don't allow remounts. */
60         AFS_GUNLOCK();
61         return (EBUSY);
62     }
63
64     afs_globalVFS = afsp;
65     afsp->vfs_bsize = 8192;
66     afsp->vfs_fsid.val[0] = AFS_VFSMAGIC;       /* magic */
67     afsp->vfs_fsid.val[1] = AFS_VFSFSID;
68     afsp->vfs_dev = AFS_VFSMAGIC;
69
70     AFS_GUNLOCK();
71     return 0;
72 }
73
74 static void
75 afs_freevfs(void)
76 {
77     int i;
78     struct vcache *vc, *nvc;
79     extern struct vcache *afs_vhashT[VCSIZE];
80
81     afs_globalVFS = 0;
82
83     afs_shutdown();
84 }
85
86 #if defined(AFS_SUN58_ENV)
87 int
88 afs_unmount(struct vfs *afsp, int flag, afs_ucred_t *credp)
89 #else
90 int
91 afs_unmount(struct vfs *afsp, afs_ucred_t *credp)
92 #endif
93 {
94     struct vcache *rootvp = NULL;
95
96     AFS_GLOCK();
97     AFS_STATCNT(afs_unmount);
98
99 #if defined(AFS_SUN510_ENV)
100     if (secpolicy_fs_unmount(credp, afsp) != 0) {
101 #else
102     if (!afs_osi_suser(credp)) {
103 #endif
104         AFS_GUNLOCK();
105         return (EPERM);
106     }
107
108 #ifdef AFS_SUN58_ENV
109     if (flag & MS_FORCE) {
110         AFS_GUNLOCK();
111         return ENOTSUP;
112     }
113
114     /* We should have one reference from the caller, and one reference for the
115      * root vnode; any more and someone is still referencing something */
116     if (afsp->vfs_count > 2) {
117         AFS_GUNLOCK();
118         return EBUSY;
119     }
120
121     /* The root vnode should have one ref for the mount; any more, and someone
122      * else is using the root vnode */
123     if (afs_globalVp && VREFCOUNT_GT(afs_globalVp, 1)) {
124         AFS_GUNLOCK();
125         return EBUSY;
126     }
127
128     afsp->vfs_flag |= VFS_UNMOUNTED;
129 #endif /* AFS_SUN58_ENV */
130
131     /* release the root vnode, which should be the last reference to us
132      * besides the caller of afs_unmount */
133     rootvp = afs_globalVp;
134     afs_globalVp = NULL;
135     AFS_RELE(rootvp);
136
137 #ifndef AFS_SUN58_ENV
138     /* shutdown now, since gafs_freevfs() will not be called */
139     afs_freevfs();
140 #endif /* !AFS_SUN58_ENV */
141
142     AFS_GUNLOCK();
143     return 0;
144 }
145
146 #ifdef AFS_SUN58_ENV
147 void
148 gafs_freevfs(struct vfs *afsp)
149 {
150     AFS_GLOCK();
151
152     afs_freevfs();
153
154     AFS_GUNLOCK();
155 }
156 #endif /* AFS_SUN58_ENV */
157
158 int
159 afs_root(struct vfs *afsp, struct vnode **avpp)
160 {
161     afs_int32 code = 0;
162     struct vrequest treq;
163     struct vcache *tvp = 0;
164     struct vcache *gvp;
165     struct proc *proc = ttoproc(curthread);
166     struct vnode *vp = afsp->vfs_vnodecovered;
167     int locked = 0;
168
169     /* Potential deadlock:
170      * afs_root is called with the Vnode's v_lock locked. Set VVFSLOCK
171      * and drop the v_lock if we need to make an RPC to complete this
172      * request. There used to be a deadlock on the global lock until
173      * we stopped calling iget while holding the global lock.
174      */
175
176     AFS_GLOCK();
177
178     AFS_STATCNT(afs_root);
179
180 again:
181     if (afs_globalVp && (afs_globalVp->f.states & CStatd)) {
182         tvp = afs_globalVp;
183     } else {
184         if (MUTEX_HELD(&vp->v_lock)) {
185             vp->v_flag |= VVFSLOCK;
186             locked = 1;
187             mutex_exit(&vp->v_lock);
188         }
189
190         if (afs_globalVp) {
191             gvp = afs_globalVp;
192             afs_globalVp = NULL;
193             afs_PutVCache(gvp);
194         }
195
196         if (!(code = afs_InitReq(&treq, proc->p_cred))
197             && !(code = afs_CheckInit())) {
198             tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
199             /* we really want this to stay around */
200             if (tvp) {
201                 if (afs_globalVp) {
202                     /* someone else got there before us! */
203                     afs_PutVCache(tvp);
204                     tvp = 0;
205                     goto again;
206                 }
207                 afs_globalVp = tvp;
208             } else
209                 code = ENOENT;
210         }
211     }
212     if (tvp) {
213         AFS_FAST_HOLD(tvp);
214         mutex_enter(&AFSTOV(tvp)->v_lock);
215         AFSTOV(tvp)->v_flag |= VROOT;
216         mutex_exit(&AFSTOV(tvp)->v_lock);
217
218         afs_globalVFS = afsp;
219         *avpp = AFSTOV(tvp);
220     }
221
222     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
223                ICL_TYPE_INT32, code);
224
225     AFS_GUNLOCK();
226     if (locked) {
227         mutex_enter(&vp->v_lock);
228         vp->v_flag &= ~VVFSLOCK;
229         if (vp->v_flag & VVFSWAIT) {
230             vp->v_flag &= ~VVFSWAIT;
231             cv_broadcast(&vp->v_cv);
232         }
233     }
234
235     return code;
236 }
237
238 #ifdef AFS_SUN56_ENV
239 int
240 afs_statvfs(struct vfs *afsp, struct statvfs64 *abp)
241 #else
242 int
243 afs_statvfs(struct vfs *afsp, struct statvfs *abp)
244 #endif
245 {
246     AFS_GLOCK();
247
248     AFS_STATCNT(afs_statfs);
249
250     abp->f_frsize = 1024;
251     abp->f_favail = 9000000;
252     abp->f_bsize = afsp->vfs_bsize;
253     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
254         abp->f_ffree = 9000000;
255     abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID;
256
257     AFS_GUNLOCK();
258     return 0;
259 }
260
261 int
262 afs_sync(struct vfs *afsp, short flags, afs_ucred_t *credp)
263 {
264     return 0;
265 }
266
267 int
268 afs_vget(struct vfs *afsp, struct vnode **avcp, struct fid *fidp)
269 {
270     cred_t *credp = CRED();
271     struct vrequest treq;
272     int code;
273
274     AFS_GLOCK();
275
276     AFS_STATCNT(afs_vget);
277
278     *avcp = NULL;
279     if (!(code = afs_InitReq(&treq, credp))) {
280         code = afs_osi_vget((struct vcache **)avcp, fidp, &treq);
281     }
282
283     afs_Trace3(afs_iclSetp, CM_TRACE_VGET, ICL_TYPE_POINTER, *avcp,
284                ICL_TYPE_INT32, treq.uid, ICL_TYPE_FID, fidp);
285     code = afs_CheckCode(code, &treq, 42);
286
287     AFS_GUNLOCK();
288     return code;
289 }
290
291 /* This is only called by vfs_mount when afs is going to be mounted as root.
292  * Since we don't support diskless clients we shouldn't come here.
293  */
294 int afsmountroot = 0;
295 afs_mountroot(struct vfs *afsp, whymountroot_t why)
296 {
297     AFS_GLOCK();
298     AFS_STATCNT(afs_mountroot);
299     afsmountroot++;
300     AFS_GUNLOCK();
301     return EINVAL;
302 }
303
304 /* afs_swapvp is called to setup swapping over the net for diskless clients.
305  * Again not for us.
306  */
307 int afsswapvp = 0;
308 afs_swapvp(struct vfs *afsp, struct vnode **avpp, char *nm)
309 {
310     AFS_GLOCK();
311     AFS_STATCNT(afs_swapvp);
312     afsswapvp++;
313     AFS_GUNLOCK();
314     return EINVAL;
315 }
316
317
318 #if defined(AFS_SUN511_ENV)
319 /* The following list must always be NULL-terminated */
320 static const fs_operation_def_t afs_vfsops_template[] = {
321     VFSNAME_MOUNT,              { .vfs_mount = afs_mount },
322     VFSNAME_UNMOUNT,            { .vfs_unmount = afs_unmount },
323     VFSNAME_ROOT,               { .vfs_root = afs_root },
324     VFSNAME_STATVFS,            { .vfs_statvfs = afs_statvfs },
325     VFSNAME_SYNC,               { .vfs_sync = afs_sync },
326     VFSNAME_VGET,               { .vfs_vget = afs_vget },
327     VFSNAME_MOUNTROOT,          { .vfs_mountroot = afs_mountroot },
328     VFSNAME_FREEVFS,            { .vfs_freevfs = gafs_freevfs },
329     NULL,                       NULL
330 };
331 struct vfsops *afs_vfsopsp;
332 #elif defined(AFS_SUN510_ENV)
333 /* The following list must always be NULL-terminated */
334 const fs_operation_def_t afs_vfsops_template[] = {
335     VFSNAME_MOUNT,              afs_mount,
336     VFSNAME_UNMOUNT,            afs_unmount,
337     VFSNAME_ROOT,               afs_root,
338     VFSNAME_STATVFS,            afs_statvfs,
339     VFSNAME_SYNC,               afs_sync,
340     VFSNAME_VGET,               afs_vget,
341     VFSNAME_MOUNTROOT,          afs_mountroot,
342     VFSNAME_FREEVFS,            gafs_freevfs,
343     NULL,                       NULL
344 };
345 struct vfsops *afs_vfsopsp;
346 #else
347 struct vfsops Afs_vfsops = {
348     afs_mount,
349     afs_unmount,
350     afs_root,
351     afs_statvfs,
352     afs_sync,
353     afs_vget,
354     afs_mountroot,
355     afs_swapvp,
356 #if defined(AFS_SUN58_ENV)
357     gafs_freevfs,
358 #endif
359 };
360 #endif
361
362
363 /*
364  * afsinit - intialize VFS
365  */
366 int (*ufs_iallocp) ();
367 void (*ufs_iupdatp) ();
368 int (*ufs_igetp) ();
369 void (*ufs_itimes_nolockp) ();
370
371 int (*afs_orig_ioctl) (), (*afs_orig_ioctl32) ();
372 int (*afs_orig_setgroups) (), (*afs_orig_setgroups32) ();
373
374 #ifndef AFS_SUN510_ENV
375 struct ill_s *ill_g_headp = 0;
376 #endif
377
378 int afs_sinited = 0;
379
380 extern struct fs_operation_def afs_vnodeops_template[];
381
382 #if     !defined(AFS_NONFSTRANS)
383 int (*nfs_rfsdisptab_v2) ();
384 int (*nfs_rfsdisptab_v3) ();
385 int (*nfs_acldisptab_v2) ();
386 int (*nfs_acldisptab_v3) ();
387
388 int (*nfs_checkauth) ();
389 #endif
390
391 extern Afs_syscall();
392
393 static void *
394 do_mod_lookup(const char * mod, const char * sym)
395 {
396     void * ptr;
397
398     ptr = modlookup(mod, sym);
399     if (ptr == NULL) {
400         afs_warn("modlookup failed for symbol '%s' in module '%s'\n",
401                  sym, mod);
402     }
403
404     return ptr;
405 }
406
407 #ifdef AFS_SUN510_ENV
408 afsinit(int fstype, char *dummy)
409 #else
410 afsinit(struct vfssw *vfsswp, int fstype)
411 #endif
412 {
413     extern int afs_xioctl();
414     extern int afs_xsetgroups();
415
416     AFS_STATCNT(afsinit);
417
418     afs_orig_setgroups = sysent[SYS_setgroups].sy_callc;
419     afs_orig_ioctl = sysent[SYS_ioctl].sy_call;
420     sysent[SYS_setgroups].sy_callc = afs_xsetgroups;
421     sysent[SYS_ioctl].sy_call = afs_xioctl;
422
423 #if defined(AFS_SUN57_64BIT_ENV)
424     afs_orig_setgroups32 = sysent32[SYS_setgroups].sy_callc;
425     afs_orig_ioctl32 = sysent32[SYS_ioctl].sy_call;
426     sysent32[SYS_setgroups].sy_callc = afs_xsetgroups;
427     sysent32[SYS_ioctl].sy_call = afs_xioctl;
428 #endif /* AFS_SUN57_64BIT_ENV */
429
430 #ifdef AFS_SUN510_ENV
431     vfs_setfsops(fstype, afs_vfsops_template, &afs_vfsopsp);
432     afsfstype = fstype;
433     vn_make_ops("afs", afs_vnodeops_template, &afs_ops);
434 #else /* !AFS_SUN510_ENV */
435     vfsswp->vsw_vfsops = &Afs_vfsops;
436     afsfstype = fstype;
437 #endif /* !AFS_SUN510_ENV */
438
439
440 #if !defined(AFS_NONFSTRANS)
441     nfs_rfsdisptab_v2 = (int (*)()) do_mod_lookup("nfssrv", "rfsdisptab_v2");
442     if (nfs_rfsdisptab_v2 != NULL) {
443         nfs_acldisptab_v2 = (int (*)()) do_mod_lookup("nfssrv", "acldisptab_v2");
444         if (nfs_acldisptab_v2 != NULL) {
445             afs_xlatorinit_v2(nfs_rfsdisptab_v2, nfs_acldisptab_v2);
446         }
447     }
448     nfs_rfsdisptab_v3 = (int (*)()) do_mod_lookup("nfssrv", "rfsdisptab_v3");
449     if (nfs_rfsdisptab_v3 != NULL) {
450         nfs_acldisptab_v3 = (int (*)()) do_mod_lookup("nfssrv", "acldisptab_v3");
451         if (nfs_acldisptab_v3 != NULL) {
452             afs_xlatorinit_v3(nfs_rfsdisptab_v3, nfs_acldisptab_v3);
453         }
454     }
455
456     nfs_checkauth = (int (*)()) do_mod_lookup("nfssrv", "checkauth");
457 #endif /* !AFS_NONFSTRANS */
458
459     ufs_iallocp = (int (*)()) do_mod_lookup("ufs", "ufs_ialloc");
460     ufs_iupdatp = (void (*)()) do_mod_lookup("ufs", "ufs_iupdat");
461     ufs_igetp = (int (*)()) do_mod_lookup("ufs", "ufs_iget");
462     ufs_itimes_nolockp = (void (*)()) do_mod_lookup("ufs", "ufs_itimes_nolock");
463
464     if (!ufs_iallocp || !ufs_iupdatp || !ufs_itimes_nolockp || !ufs_igetp) {
465         afs_warn("AFS to UFS mapping cannot be fully initialised\n");
466     }
467
468 #if !defined(AFS_SUN510_ENV)
469     ill_g_headp = (struct ill_s *) do_mod_lookup("ip", "ill_g_head");
470 #endif /* !AFS_SUN510_ENV */
471
472     afs_sinited = 1;
473     return 0;
474
475 }
476
477 #ifdef AFS_SUN510_ENV
478 #ifdef AFS_SUN511_ENV
479 static vfsdef_t afs_vfsdef = {
480     VFSDEF_VERSION,
481     "afs",
482     afsinit,
483     0,
484     NULL
485 };
486 #else
487 static struct vfsdef_v3 afs_vfsdef = {
488     VFSDEF_VERSION,
489     "afs",
490     afsinit,
491     0
492 };
493 #endif
494 #else
495 static struct vfssw afs_vfw = {
496     "afs",
497     afsinit,
498     &Afs_vfsops,
499     0
500 };
501 #endif
502
503 #ifndef AFS_SUN511_ENV
504 static struct sysent afssysent = {
505     6,
506     0,
507     Afs_syscall
508 };
509 #endif /* AFS_SUN511_ENV */
510
511 /* inter-module dependencies */
512 char _depends_on[] = "drv/ip drv/udp strmod/rpcmod";
513
514 /*
515  * Info/Structs to link the afs module into the kernel
516  */
517 extern struct mod_ops mod_fsops;
518
519 static struct modlfs afsmodlfs = {
520     &mod_fsops,
521     "afs filesystem",
522 #ifdef AFS_SUN510_ENV
523     &afs_vfsdef
524 #else
525     &afs_vfw
526 #endif
527 };
528
529 #ifdef AFS_SUN511_ENV
530
531 extern struct modldrv afs_modldrv;
532
533 #else /* AFS_SUN511_ENV */
534
535 extern struct mod_ops mod_syscallops;
536 static struct modlsys afsmodlsys = {
537     &mod_syscallops,
538     "afs syscall interface",
539     &afssysent
540 };
541
542 /** The two structures afssysent32 and afsmodlsys32 are being added
543   * for supporting 32 bit syscalls. In Solaris 7 there are two system
544   * tables viz. sysent ans sysent32. 32 bit applications use sysent32.
545   * Since most of our user space binaries are going to be 32 bit
546   * we need to attach to sysent32 also. Note that the entry into AFS
547   * land still happens through Afs_syscall irrespective of whether we
548   * land here from sysent or sysent32
549   */
550
551 # if defined(AFS_SUN57_64BIT_ENV)
552 extern struct mod_ops mod_syscallops32;
553
554 static struct modlsys afsmodlsys32 = {
555     &mod_syscallops32,
556     "afs syscall interface(32 bit)",
557     &afssysent
558 };
559 # endif
560 #endif /* !AFS_SUN511_ENV */
561
562
563 static struct modlinkage afs_modlinkage = {
564     MODREV_1,
565     (void *)&afsmodlfs,
566 #ifdef AFS_SUN511_ENV
567     (void *)&afs_modldrv,
568 #else
569     (void *)&afsmodlsys,
570 # ifdef AFS_SUN57_64BIT_ENV
571     (void *)&afsmodlsys32,
572 # endif
573 #endif /* !AFS_SUN511_ENV */
574     NULL
575 };
576
577 /** This is the function that modload calls when loading the afs kernel
578   * extensions. The solaris modload program searches for the _init
579   * function in a module and calls it when modloading
580   */
581
582 _init()
583 {
584     char *sysn, *mod_getsysname();
585     int code;
586     extern char *sysbind;
587     extern struct bind *sb_hashtab[];
588     struct modctl *mp = 0;
589
590     if (afs_sinited)
591         return EBUSY;
592
593     if ((!(mp = mod_find_by_filename("fs", "ufs"))
594          && !(mp = mod_find_by_filename(NULL, "/kernel/fs/ufs"))
595          && !(mp = mod_find_by_filename(NULL, "sys/ufs"))) || (mp
596                                                                && !mp->
597                                                                mod_installed))
598     {
599         printf
600             ("ufs module must be loaded before loading afs; use modload /kernel/fs/ufs\n");
601         return (ENOSYS);
602     }
603 #ifndef AFS_NONFSTRANS
604 #if     defined(AFS_SUN55_ENV)
605     if ((!(mp = mod_find_by_filename("misc", "nfssrv"))
606          && !(mp = mod_find_by_filename(NULL, NFSSRV))
607          && !(mp = mod_find_by_filename(NULL, NFSSRV_V9))
608          && !(mp = mod_find_by_filename(NULL, NFSSRV_AMD64))) || (mp
609                                                                && !mp->
610                                                                mod_installed))
611     {
612         printf
613             ("misc/nfssrv module must be loaded before loading afs with nfs-xlator\n");
614         return (ENOSYS);
615     }
616 #else /* !AFS_SUN55_ENV */
617 #if     defined(AFS_SUN52_ENV)
618     if ((!(mp = mod_find_by_filename("fs", "nfs"))
619          && !(mp = mod_find_by_filename(NULL, "/kernel/fs/nfs"))
620          && !(mp = mod_find_by_filename(NULL, "sys/nfs"))) || (mp
621                                                                && !mp->
622                                                                mod_installed))
623     {
624         printf
625             ("fs/nfs module must be loaded before loading afs with nfs-xlator\n");
626         return (ENOSYS);
627     }
628 #endif /* AFS_SUN52_ENV */
629 #endif /* AFS_SUN55_ENV */
630 #endif /* !AFS_NONFSTRANS */
631
632 #ifndef AFS_SUN511_ENV
633     /* syscall initialization stff */
634
635 # if !defined(AFS_SUN58_ENV)
636     /* 
637      * Re-read the /etc/name_to_sysnum file to make sure afs isn't added after
638      * reboot.  Ideally we would like to call modctl_read_sysbinding_file() but
639      * unfortunately in Solaris 2.2 it became a local function so we have to do
640      * the read_binding_file() direct call with the appropriate text file and
641      * system call hashtable.  make_syscallname actually copies "afs" to the
642      * proper slot entry and we also actually have to properly initialize the
643      * global sysent[AFS_SYSCALL] entry!
644      */
645 #  ifdef        AFS_SUN53_ENV
646 #   ifndef      SYSBINDFILE
647 #    define     SYSBINDFILE     "/etc/name_to_sysnum"
648 #   endif /* SYSBINDFILE */
649     read_binding_file(SYSBINDFILE, sb_hashtab);
650 #  else /* !AFS_SUN53_ENV */
651     read_binding_file(sysbind, sb_hashtab);
652 #  endif /* AFS_SUN53_ENV */
653     make_syscallname("afs", AFS_SYSCALL);
654
655     if (sysent[AFS_SYSCALL].sy_call == nosys) {
656         if ((sysn = mod_getsysname(AFS_SYSCALL)) != NULL) {
657             sysent[AFS_SYSCALL].sy_lock =
658                 (krwlock_t *) kobj_zalloc(sizeof(krwlock_t), KM_SLEEP);
659             rw_init(sysent[AFS_SYSCALL].sy_lock, "afs_syscall",
660 #  ifdef AFS_SUN57_ENV
661                     RW_DEFAULT, NULL);
662 #  else /* !AFS_SUN57_ENV */
663                     RW_DEFAULT, DEFAULT_WT);
664 #  endif /* AFS_SUN57_ENV */
665         }
666     }
667 # endif /* !AFS_SUN58_ENV */
668 #endif /* !AFS_SUN511_ENV */
669
670     osi_Init();                 /* initialize global lock, etc */
671
672     code = mod_install(&afs_modlinkage);
673     return code;
674 }
675
676 _info(modp)
677      struct modinfo *modp;
678 {
679     int code;
680
681     code = mod_info(&afs_modlinkage, modp);
682     return code;
683 }
684
685 _fini()
686 {
687     int code;
688
689     if (afs_globalVFS)
690         return EBUSY;
691
692     if (afs_sinited) {
693         sysent[SYS_setgroups].sy_callc = afs_orig_setgroups;
694         sysent[SYS_ioctl].sy_call = afs_orig_ioctl;
695 #if defined(AFS_SUN57_64BIT_ENV)
696         sysent32[SYS_setgroups].sy_callc = afs_orig_setgroups32;
697         sysent32[SYS_ioctl].sy_call = afs_orig_ioctl32;
698 #endif
699     }
700     code = mod_remove(&afs_modlinkage);
701     return code;
702 }