static struct cli_state *cli_cm_find(struct cli_state *cli, const char *server, const char *share) { struct cli_state *p; if (cli == NULL) { return NULL; } /* Search to the start of the list. */ for (p = cli; p; p = DLIST_PREV(p)) { const char *remote_name = cli_state_remote_name(p); if (strequal(server, remote_name) && strequal(share,p->share)) { return p; } } /* Search to the end of the list. */ for (p = cli->next; p; p = p->next) { const char *remote_name = cli_state_remote_name(p); if (strequal(server, remote_name) && strequal(share,p->share)) { return p; } } return NULL; }
static void pthreadpool_child(void) { int ret; struct pthreadpool *pool; for (pool = DLIST_TAIL(pthreadpools); pool != NULL; pool = DLIST_PREV(pool)) { close(pool->sig_pipe[0]); close(pool->sig_pipe[1]); ret = pipe(pool->sig_pipe); assert(ret == 0); pool->num_threads = 0; pool->num_exited = 0; free(pool->exited); pool->exited = NULL; pool->num_idle = 0; pool->head = 0; pool->num_jobs = 0; ret = pthread_mutex_unlock(&pool->mutex); assert(ret == 0); } ret = pthread_mutex_unlock(&pthreadpools_mutex); assert(ret == 0); }
static void pthreadpool_parent(void) { int ret; struct pthreadpool *pool; for (pool = DLIST_TAIL(pthreadpools); pool != NULL; pool = DLIST_PREV(pool)) { ret = pthread_mutex_unlock(&pool->mutex); assert(ret == 0); } ret = pthread_mutex_unlock(&pthreadpools_mutex); assert(ret == 0); }
void zzzcode(NODE *p, int c) { NODE *l, *r; TWORD t; int m; char *ch; switch (c) { case 'N': /* logical ops, turned into 0-1 */ /* use register given by register 1 */ cbgen( 0, m=getlab2()); deflab( p->n_label ); printf( " clrl %s\n", rnames[getlr( p, '1' )->n_rval] ); deflab( m ); return; case 'A': /* Assign a constant directly to a memory position */ printf("\t"); if (p->n_type < LONG || ISPTR(p->n_type)) casg(p); else casg64(p); printf("\n"); break; case 'B': /* long long compare */ twollcomp(p); break; case 'C': /* num words pushed on arg stack */ printf("$%d", p->n_qual); break; case 'D': /* INCR and DECR */ zzzcode(p->n_left, 'A'); printf("\n "); #if 0 case 'E': /* INCR and DECR, FOREFF */ if (p->n_right->n_lval == 1) { printf("%s", (p->n_op == INCR ? "inc" : "dec") ); prtype(p->n_left); printf(" "); adrput(stdout, p->n_left); return; } printf("%s", (p->n_op == INCR ? "add" : "sub") ); prtype(p->n_left); printf("2 "); adrput(stdout, p->n_right); printf(","); adrput(p->n_left); return; #endif case 'F': /* register type of right operand */ { register NODE *n; register int ty; n = getlr( p, 'R' ); ty = n->n_type; if (x2debug) printf("->%d<-", ty); if ( ty==DOUBLE) printf("d"); else if ( ty==FLOAT ) printf("f"); else printf("l"); return; } case 'G': /* emit conversion instructions */ sconv(p); break; case 'J': /* jump or ret? */ { struct interpass *ip = DLIST_PREV((struct interpass *)p2env.epp, qelem); if (ip->type != IP_DEFLAB || ip->ip_lbl != getlr(p, 'L')->n_lval) expand(p, FOREFF, "jbr LL"); else printf("ret"); } break; case 'L': /* type of left operand */ case 'R': /* type of right operand */ { register NODE *n; n = getlr ( p, c); if (x2debug) printf("->%d<-", n->n_type); prtype(n); return; } case 'O': /* print out emulated ops */ expand(p, FOREFF, "\tmovq AR,-(%sp)\n"); expand(p, FOREFF, "\tmovq AL,-(%sp)\n"); if (p->n_op == DIV && p->n_type == ULONGLONG) ch = "udiv"; else if (p->n_op == DIV) ch = "div"; else if (p->n_op == MOD && p->n_type == ULONGLONG) ch = "umod"; else if (p->n_op == MOD) ch = "mod"; else if (p->n_op == MUL) ch = "mul"; else ch = 0, comperr("ZO %d", p->n_op); printf("\tcalls $4,__%sdi3\n", ch); break; case 'Z': /* complement mask for bit instr */ printf("$%Ld", ~p->n_right->n_lval); return; case 'U': /* 32 - n, for unsigned right shifts */ t = DEUNSIGN(p->n_left->n_type); m = t == CHAR ? 8 : t == SHORT ? 16 : 32; printf("$" CONFMT, m - p->n_right->n_lval); return; case 'T': /* rounded structure length for arguments */ { int size; size = p->n_stsize; SETOFF( size, 4); printf("$%d", size); return; } case 'S': /* structure assignment */ { register int size; size = p->n_stsize; l = r = NULL; /* XXX gcc */ if( p->n_op == STASG ){ l = p->n_left; r = p->n_right; } else if( p->n_op == STARG ){ /* store an arg into a temporary */ printf("\tsubl2 $%d,%%sp\n", size < 4 ? 4 : size); l = mklnode(OREG, 0, SP, INT); r = p->n_left; } else cerror( "STASG bad" ); if( r->n_op == ICON ) r->n_op = NAME; else if( r->n_op == REG ) r->n_op = OREG; else if( r->n_op != OREG ) cerror( "STASG-r" ); if (size != 0) { if( size <= 0 || size > 65535 ) cerror("structure size <0=0 or >65535"); switch(size) { case 1: printf(" movb "); break; case 2: printf(" movw "); break; case 4: printf(" movl "); break; case 8: printf(" movq "); break; default: printf(" movc3 $%d,", size); break; } adrput(stdout, r); printf(","); adrput(stdout, l); printf("\n"); } if( r->n_op == NAME ) r->n_op = ICON; else if( r->n_op == OREG ) r->n_op = REG; if (p->n_op == STARG) tfree(l); } break; default: comperr("illegal zzzcode '%c'", c); } }
static void onefs_smb_statistics_end(struct smb_perfcount_data *pcd) { struct onefs_stats_context *ctxt = pcd->context; struct onefs_op_counter *tmp; uint64_t uid; static in_addr_t rem_addr = 0; static in_addr_t loc_addr = 0; /* not enabled */ if (pcd->context == NULL) return; uid = current_user.ut.uid ? current_user.ut.uid : ISC_UNKNOWN_CLIENT_ID; /* get address info once, doesn't change for process */ if (rem_addr == 0) { #error Isilon, please remove this after testing the code below char *addr; addr = talloc_sub_basic(talloc_tos(), "", "", "%I"); if (addr != NULL) { rem_addr = interpret_addr(addr); TALLOC_FREE(addr); } else { rem_addr = ISC_MASKED_ADDR; } addr = talloc_sub_basic(talloc_tos(), "", "", "%i"); if (addr != NULL) { loc_addr = interpret_addr(addr); TALLOC_FREE(addr); } else { loc_addr = ISC_MASKED_ADDR; } } /* * bug here - we aren't getting the outlens right, * when dealing w/ chained requests. */ for (tmp = ctxt->ops_chain; tmp; tmp = tmp->next) { tmp->iod.out_bytes = ctxt->iod.out_bytes; isc_cookie_init(&tmp->iod.cookie, rem_addr, loc_addr, uid); ISP_OP_END(&tmp->iod); #ifdef ONEFS_PERF_DEBUG DEBUG(0,("******** Finalized CHAIN op %s uid %llu in:%llu" ", out:%llu\n", onefs_stat_debug(&tmp->iod), uid, tmp->iod.in_bytes, tmp->iod.out_bytes)); #endif SAFE_FREE(DLIST_PREV(tmp)); } isc_cookie_init(&ctxt->iod.cookie, rem_addr, loc_addr, uid); ISP_OP_END(&ctxt->iod); #ifdef ONEFS_PERF_DEBUG DEBUG(0,("******** Finalized op %s uid %llu in:%llu, out:%llu\n", onefs_stat_debug(&ctxt->iod), uid, ctxt->iod.in_bytes, ctxt->iod.out_bytes)); #endif if (ctxt->alloced) SAFE_FREE(ctxt); else ZERO_STRUCTP(ctxt); pcd->context = NULL; }