5832 EOF wireless usb (aka UWB)
[unleashed.git] / usr / src / uts / common / io / fssnap_if.c
blob92fc940e7b8df1d95eec5c289e4c3b317129467f
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * This file contains interface definitions and wrappers for file
31 * system snapshot support. File systems may depend on this module
32 * for symbol resolution while the implementation may remain unloaded
33 * until needed.
35 #include <sys/types.h>
36 #include <sys/debug.h>
37 #include <sys/t_lock.h>
38 #include <sys/param.h>
39 #include <sys/mman.h>
40 #include <sys/systm.h>
41 #include <sys/errno.h>
42 #include <sys/kmem.h>
43 #include <sys/cmn_err.h>
44 #include <sys/vnode.h>
45 #include <sys/debug.h>
46 #include <sys/proc.h>
47 #include <sys/user.h>
48 #include <sys/conf.h>
49 #include <sys/modctl.h>
50 #include <sys/fssnap_if.h>
52 struct fssnap_operations snapops = {
53 NULL, /* fssnap_create */
54 NULL, /* fssnap_set_candidate */
55 NULL, /* fssnap_is_candidate */
56 NULL, /* fssnap_create_done */
57 NULL, /* fssnap_delete */
58 NULL /* fssnap_strategy */
61 void *
62 fssnap_create(chunknumber_t nchunks, uint_t chunksz, u_offset_t maxsize,
63 struct vnode *fsvp, int backfilecount, struct vnode **bfvpp, char *backpath,
64 u_offset_t max_backfile_size)
66 void *snapid = NULL;
68 if (snapops.fssnap_create)
69 snapid = (snapops.fssnap_create)(nchunks, chunksz, maxsize,
70 fsvp, backfilecount, bfvpp, backpath, max_backfile_size);
72 return (snapid);
75 void
76 fssnap_set_candidate(void *snapshot_id, chunknumber_t chunknumber)
78 if (snapops.fssnap_set_candidate)
79 (snapops.fssnap_set_candidate)(snapshot_id, chunknumber);
82 int
83 fssnap_is_candidate(void *snapshot_id, u_offset_t off)
85 int rc = 0;
87 if (snapops.fssnap_is_candidate)
88 rc = (snapops.fssnap_is_candidate)(snapshot_id, off);
90 return (rc);
93 int
94 fssnap_create_done(void *snapshot_id)
96 int snapslot = -1;
98 if (snapops.fssnap_create_done)
99 snapslot = (snapops.fssnap_create_done)(snapshot_id);
101 return (snapslot);
105 fssnap_delete(void *snapshot_id)
107 int snapslot = -1;
109 if (snapops.fssnap_delete)
110 snapslot = (snapops.fssnap_delete)(snapshot_id);
112 return (snapslot);
115 void
116 fssnap_strategy(void *snapshot_id, struct buf *bp)
118 if (snapops.fssnap_strategy)
119 (snapops.fssnap_strategy)(snapshot_id, bp);
123 #include <sys/modctl.h>
125 extern struct mod_ops mod_miscops;
127 static struct modlmisc modlmisc = {
128 &mod_miscops, "File System Snapshot Interface",
131 static struct modlinkage modlinkage = {
132 MODREV_1, (void *)&modlmisc, NULL
136 _init(void)
138 return (mod_install(&modlinkage));
142 * Unloading is MT-safe because our client drivers use
143 * the _depends_on[] mechanism - we won't go while they're
144 * still around.
147 _fini(void)
149 return (mod_remove(&modlinkage));
153 _info(struct modinfo *modinfop)
155 return (mod_info(&modlinkage, modinfop));