snp.c (47625) | snp.c (47640) |
---|---|
1/* 2 * Copyright (c) 1995 Ugen J.S.Antsilevich 3 * 4 * Redistribution and use in source forms, with and without modification, 5 * are permitted provided that this entire comment appears intact. 6 * 7 * Redistribution in binary form may occur without any restrictions. 8 * Obviously, it would be nice if you gave credit where credit is due --- 69 unchanged lines hidden (view full) --- 78static struct tty *snpdevtotty __P((dev_t dev)); 79static int snp_detach __P((struct snoop *snp)); 80 81static struct tty * 82snpdevtotty (dev) 83 dev_t dev; 84{ 85 struct cdevsw *cdp; | 1/* 2 * Copyright (c) 1995 Ugen J.S.Antsilevich 3 * 4 * Redistribution and use in source forms, with and without modification, 5 * are permitted provided that this entire comment appears intact. 6 * 7 * Redistribution in binary form may occur without any restrictions. 8 * Obviously, it would be nice if you gave credit where credit is due --- 69 unchanged lines hidden (view full) --- 78static struct tty *snpdevtotty __P((dev_t dev)); 79static int snp_detach __P((struct snoop *snp)); 80 81static struct tty * 82snpdevtotty (dev) 83 dev_t dev; 84{ 85 struct cdevsw *cdp; |
86 int maj; | |
87 | 86 |
88 maj = major(dev); 89 if ((u_int)maj >= nchrdev) 90 return (NULL); | |
91 cdp = devsw(dev); 92 if (cdp == NULL) 93 return (NULL); 94 return ((*cdp->d_devtotty)(dev)); 95} 96 97#define SNP_INPUT_BUF 5 /* This is even too much,the maximal 98 * interactive mode write is 3 bytes --- 429 unchanged lines hidden (view full) --- 528#endif 529static int snp_devsw_installed; 530 531static void snp_drvinit __P((void *unused)); 532static void 533snp_drvinit(unused) 534 void *unused; 535{ | 87 cdp = devsw(dev); 88 if (cdp == NULL) 89 return (NULL); 90 return ((*cdp->d_devtotty)(dev)); 91} 92 93#define SNP_INPUT_BUF 5 /* This is even too much,the maximal 94 * interactive mode write is 3 bytes --- 429 unchanged lines hidden (view full) --- 524#endif 525static int snp_devsw_installed; 526 527static void snp_drvinit __P((void *unused)); 528static void 529snp_drvinit(unused) 530 void *unused; 531{ |
536 dev_t dev; | |
537#ifdef DEVFS 538 int i; 539#endif 540 541 if( ! snp_devsw_installed ) { | 532#ifdef DEVFS 533 int i; 534#endif 535 536 if( ! snp_devsw_installed ) { |
542 dev = makedev(CDEV_MAJOR, 0); 543 cdevsw_add(&dev,&snp_cdevsw, NULL); | 537 cdevsw_add(&snp_cdevsw); |
544 snp_devsw_installed = 1; 545#ifdef DEVFS 546 for ( i = 0 ; i < NSNP ; i++) { 547 snp_devfs_token[i] = 548 devfs_add_devswf(&snp_cdevsw, i, DV_CHR, 0, 0, 549 0600, "snp%d", i); 550 } 551#endif 552 } 553} 554 555SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL) 556 557 558#endif | 538 snp_devsw_installed = 1; 539#ifdef DEVFS 540 for ( i = 0 ; i < NSNP ; i++) { 541 snp_devfs_token[i] = 542 devfs_add_devswf(&snp_cdevsw, i, DV_CHR, 0, 0, 543 0600, "snp%d", i); 544 } 545#endif 546 } 547} 548 549SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL) 550 551 552#endif |