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
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]
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
35 #include <sys/types.h>
36 #include <sys/debug.h>
37 #include <sys/t_lock.h>
38 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/errno.h>
43 #include <sys/cmn_err.h>
44 #include <sys/vnode.h>
45 #include <sys/debug.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 */
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
)
68 if (snapops
.fssnap_create
)
69 snapid
= (snapops
.fssnap_create
)(nchunks
, chunksz
, maxsize
,
70 fsvp
, backfilecount
, bfvpp
, backpath
, max_backfile_size
);
76 fssnap_set_candidate(void *snapshot_id
, chunknumber_t chunknumber
)
78 if (snapops
.fssnap_set_candidate
)
79 (snapops
.fssnap_set_candidate
)(snapshot_id
, chunknumber
);
83 fssnap_is_candidate(void *snapshot_id
, u_offset_t off
)
87 if (snapops
.fssnap_is_candidate
)
88 rc
= (snapops
.fssnap_is_candidate
)(snapshot_id
, off
);
94 fssnap_create_done(void *snapshot_id
)
98 if (snapops
.fssnap_create_done
)
99 snapslot
= (snapops
.fssnap_create_done
)(snapshot_id
);
105 fssnap_delete(void *snapshot_id
)
109 if (snapops
.fssnap_delete
)
110 snapslot
= (snapops
.fssnap_delete
)(snapshot_id
);
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
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
149 return (mod_remove(&modlinkage
));
153 _info(struct modinfo
*modinfop
)
155 return (mod_info(&modlinkage
, modinfop
));