Add DragonFly instructions file to new version directory
[dragonfly.git] / sys / vfs / coda / coda_fbsd.c
1 /*
2  * 
3  *             Coda: an Experimental Distributed File System
4  *                              Release 3.1
5  * 
6  *           Copyright (c) 1987-1998 Carnegie Mellon University
7  *                          All Rights Reserved
8  * 
9  * Permission  to  use, copy, modify and distribute this software and its
10  * documentation is hereby granted,  provided  that  both  the  copyright
11  * notice  and  this  permission  notice  appear  in  all  copies  of the
12  * software, derivative works or  modified  versions,  and  any  portions
13  * thereof, and that both notices appear in supporting documentation, and
14  * that credit is given to Carnegie Mellon University  in  all  documents
15  * and publicity pertaining to direct or indirect use of this code or its
16  * derivatives.
17  * 
18  * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
19  * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
20  * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
21  * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
22  * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
23  * ANY DERIVATIVE WORK.
24  * 
25  * Carnegie  Mellon  encourages  users  of  this  software  to return any
26  * improvements or extensions that  they  make,  and  to  grant  Carnegie
27  * Mellon the rights to redistribute these changes without encumbrance.
28  * 
29  *      @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
30  * $FreeBSD: src/sys/coda/coda_fbsd.c,v 1.18 1999/09/25 18:23:43 phk Exp $
31  * $DragonFly: src/sys/vfs/coda/Attic/coda_fbsd.c,v 1.13 2006/07/28 02:17:41 dillon Exp $
32  * 
33  */
34
35 #include "use_vcoda.h"
36
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/kernel.h>
40 #include <sys/conf.h>
41 #include <sys/device.h>
42 #include <sys/proc.h>
43 #include <sys/malloc.h>
44 #include <sys/fcntl.h>
45 #include <sys/ucred.h>
46 #include <sys/vnode.h>
47
48 #include <vm/vm.h>
49 #include <vm/vnode_pager.h>
50
51 #include "coda.h"
52 #include "cnode.h"
53 #include "coda_vnops.h"
54 #include "coda_psdev.h"
55
56 /* 
57    From: "Jordan K. Hubbard" <jkh@time.cdrom.com>
58    Subject: Re: New 3.0 SNAPshot CDROM about ready for production.. 
59    To: "Robert.V.Baron" <rvb@GLUCK.CODA.CS.CMU.EDU>
60    Date: Fri, 20 Feb 1998 15:57:01 -0800
61
62    > Also I need a character device major number. (and might want to reserve
63    > a block of 10 syscalls.)
64
65    Just one char device number?  No block devices?  Very well, cdev 93 is yours!
66 */
67
68 #define VC_DEV_NO      93
69
70 static struct dev_ops coda_dev_ops = {
71         { "Coda", VC_DEV_NO, 0 },
72         .d_open =       vc_nb_open,
73         .d_close =      vc_nb_close,
74         .d_read =       vc_nb_read,
75         .d_write =      vc_nb_write,
76         .d_ioctl =      vc_nb_ioctl,
77         .d_poll =       vc_nb_poll,
78 };
79
80 int     vcdebug = 1;
81 #define VCDEBUG if (vcdebug) printf
82
83 static int
84 codadev_modevent(module_t mod, int type, void *data)
85 {
86         switch (type) {
87         case MOD_LOAD:
88                 dev_ops_add(&coda_dev_ops, 0, 0);
89                 break;
90         case MOD_UNLOAD:
91                 dev_ops_remove(&coda_dev_ops, 0, 0);
92                 break;
93         default:
94                 break;
95         }
96         return 0;
97 }
98 static moduledata_t codadev_mod = {
99         "codadev",
100         codadev_modevent,
101         NULL
102 };
103 DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+VC_DEV_NO);
104
105 int
106 coda_fbsd_getpages(struct vop_getpages_args *ap)
107 {
108     int ret = 0;
109
110     /* ??? a_offset */
111     ret = vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count,
112                                        ap->a_reqpage);
113     return ret;
114 }
115
116 int
117 coda_fbsd_putpages(struct vop_putpages_args *ap)
118 {
119         /*??? a_offset */
120         return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
121                 ap->a_sync, ap->a_rtvals);
122 }
123