streams.c (47625) | streams.c (47640) |
---|---|
1/* 2 * Copyright (c) 1998 Mark Newton 3 * Copyright (c) 1994 Christos Zoulas 4 * Copyright (c) 1997 Todd Vierling 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 138 unchanged lines hidden (view full) --- 147} ; 148 149#define UNIT(dev) minor(dev) /* assume one minor number per unit */ 150 151typedef struct streams_softc *sc_p; 152 153static sc_p sca[NSTREAMS]; 154 | 1/* 2 * Copyright (c) 1998 Mark Newton 3 * Copyright (c) 1994 Christos Zoulas 4 * Copyright (c) 1997 Todd Vierling 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 138 unchanged lines hidden (view full) --- 147} ; 148 149#define UNIT(dev) minor(dev) /* assume one minor number per unit */ 150 151typedef struct streams_softc *sc_p; 152 153static sc_p sca[NSTREAMS]; 154 |
155static void 156streamsattach(void *dummy) 157{ 158 cdevsw_add_generic(CDEV_MAJOR, CDEV_MAJOR, &streams_cdevsw); 159} 160 | |
161static int 162streams_modevent(module_t mod, int type, void *unused) 163{ 164 switch (type) { 165 case MOD_LOAD: | 155static int 156streams_modevent(module_t mod, int type, void *unused) 157{ 158 switch (type) { 159 case MOD_LOAD: |
166 streamsattach(NULL); | 160 cdevsw_add(&streams_cdevsw); |
167 return 0; 168 case MOD_UNLOAD: | 161 return 0; 162 case MOD_UNLOAD: |
169 cdevsw[CDEV_MAJOR] = NULL; /* clean up cdev */ | |
170 return 0; 171 default: 172 break; 173 } 174 return 0; 175} 176 177static moduledata_t streams_mod = { --- 211 unchanged lines hidden (view full) --- 389 390/* 391 * Now for some driver initialisation. 392 * Occurs ONCE during boot (very early). 393 */ 394static void 395streams_drvinit(void *unused) 396{ | 163 return 0; 164 default: 165 break; 166 } 167 return 0; 168} 169 170static moduledata_t streams_mod = { --- 211 unchanged lines hidden (view full) --- 382 383/* 384 * Now for some driver initialisation. 385 * Occurs ONCE during boot (very early). 386 */ 387static void 388streams_drvinit(void *unused) 389{ |
397 dev_t dev; | |
398 int unit; 399 sc_p scp = sca[unit]; 400 | 390 int unit; 391 sc_p scp = sca[unit]; 392 |
401 dev = makedev(CDEV_MAJOR, 0); 402 cdevsw_add(&dev, &streams_cdevsw, NULL); | 393 cdevsw_add(&streams_cdevsw); |
403 for (unit = 0; unit < NSTREAMS; unit++) { 404 /* 405 * Allocate storage for this instance . 406 */ 407 scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT); 408 if( scp == NULL) { 409 printf("streams%d failed to allocate strorage\n", unit); 410 return ; --- 44 unchanged lines hidden --- | 394 for (unit = 0; unit < NSTREAMS; unit++) { 395 /* 396 * Allocate storage for this instance . 397 */ 398 scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT); 399 if( scp == NULL) { 400 printf("streams%d failed to allocate strorage\n", unit); 401 return ; --- 44 unchanged lines hidden --- |