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 93248 2002-03-26 21:40:06Z 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> --- 7 unchanged lines hidden (view full) --- 51 52 53#include <sys/lock.h> 54#include <sys/mutex.h> 55#include <geom/geom.h> 56 57static g_access_t g_disk_access; 58 |
59struct g_class g_disk_class = { 60 "DISK-class", |
61 NULL, 62 g_disk_access, 63 NULL, 64 NULL, 65 { 0, 0 }, 66 { 0 } 67}; 68 --- 107 unchanged lines hidden (view full) --- 176{ 177 static int once; 178 struct g_geom *gp; 179 struct g_provider *pp; 180 dev_t dev; 181 182 mtx_unlock(&Giant); 183 if (!once) { |
184 g_add_class(&g_disk_class); |
185 once++; 186 } 187 dev = g_malloc(sizeof *dev, M_WAITOK | M_ZERO); 188 dp->d_dev = dev; 189 dev->si_devsw = cdevsw; 190 dev->si_disk = dp; 191 dev->si_udev = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART); 192 g_topology_lock(); |
193 gp = g_new_geomf(&g_disk_class, "%s%d", cdevsw->d_name, unit); |
194 gp->start = g_disk_start; 195 gp->softc = dp; 196 dp->d_softc = gp; 197 pp = g_new_providerf(gp, "%s", gp->name); 198 g_error_provider(pp, 0); 199 g_topology_unlock(); 200 mtx_lock(&Giant); 201 return (dev); --- 45 unchanged lines hidden --- |