39 #include "nsc_ioctl.h"
40 #include "nsc_power.h"
41 #include "../nsctl.h"
42
43 extern nsc_mem_t *_nsc_local_mem;
44 static int null_power(void);
45
46
47 typedef struct _nsc_power_s {
48 struct _nsc_power_s *next; /* chain */
49 char *name; /* module name */
50 void (*pw_power_lost)(int); /* callback power lost(rideout) */
51 void (*pw_power_ok)(void); /* callback power ok */
52 void (*pw_power_down)(void);
53 /* callback power down (shutdown imminent) */
54 } _nsc_power_t;
55
56 #define _P(x) (((long)(&((_nsc_power_t *)0)->x))/sizeof (long))
57
58 static nsc_def_t _nsc_power_def[] = {
59 "Power_Lost", (uintptr_t)null_power, _P(pw_power_lost),
60 "Power_OK", (uintptr_t)null_power, _P(pw_power_ok),
61 "Power_Down", (uintptr_t)null_power, _P(pw_power_down),
62 0, 0, 0,
63 };
64
65 static _nsc_power_t *_power_clients;
66 static kmutex_t _power_mutex;
67
68
69 static int null_power(void)
70 /*
71 * init null_power - dummy power routine for clients that choose not
72 * to implement all the power hooks.
73 *
74 */
75 {
76 return (0);
77 }
78
79 /*
80 * int
81 * _nsc_power
82 * Call registered clients of the generic power ioctls.
|
39 #include "nsc_ioctl.h"
40 #include "nsc_power.h"
41 #include "../nsctl.h"
42
43 extern nsc_mem_t *_nsc_local_mem;
44 static int null_power(void);
45
46
47 typedef struct _nsc_power_s {
48 struct _nsc_power_s *next; /* chain */
49 char *name; /* module name */
50 void (*pw_power_lost)(int); /* callback power lost(rideout) */
51 void (*pw_power_ok)(void); /* callback power ok */
52 void (*pw_power_down)(void);
53 /* callback power down (shutdown imminent) */
54 } _nsc_power_t;
55
56 #define _P(x) (((long)(&((_nsc_power_t *)0)->x))/sizeof (long))
57
58 static nsc_def_t _nsc_power_def[] = {
59 { "Power_Lost", (uintptr_t)null_power, _P(pw_power_lost) },
60 { "Power_OK", (uintptr_t)null_power, _P(pw_power_ok) },
61 { "Power_Down", (uintptr_t)null_power, _P(pw_power_down) },
62 { NULL, (uintptr_t)NULL, 0}
63 };
64
65 static _nsc_power_t *_power_clients;
66 static kmutex_t _power_mutex;
67
68
69 static int null_power(void)
70 /*
71 * init null_power - dummy power routine for clients that choose not
72 * to implement all the power hooks.
73 *
74 */
75 {
76 return (0);
77 }
78
79 /*
80 * int
81 * _nsc_power
82 * Call registered clients of the generic power ioctls.
|