|
|
1.1 ! root 1: /* ryopblock.c - manage operation blocks */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/rosy/RCS/ryopblock.c,v 7.1 90/07/01 21:06:36 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/rosy/RCS/ryopblock.c,v 7.1 90/07/01 21:06:36 mrose Exp $ ! 9: * ! 10: * ! 11: * $Log: ryopblock.c,v $ ! 12: * Revision 7.1 90/07/01 21:06:36 mrose ! 13: * pepsy ! 14: * ! 15: * Revision 7.0 89/11/23 22:22:01 mrose ! 16: * Release 6.0 ! 17: * ! 18: */ ! 19: ! 20: /* ! 21: * NOTICE ! 22: * ! 23: * Acquisition, use, and distribution of this module and related ! 24: * materials are subject to the restrictions of a license agreement. ! 25: * Consult the Preface in the User's Manual for the full terms of ! 26: * this agreement. ! 27: * ! 28: */ ! 29: ! 30: ! 31: /* LINTLIBRARY */ ! 32: ! 33: #include <stdio.h> ! 34: #include "rosy.h" ! 35: ! 36: /* DATA */ ! 37: ! 38: static int once_only = 0; ! 39: static struct opsblk opsque; ! 40: static struct opsblk *OPHead = &opsque; ! 41: ! 42: /* OPERATION BLOCKS */ ! 43: ! 44: struct opsblk *newopblk (sd, id) ! 45: int sd, ! 46: id; ! 47: { ! 48: register struct opsblk *opb; ! 49: ! 50: opb = (struct opsblk *) calloc (1, sizeof *opb); ! 51: if (opb == NULL) ! 52: return NULL; ! 53: ! 54: opb -> opb_flags |= OPB_INITIATOR; ! 55: ! 56: opb -> opb_fd = sd; ! 57: opb -> opb_id = id; ! 58: ! 59: if (once_only == 0) { ! 60: OPHead -> opb_forw = OPHead -> opb_back = OPHead; ! 61: once_only++; ! 62: } ! 63: ! 64: insque (opb, OPHead -> opb_back); ! 65: ! 66: return opb; ! 67: } ! 68: ! 69: /* */ ! 70: ! 71: freeopblk (opb) ! 72: register struct opsblk *opb; ! 73: { ! 74: if (opb == NULL) ! 75: return; ! 76: ! 77: #ifdef PEPSY_DEFINITIONS ! 78: if (opb -> opb_out && opb -> opb_free_mod) ! 79: fre_obj (opb -> opb_out, ! 80: opb -> opb_free_mod -> md_dtab[opb -> opb_free_index], ! 81: opb -> opb_free_mod); ! 82: #else ! 83: if (opb -> opb_out && opb -> opb_free) ! 84: (void) (*opb -> opb_free) (opb -> opb_out); ! 85: #endif ! 86: ! 87: if (opb -> opb_pe) ! 88: pe_free (opb -> opb_pe); ! 89: ! 90: remque (opb); ! 91: ! 92: free ((char *) opb); ! 93: } ! 94: ! 95: /* */ ! 96: ! 97: struct opsblk *findopblk (sd, id, flags) ! 98: register int sd, ! 99: id, ! 100: flags; ! 101: { ! 102: register struct opsblk *opb; ! 103: ! 104: if (once_only == 0) ! 105: return NULL; ! 106: ! 107: flags &= OPB_INITIATOR | OPB_RESPONDER; ! 108: for (opb = OPHead -> opb_forw; opb != OPHead; opb = opb -> opb_forw) ! 109: if (opb -> opb_fd == sd ! 110: && opb -> opb_id == id ! 111: && (opb -> opb_flags & flags)) ! 112: return opb; ! 113: ! 114: return NULL; ! 115: } ! 116: ! 117: /* */ ! 118: ! 119: struct opsblk *firstopblk (sd) ! 120: register int sd; ! 121: { ! 122: register struct opsblk *opb, ! 123: *op2; ! 124: ! 125: if (once_only == 0) ! 126: return NULL; ! 127: ! 128: op2 = NULLOPB; ! 129: for (opb = OPHead -> opb_forw; opb != OPHead; opb = opb -> opb_forw) ! 130: if (opb -> opb_fd == sd && (opb -> opb_flags & OPB_INITIATOR)) { ! 131: if (opb -> opb_flags & OPB_EVENT) ! 132: return opb; ! 133: if (op2 == NULLOPB) ! 134: op2 = opb; ! 135: } ! 136: ! 137: return op2; ! 138: } ! 139: ! 140: /* */ ! 141: ! 142: loseopblk (sd, reason) ! 143: register int sd; ! 144: int reason; ! 145: { ! 146: register struct opsblk *opb, ! 147: *op2; ! 148: struct RoSAPindication rois; ! 149: ! 150: if (once_only == 0) ! 151: return; ! 152: ! 153: for (opb = OPHead -> opb_forw; opb != OPHead; opb = op2) { ! 154: op2 = opb -> opb_forw; ! 155: ! 156: if (opb -> opb_fd == sd) { ! 157: if (opb -> opb_errfnx) ! 158: (*opb -> opb_errfnx) (sd, opb -> opb_id, RY_REJECT, ! 159: (caddr_t) reason, &rois); ! 160: ! 161: freeopblk (opb); ! 162: } ! 163: } ! 164: } ! 165: ! 166: /* */ ! 167: ! 168: #ifdef lint ! 169: ! 170: /* VARARGS */ ! 171: ! 172: int rosaplose (roi, reason, what, fmt) ! 173: struct RoSAPindication *roi; ! 174: int reason; ! 175: char *what, ! 176: *fmt; ! 177: { ! 178: return rosaplose (roi, reason, what, fmt); ! 179: } ! 180: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.