geom_disk.c (115468) | geom_disk.c (115473) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom_disk.c 115468 2003-05-31 16:59:27Z phk $ | 35 * $FreeBSD: head/sys/geom/geom_disk.c 115473 2003-05-31 18:13:07Z phk $ |
36 */ 37 38#include "opt_geom.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/sysctl.h> --- 9 unchanged lines hidden (view full) --- 53#include <sys/mutex.h> 54#include <geom/geom.h> 55#include <geom/geom_disk.h> 56#include <geom/geom_int.h> 57 58static struct mtx g_disk_done_mtx; 59 60static g_access_t g_disk_access; | 36 */ 37 38#include "opt_geom.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/kernel.h> 43#include <sys/sysctl.h> --- 9 unchanged lines hidden (view full) --- 53#include <sys/mutex.h> 54#include <geom/geom.h> 55#include <geom/geom_disk.h> 56#include <geom/geom_int.h> 57 58static struct mtx g_disk_done_mtx; 59 60static g_access_t g_disk_access; |
61static g_init_t g_disk_init; 62static g_fini_t g_disk_fini; |
|
61 62struct g_class g_disk_class = { 63 .name = "DISK", | 63 64struct g_class g_disk_class = { 65 .name = "DISK", |
66 .init = g_disk_init, 67 .fini = g_disk_fini, |
|
64}; 65 66static void | 68}; 69 70static void |
67g_disk_init(void) | 71g_disk_init(struct g_class *mp __unused) |
68{ | 72{ |
69 mtx_unlock(&Giant); 70 g_add_class(&g_disk_class); | 73 |
71 mtx_init(&g_disk_done_mtx, "g_disk_done", MTX_DEF, 0); | 74 mtx_init(&g_disk_done_mtx, "g_disk_done", MTX_DEF, 0); |
72 mtx_lock(&Giant); | |
73} 74 | 75} 76 |
75DECLARE_GEOM_CLASS_INIT(g_disk_class, g_disk, g_disk_init); | 77static void 78g_disk_fini(struct g_class *mp __unused) 79{ |
76 | 80 |
81 mtx_destroy(&g_disk_done_mtx); 82} 83 84DECLARE_GEOM_CLASS(g_disk_class, g_disk); 85 |
|
77static void __inline 78g_disk_lock_giant(struct disk *dp) 79{ 80 if (dp->d_flags & DISKFLAG_NOGIANT) 81 return; 82 mtx_lock(&Giant); 83} 84 --- 325 unchanged lines hidden --- | 86static void __inline 87g_disk_lock_giant(struct disk *dp) 88{ 89 if (dp->d_flags & DISKFLAG_NOGIANT) 90 return; 91 mtx_lock(&Giant); 92} 93 --- 325 unchanged lines hidden --- |