kern_conf.c (3f54a085a603b050163611ce23972ee8de7636f1) | kern_conf.c (db901281608f0c69c05dd9ab366155d3225f0fd2) |
---|---|
1/*- 2 * Parts Copyright (c) 1995 Terrence R. Lambert 3 * Copyright (c) 1995 Julian R. Elischer 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 28 unchanged lines hidden (view full) --- 37#include <sys/kernel.h> 38#include <sys/sysctl.h> 39#include <sys/systm.h> 40#include <sys/module.h> 41#include <sys/malloc.h> 42#include <sys/conf.h> 43#include <sys/vnode.h> 44#include <sys/queue.h> | 1/*- 2 * Parts Copyright (c) 1995 Terrence R. Lambert 3 * Copyright (c) 1995 Julian R. Elischer 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 28 unchanged lines hidden (view full) --- 37#include <sys/kernel.h> 38#include <sys/sysctl.h> 39#include <sys/systm.h> 40#include <sys/module.h> 41#include <sys/malloc.h> 42#include <sys/conf.h> 43#include <sys/vnode.h> 44#include <sys/queue.h> |
45#include <sys/ctype.h> |
|
45#include <machine/stdarg.h> 46 47#define cdevsw_ALLOCSTART (NUMCDEVSW/2) 48 49struct cdevsw *cdevsw[NUMCDEVSW]; 50 51static int bmaj2cmaj[NUMCDEVSW]; 52 --- 11 unchanged lines hidden (view full) --- 64 65static struct specinfo devt_stash[DEVT_STASH]; 66 67static LIST_HEAD(, specinfo) dev_hash[DEVT_HASH]; 68 69static LIST_HEAD(, specinfo) dev_free; 70 71devfs_create_t *devfs_create_hook; | 46#include <machine/stdarg.h> 47 48#define cdevsw_ALLOCSTART (NUMCDEVSW/2) 49 50struct cdevsw *cdevsw[NUMCDEVSW]; 51 52static int bmaj2cmaj[NUMCDEVSW]; 53 --- 11 unchanged lines hidden (view full) --- 65 66static struct specinfo devt_stash[DEVT_STASH]; 67 68static LIST_HEAD(, specinfo) dev_hash[DEVT_HASH]; 69 70static LIST_HEAD(, specinfo) dev_free; 71 72devfs_create_t *devfs_create_hook; |
72devfs_remove_t *devfs_remove_hook; | 73devfs_destroy_t *devfs_destroy_hook; 74int devfs_present; |
73 74static int free_devt; 75SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); 76 77struct cdevsw * 78devsw(dev_t dev) 79{ 80 if (dev->si_devsw) --- 266 unchanged lines hidden (view full) --- 347 if (devfs_create_hook) 348 devfs_create_hook(dev); 349 return (dev); 350} 351 352void 353destroy_dev(dev_t dev) 354{ | 75 76static int free_devt; 77SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); 78 79struct cdevsw * 80devsw(dev_t dev) 81{ 82 if (dev->si_devsw) --- 266 unchanged lines hidden (view full) --- 349 if (devfs_create_hook) 350 devfs_create_hook(dev); 351 return (dev); 352} 353 354void 355destroy_dev(dev_t dev) 356{ |
355 if (devfs_remove_hook) 356 devfs_remove_hook(dev); | 357 if (devfs_destroy_hook) 358 devfs_destroy_hook(dev); |
357 dev->si_drv1 = 0; 358 dev->si_drv2 = 0; 359 dev->si_devsw = 0; 360 freedev(dev); 361} 362 363const char * 364devtoname(dev_t dev) --- 11 unchanged lines hidden (view full) --- 376 mynor = minor(dev); 377 if (mynor < 0 || mynor > 255) 378 sprintf(p, "%#x", (u_int)mynor); 379 else 380 sprintf(p, "%d", mynor); 381 } 382 return (dev->si_name); 383} | 359 dev->si_drv1 = 0; 360 dev->si_drv2 = 0; 361 dev->si_devsw = 0; 362 freedev(dev); 363} 364 365const char * 366devtoname(dev_t dev) --- 11 unchanged lines hidden (view full) --- 378 mynor = minor(dev); 379 if (mynor < 0 || mynor > 255) 380 sprintf(p, "%#x", (u_int)mynor); 381 else 382 sprintf(p, "%d", mynor); 383 } 384 return (dev->si_name); 385} |
386 387int 388dev_stdclone(char *name, char **namep, char *stem, int *unit) 389{ 390 int u, i; 391 392 if (bcmp(stem, name, strlen(stem)) != 0) 393 return (0); 394 i = strlen(stem); 395 if (!isdigit(name[i])) 396 return (0); 397 u = 0; 398 while (isdigit(name[i])) { 399 u *= 10; 400 u += name[i++] - '0'; 401 } 402 *unit = u; 403 if (namep) 404 *namep = &name[i]; 405 if (name[i]) 406 return (2); 407 return (1); 408} |
|