snp.c (106767) | snp.c (109623) |
---|---|
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 9 * but requiring it would be too onerous. 10 * 11 * This software is provided ``AS IS'' without any warranties of any kind. 12 * 13 * Snoop stuff. 14 * | 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 9 * but requiring it would be too onerous. 10 * 11 * This software is provided ``AS IS'' without any warranties of any kind. 12 * 13 * Snoop stuff. 14 * |
15 * $FreeBSD: head/sys/dev/snp/snp.c 106767 2002-11-11 10:45:31Z tmm $ | 15 * $FreeBSD: head/sys/dev/snp/snp.c 109623 2003-01-21 08:56:16Z alfred $ |
16 */ 17 18#include <sys/param.h> 19#include <sys/systm.h> 20#include <sys/filio.h> 21#include <sys/malloc.h> 22#include <sys/tty.h> 23#include <sys/conf.h> --- 121 unchanged lines hidden (view full) --- 145 int error, ilen; 146 char *ibuf; 147 148 error = 0; 149 ibuf = NULL; 150 snp = tp->t_sc; 151 while (uio->uio_resid > 0) { 152 ilen = imin(512, uio->uio_resid); | 16 */ 17 18#include <sys/param.h> 19#include <sys/systm.h> 20#include <sys/filio.h> 21#include <sys/malloc.h> 22#include <sys/tty.h> 23#include <sys/conf.h> --- 121 unchanged lines hidden (view full) --- 145 int error, ilen; 146 char *ibuf; 147 148 error = 0; 149 ibuf = NULL; 150 snp = tp->t_sc; 151 while (uio->uio_resid > 0) { 152 ilen = imin(512, uio->uio_resid); |
153 ibuf = malloc(ilen, M_SNP, M_WAITOK); | 153 ibuf = malloc(ilen, M_SNP, 0); |
154 error = uiomove(ibuf, ilen, uio); 155 if (error != 0) 156 break; 157 snp_in(snp, ibuf, ilen); 158 /* Hackish, but probably the least of all evils. */ 159 iov.iov_base = ibuf; 160 iov.iov_len = ilen; 161 uio2.uio_iov = &iov; --- 224 unchanged lines hidden (view full) --- 386{ 387 struct snoop *snp; 388 389 if (dev->si_drv1 == NULL) { 390 if (!(dev->si_flags & SI_NAMED)) 391 make_dev(&snp_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 392 0600, "snp%d", dev2unit(dev)); 393 dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, | 154 error = uiomove(ibuf, ilen, uio); 155 if (error != 0) 156 break; 157 snp_in(snp, ibuf, ilen); 158 /* Hackish, but probably the least of all evils. */ 159 iov.iov_base = ibuf; 160 iov.iov_len = ilen; 161 uio2.uio_iov = &iov; --- 224 unchanged lines hidden (view full) --- 386{ 387 struct snoop *snp; 388 389 if (dev->si_drv1 == NULL) { 390 if (!(dev->si_flags & SI_NAMED)) 391 make_dev(&snp_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 392 0600, "snp%d", dev2unit(dev)); 393 dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, |
394 M_WAITOK | M_ZERO); | 394 M_ZERO); |
395 snp->snp_unit = dev2unit(dev); 396 } else 397 return (EBUSY); 398 399 /* 400 * We intentionally do not OR flags with SNOOP_OPEN, but set them so 401 * all previous settings (especially SNOOP_OFLOW) will be cleared. 402 */ 403 snp->snp_flags = SNOOP_OPEN; 404 | 395 snp->snp_unit = dev2unit(dev); 396 } else 397 return (EBUSY); 398 399 /* 400 * We intentionally do not OR flags with SNOOP_OPEN, but set them so 401 * all previous settings (especially SNOOP_OFLOW) will be cleared. 402 */ 403 snp->snp_flags = SNOOP_OPEN; 404 |
405 snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); | 405 snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, 0); |
406 snp->snp_blen = SNOOP_MINLEN; 407 snp->snp_base = 0; 408 snp->snp_len = 0; 409 410 /* 411 * snp_tty == NULL is for inactive snoop devices. 412 */ 413 snp->snp_tty = NULL; --- 61 unchanged lines hidden (view full) --- 475 476static int 477snp_down(snp) 478 struct snoop *snp; 479{ 480 481 if (snp->snp_blen != SNOOP_MINLEN) { 482 free(snp->snp_buf, M_SNP); | 406 snp->snp_blen = SNOOP_MINLEN; 407 snp->snp_base = 0; 408 snp->snp_len = 0; 409 410 /* 411 * snp_tty == NULL is for inactive snoop devices. 412 */ 413 snp->snp_tty = NULL; --- 61 unchanged lines hidden (view full) --- 475 476static int 477snp_down(snp) 478 struct snoop *snp; 479{ 480 481 if (snp->snp_blen != SNOOP_MINLEN) { 482 free(snp->snp_buf, M_SNP); |
483 snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); | 483 snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, 0); |
484 snp->snp_blen = SNOOP_MINLEN; 485 } 486 snp->snp_flags |= SNOOP_DOWN; 487 488 return (snp_detach(snp)); 489} 490 491static int --- 174 unchanged lines hidden --- | 484 snp->snp_blen = SNOOP_MINLEN; 485 } 486 snp->snp_flags |= SNOOP_DOWN; 487 488 return (snp_detach(snp)); 489} 490 491static int --- 174 unchanged lines hidden --- |