/* add client with fd to client list */ void storeClientListAdd(StoreEntry * e, void *data) { MemObject *mem = e->mem_obj; store_client **T; store_client *sc; assert(mem); if (storeClientListSearch(mem, data) != NULL) return; e->refcount++; mem->nclients++; sc = memAllocate(MEM_STORE_CLIENT); cbdataAdd(sc, memFree, MEM_STORE_CLIENT); /* sc is callback_data for file_read */ cbdataLock(data); /* locked while we point to it */ sc->callback_data = data; sc->seen_offset = 0; sc->copy_offset = 0; sc->flags.disk_io_pending = 0; sc->entry = e; sc->type = storeClientType(e); if (sc->type == STORE_DISK_CLIENT) /* assert we'll be able to get the data we want */ /* maybe we should open swapin_fd here */ assert(e->swap_file_number > -1 || storeSwapOutAble(e)); for (T = &mem->clients; *T; T = &(*T)->next); *T = sc; #if DELAY_POOLS sc->delay_id = 0; #endif }
/* add client with fd to client list */ store_client * storeClientRegister(StoreEntry * e, void *owner) { MemObject *mem = e->mem_obj; store_client *sc; assert(mem); e->refcount++; mem->nclients++; sc = cbdataAlloc(store_client); sc->callback_data = NULL; sc->seen_offset = 0; sc->copy_offset = 0; sc->flags.disk_io_pending = 0; sc->entry = e; storeLockObject(sc->entry); sc->type = storeClientType(e); #if STORE_CLIENT_LIST_DEBUG assert(!storeClientListSearch(mem, owner)); sc->owner = owner; #endif dlinkAdd(sc, &sc->node, &mem->clients); #if DELAY_POOLS sc->delay_id = 0; #endif return sc; }
/* add client with fd to client list */ store_client * storeClientListAdd(StoreEntry * e, void *data) { MemObject *mem = e->mem_obj; store_client *sc; assert(mem); #if STORE_CLIENT_LIST_DEBUG if (storeClientListSearch(mem, data) != NULL) assert(1 == 0); /* XXX die! */ #endif e->refcount++; mem->nclients++; sc = cbdataAlloc(store_client); cbdataLock(data); /* locked while we point to it */ sc->callback_data = data; sc->seen_offset = 0; sc->copy_offset = 0; sc->flags.disk_io_pending = 0; sc->entry = e; sc->type = storeClientType(e); dlinkAdd(sc, &sc->node, &mem->clients); #if DELAY_POOLS sc->delay_id = 0; #endif return sc; }