BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); switch (fdwReason) { case DLL_PROCESS_ATTACH: init_cxx_funcs(); init_lockit(); init_exception(hinstDLL); init_locale(hinstDLL); init_io(hinstDLL); init_misc(hinstDLL); break; case DLL_PROCESS_DETACH: if (lpvReserved) break; free_io(); free_locale(); free_lockit(); free_misc(); break; } return TRUE; }
void *io_loop(void *arg) { struct io *io = (struct io *) arg; struct pfiled *pfiled = io->pfiled; struct xseg *xseg = pfiled->xseg; uint32_t portno = pfiled->portno; struct xseg_request *accepted; for (;;) { accepted = NULL; if (!isTerminate()) accepted = xseg_accept(xseg, portno, 0); if (accepted) { io->req = accepted; wake_up_next_iothread(pfiled); handle_accepted(pfiled, io); } else { pthread_mutex_lock(&io->lock); free_io(pfiled, io); pthread_cond_wait(&io->cond, &io->lock); pthread_mutex_unlock(&io->lock); } } return NULL; }
/* * Decrements the number of outstanding ios that a bio has been * cloned into, completing the original io if necc. */ static inline void dec_pending(struct dm_io *io, int error) { if (error) io->error = error; if (atomic_dec_and_test(&io->io_count)) { if (atomic_dec_and_test(&io->md->pending)) /* nudge anyone waiting on suspend queue */ wake_up(&io->md->wait); bio_endio(io->bio, io->bio->bi_size, io->error); free_io(io->md, io); } }
/* * Decrements the number of outstanding ios that a bio has been * cloned into, completing the original io if necc. */ static void dec_pending(struct dm_io *io, int error) { if (error) io->error = error; if (atomic_dec_and_test(&io->io_count)) { if (end_io_acct(io)) /* nudge anyone waiting on suspend queue */ wake_up(&io->md->wait); blk_add_trace_bio(io->md->queue, io->bio, BLK_TA_COMPLETE); bio_endio(io->bio, io->bio->bi_size, io->error); free_io(io->md, io); } }
BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved) { switch (reason) { case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: init_cxx_funcs(); init_lockit(); init_exception(hdll); init_locale(hdll); init_io(hdll); break; case DLL_PROCESS_DETACH: free_io(); free_locale(); free_lockit(); break; } return TRUE; }
/* * Decrements the number of outstanding ios that a bio has been * cloned into, completing the original io if necc. */ static void dec_pending(struct dm_io *io, int error) { unsigned long flags; /* Push-back supersedes any I/O errors */ if (error && !(io->error > 0 && __noflush_suspending(io->md))) io->error = error; if (atomic_dec_and_test(&io->io_count)) { if (io->error == DM_ENDIO_REQUEUE) { /* * Target requested pushing back the I/O. * This must be handled before the sleeper on * suspend queue merges the pushback list. */ spin_lock_irqsave(&io->md->pushback_lock, flags); if (__noflush_suspending(io->md)) bio_list_add(&io->md->pushback, io->bio); else /* noflush suspend was interrupted. */ io->error = -EIO; spin_unlock_irqrestore(&io->md->pushback_lock, flags); } if (end_io_acct(io)) /* nudge anyone waiting on suspend queue */ wake_up(&io->md->wait); if (io->error != DM_ENDIO_REQUEUE) { blk_add_trace_bio(io->md->queue, io->bio, BLK_TA_COMPLETE); bio_endio(io->bio, io->bio->bi_size, io->error); } free_io(io->md, io); } }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); switch (fdwReason) { case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: init_cxx_funcs(); init_lockit(); init_exception(hinstDLL); init_locale(hinstDLL); init_io(hinstDLL); break; case DLL_PROCESS_DETACH: free_io(); free_locale(); free_lockit(); break; } return TRUE; }