1*18c2aff7Sartem /*************************************************************************** 2*18c2aff7Sartem * 3*18c2aff7Sartem * hotplug.h : definitions for HAL-internal hotplug events 4*18c2aff7Sartem * 5*18c2aff7Sartem * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 6*18c2aff7Sartem * Use is subject to license terms. 7*18c2aff7Sartem * 8*18c2aff7Sartem * Licensed under the Academic Free License version 2.1 9*18c2aff7Sartem * 10*18c2aff7Sartem **************************************************************************/ 11*18c2aff7Sartem 12*18c2aff7Sartem #ifndef HOTPLUG_H 13*18c2aff7Sartem #define HOTPLUG_H 14*18c2aff7Sartem 15*18c2aff7Sartem #include <glib.h> 16*18c2aff7Sartem 17*18c2aff7Sartem #include "../device.h" 18*18c2aff7Sartem #include "../util.h" 19*18c2aff7Sartem 20*18c2aff7Sartem #include "devinfo.h" 21*18c2aff7Sartem 22*18c2aff7Sartem typedef enum { 23*18c2aff7Sartem HOTPLUG_ACTION_ADD, 24*18c2aff7Sartem HOTPLUG_ACTION_REMOVE, 25*18c2aff7Sartem } HotplugActionType; 26*18c2aff7Sartem 27*18c2aff7Sartem typedef enum { 28*18c2aff7Sartem HOTPLUG_EVENT_DEVFS = 0, 29*18c2aff7Sartem } HotplugEventType; 30*18c2aff7Sartem 31*18c2aff7Sartem /** Data structure representing a hotplug event; also used for 32*18c2aff7Sartem * coldplugging. 33*18c2aff7Sartem */ 34*18c2aff7Sartem typedef struct 35*18c2aff7Sartem { 36*18c2aff7Sartem HotplugActionType action; /**< Whether the event is add or remove */ 37*18c2aff7Sartem HotplugEventType type; /**< Type of hotplug event */ 38*18c2aff7Sartem 39*18c2aff7Sartem HalDevice *d; 40*18c2aff7Sartem 41*18c2aff7Sartem union { 42*18c2aff7Sartem struct { 43*18c2aff7Sartem char devfs_path[HAL_PATH_MAX]; 44*18c2aff7Sartem DevinfoDevHandler *handler; 45*18c2aff7Sartem } devfs; 46*18c2aff7Sartem } un; 47*18c2aff7Sartem 48*18c2aff7Sartem } HotplugEvent; 49*18c2aff7Sartem 50*18c2aff7Sartem void hotplug_event_enqueue (HotplugEvent *event, int front); 51*18c2aff7Sartem 52*18c2aff7Sartem void hotplug_event_process_queue (void); 53*18c2aff7Sartem 54*18c2aff7Sartem void hotplug_event_end (void *end_token); 55*18c2aff7Sartem 56*18c2aff7Sartem void hotplug_queue_now_empty (void); 57*18c2aff7Sartem 58*18c2aff7Sartem #endif /* HOTPLUG_H */ 59