Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 0496c17 in mainline


Ignore:
Timestamp:
2011-05-16T19:58:02Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
0d8a304
Parents:
bec0219
Message:

Allow events to define unmask callback. Make klog_update() the unmask
callback for KLOG_EVENT. This makes sure that klog receives all data
from the kernel console even after the kernel stops printing.

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/event.h

    rbec0219 r0496c17  
    5353        /** Masked flag. */
    5454        bool masked;
     55        /** Unmask callback. */
     56        void (*unmask_cb)(void);
    5557} event_t;
    5658
    5759extern void event_init(void);
    5860extern void event_cleanup_answerbox(answerbox_t *);
     61extern void event_set_unmask_callback(event_type_t, void (*)(void));
    5962
    6063#define event_notify_0(e, m) \
  • kernel/generic/src/console/console.c

    rbec0219 r0496c17  
    165165        sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr);
    166166        sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
     167
     168        event_set_unmask_callback(EVENT_KLOG, klog_update);
    167169       
    168170        spinlock_lock(&klog_lock);
  • kernel/generic/src/ipc/event.c

    rbec0219 r0496c17  
    5959                events[i].imethod = 0;
    6060                events[i].masked = false;
     61                events[i].unmask_cb = NULL;
    6162        }
    6263}
     
    8384}
    8485
     86/** Define a callback function for the event unmask event.
     87 *
     88 * @param evno Event type.
     89 * @param cb   Callback function to be called when the event is unmasked.
     90 *
     91 */
     92void event_set_unmask_callback(event_type_t evno, void (*cb)(void))
     93{
     94        ASSERT(evno < EVENT_END);
     95       
     96        spinlock_lock(&events[evno].lock);
     97        events[evno].unmask_cb = cb;
     98        spinlock_unlock(&events[evno].lock);
     99}
     100
    85101/** Send kernel notification event
    86102 *
     
    190206static void event_unmask(event_type_t evno)
    191207{
     208        void (*cb)(void);
    192209        ASSERT(evno < EVENT_END);
    193210       
    194211        spinlock_lock(&events[evno].lock);
    195212        events[evno].masked = false;
    196         spinlock_unlock(&events[evno].lock);
     213        cb = events[evno].unmask_cb;
     214        spinlock_unlock(&events[evno].lock);
     215       
     216        /*
     217         * Check if there is an unmask callback function defined for this event.
     218         */
     219        if (cb)
     220            cb();
    197221}
    198222
Note: See TracChangeset for help on using the changeset viewer.