geom_ccd.c (a6b1634eb2fe66b140e841df681393291bcae452) | geom_ccd.c (db901281608f0c69c05dd9ab366155d3225f0fd2) |
---|---|
1/* $FreeBSD$ */ 2 3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ 4 5/* 6 * Copyright (c) 1995 Jason R. Thorpe. 7 * All rights reserved. 8 * --- 73 unchanged lines hidden (view full) --- 82 * Dynamic configuration and disklabel support by: 83 * Jason R. Thorpe <thorpej@nas.nasa.gov> 84 * Numerical Aerodynamic Simulation Facility 85 * Mail Stop 258-6 86 * NASA Ames Research Center 87 * Moffett Field, CA 94035 88 */ 89 | 1/* $FreeBSD$ */ 2 3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ 4 5/* 6 * Copyright (c) 1995 Jason R. Thorpe. 7 * All rights reserved. 8 * --- 73 unchanged lines hidden (view full) --- 82 * Dynamic configuration and disklabel support by: 83 * Jason R. Thorpe <thorpej@nas.nasa.gov> 84 * Numerical Aerodynamic Simulation Facility 85 * Mail Stop 258-6 86 * NASA Ames Research Center 87 * Moffett Field, CA 94035 88 */ 89 |
90#include "opt_devfs.h" | |
91#include "ccd.h" 92 93#include <sys/param.h> 94#include <sys/systm.h> 95#include <sys/kernel.h> 96#include <sys/module.h> 97#include <sys/proc.h> 98#include <sys/bio.h> --- 5 unchanged lines hidden (view full) --- 104#include <sys/disklabel.h> 105#include <ufs/ffs/fs.h> 106#include <sys/devicestat.h> 107#include <sys/fcntl.h> 108#include <sys/vnode.h> 109 110#include <sys/ccdvar.h> 111 | 90#include "ccd.h" 91 92#include <sys/param.h> 93#include <sys/systm.h> 94#include <sys/kernel.h> 95#include <sys/module.h> 96#include <sys/proc.h> 97#include <sys/bio.h> --- 5 unchanged lines hidden (view full) --- 103#include <sys/disklabel.h> 104#include <ufs/ffs/fs.h> 105#include <sys/devicestat.h> 106#include <sys/fcntl.h> 107#include <sys/vnode.h> 108 109#include <sys/ccdvar.h> 110 |
112#ifdef DEVFS 113#include <sys/eventhandler.h> 114#include <fs/devfs/devfs.h> 115#endif 116 | |
117#if defined(CCDDEBUG) && !defined(DEBUG) 118#define DEBUG 119#endif 120 121#ifdef DEBUG 122#define CCDB_FOLLOW 0x01 123#define CCDB_INIT 0x02 124#define CCDB_IO 0x04 --- 159 unchanged lines hidden (view full) --- 284 * Number of blocks to untouched in front of a component partition. 285 * This is to avoid violating its disklabel area when it starts at the 286 * beginning of the slice. 287 */ 288#if !defined(CCD_OFFSET) 289#define CCD_OFFSET 16 290#endif 291 | 111#if defined(CCDDEBUG) && !defined(DEBUG) 112#define DEBUG 113#endif 114 115#ifdef DEBUG 116#define CCDB_FOLLOW 0x01 117#define CCDB_INIT 0x02 118#define CCDB_IO 0x04 --- 159 unchanged lines hidden (view full) --- 278 * Number of blocks to untouched in front of a component partition. 279 * This is to avoid violating its disklabel area when it starts at the 280 * beginning of the slice. 281 */ 282#if !defined(CCD_OFFSET) 283#define CCD_OFFSET 16 284#endif 285 |
292#ifdef DEVFS | |
293static void 294ccd_clone(void *arg, char *name, int namelen, dev_t *dev) 295{ 296 int i, u; 297 char *s; 298 299 if (*dev != NODEV) 300 return; | 286static void 287ccd_clone(void *arg, char *name, int namelen, dev_t *dev) 288{ 289 int i, u; 290 char *s; 291 292 if (*dev != NODEV) 293 return; |
301 i = devfs_stdclone(name, &s, "ccd", &u); | 294 i = dev_stdclone(name, &s, "ccd", &u); |
302 if (i != 2) 303 return; 304 if (u >= numccd) 305 return; 306 if (*s <= 'a' || *s >= 'h') 307 return; 308 if (s[1] != '\0') 309 return; 310 *dev = make_dev(&ccd_cdevsw, u * 8 + *s - 'a', 311 UID_ROOT, GID_OPERATOR, 0640, name); 312} | 295 if (i != 2) 296 return; 297 if (u >= numccd) 298 return; 299 if (*s <= 'a' || *s >= 'h') 300 return; 301 if (s[1] != '\0') 302 return; 303 *dev = make_dev(&ccd_cdevsw, u * 8 + *s - 'a', 304 UID_ROOT, GID_OPERATOR, 0640, name); 305} |
313#endif DEVFS | |
314 315/* 316 * Called by main() during pseudo-device attachment. All we need 317 * to do is allocate enough space for devices to be configured later, and 318 * add devsw entries. 319 */ 320static void 321ccdattach() --- 21 unchanged lines hidden (view full) --- 343 numccd = num; 344 bzero(ccd_softc, num * sizeof(struct ccd_softc)); 345 bzero(ccddevs, num * sizeof(struct ccddevice)); 346 347 cdevsw_add(&ccd_cdevsw); 348 /* XXX: is this necessary? */ 349 for (i = 0; i < numccd; ++i) 350 ccddevs[i].ccd_dk = -1; | 306 307/* 308 * Called by main() during pseudo-device attachment. All we need 309 * to do is allocate enough space for devices to be configured later, and 310 * add devsw entries. 311 */ 312static void 313ccdattach() --- 21 unchanged lines hidden (view full) --- 335 numccd = num; 336 bzero(ccd_softc, num * sizeof(struct ccd_softc)); 337 bzero(ccddevs, num * sizeof(struct ccddevice)); 338 339 cdevsw_add(&ccd_cdevsw); 340 /* XXX: is this necessary? */ 341 for (i = 0; i < numccd; ++i) 342 ccddevs[i].ccd_dk = -1; |
351#ifdef DEVFS 352 EVENTHANDLER_REGISTER(devfs_clone, ccd_clone, 0, 1000); 353#endif | 343 EVENTHANDLER_REGISTER(dev_clone, ccd_clone, 0, 1000); |
354} 355 356static int 357ccd_modevent(mod, type, data) 358 module_t mod; 359 int type; 360 void *data; 361{ --- 1376 unchanged lines hidden --- | 344} 345 346static int 347ccd_modevent(mod, type, data) 348 module_t mod; 349 int type; 350 void *data; 351{ --- 1376 unchanged lines hidden --- |