<sys/socket.h>: turn off MSG_NOSIGNAL
[minix3.git] / drivers / printer / liveupdate.c
blob232e4e29cfbcb227d94a44536e9f88b6fca91e4d
1 #include <minix/drivers.h>
3 /* State management variables. */
4 EXTERN int writing;
6 /* Custom states definition. */
7 #define PR_STATE_WRITE_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 0)
8 #define PR_STATE_IS_CUSTOM(s) ((s) == PR_STATE_WRITE_PROTOCOL_FREE)
10 /*===========================================================================*
11 * sef_cb_lu_prepare *
12 *===========================================================================*/
13 int sef_cb_lu_prepare(int state)
15 int is_ready;
17 /* Check if we are ready for the target state. */
18 is_ready = FALSE;
19 switch(state) {
20 /* Standard states. */
21 case SEF_LU_STATE_REQUEST_FREE:
22 is_ready = TRUE;
23 break;
25 case SEF_LU_STATE_PROTOCOL_FREE:
26 is_ready = (!writing);
27 break;
29 /* Custom states. */
30 case PR_STATE_WRITE_PROTOCOL_FREE:
31 is_ready = (!writing);
32 break;
35 /* Tell SEF if we are ready. */
36 return is_ready ? OK : ENOTREADY;
39 /*===========================================================================*
40 * sef_cb_lu_state_isvalid *
41 *===========================================================================*/
42 int sef_cb_lu_state_isvalid(int state)
44 return SEF_LU_STATE_IS_STANDARD(state) || PR_STATE_IS_CUSTOM(state);
47 /*===========================================================================*
48 * sef_cb_lu_state_dump *
49 *===========================================================================*/
50 void sef_cb_lu_state_dump(int state)
52 sef_lu_dprint("printer: live update state = %d\n", state);
53 sef_lu_dprint("printer: writing = %d\n", writing);
55 sef_lu_dprint("printer: SEF_LU_STATE_WORK_FREE(%d) reached = %d\n",
56 SEF_LU_STATE_WORK_FREE, TRUE);
57 sef_lu_dprint("printer: SEF_LU_STATE_REQUEST_FREE(%d) reached = %d\n",
58 SEF_LU_STATE_REQUEST_FREE, TRUE);
59 sef_lu_dprint("printer: SEF_LU_STATE_PROTOCOL_FREE(%d) reached = %d\n",
60 SEF_LU_STATE_PROTOCOL_FREE, (!writing));
61 sef_lu_dprint("printer: PR_STATE_WRITE_PROTOCOL_FREE(%d) reached = %d\n",
62 PR_STATE_WRITE_PROTOCOL_FREE, (!writing));