The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

25.4 Asynchronous Events

If an asynchronous event callback has been set up then the callback function should be defined.

    static void
    ahc_async(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)

Implementation for a single type of event, AC_LOST_DEVICE, looks like:

        struct xxx_softc *softc;
        struct cam_sim *sim;
        int targ;
        struct ccb_trans_settings neg;
    
        sim = (struct cam_sim *)callback_arg;
        softc = (struct xxx_softc *)cam_sim_softc(sim);
        switch (code) {
        case AC_LOST_DEVICE:
            targ = xpt_path_target_id(path);
            if(targ <= OUR_MAX_SUPPORTED_TARGET) {
                clean_negotiations(softc, targ);
                /* send indication to CAM */
                neg.bus_width = 8;
                neg.sync_period = neg.sync_offset = 0;
                neg.valid = (CCB_TRANS_BUS_WIDTH_VALID
                    | CCB_TRANS_SYNC_RATE_VALID | CCB_TRANS_SYNC_OFFSET_VALID);
                xpt_async(AC_TRANSFER_NEG, path, &neg);
            }
            break;
        default:
            break;
        }

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру