home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / kernserv / insertmsg.h < prev    next >
Text File  |  1992-07-29  |  6KB  |  215 lines

  1. /*    @(#)insertmsg.h    2.0    02/14/90    (c) 1990 NeXT    
  2.  *
  3.  * insertmsg.h -- Structs used for "Disk Inserted" messages. 
  4.  *
  5.  * HISTORY
  6.  * 01-Oct-90    Doug Mitchell
  7.  *    Added in_flags, IND_FLAGS_REMOVABLE
  8.  * 23-Apr-90    Doug Mitchell
  9.  *    Added oid_dev_str to of_insert_notify_dev
  10.  * 14-Feb-90    Doug Mitchell at NeXT
  11.  *    Created.
  12.  *
  13.  */
  14.  
  15. #ifndef    _INSERTMSG_
  16. #define _INSERTMSG_
  17.  
  18. #import <sys/types.h>
  19. #import <mach/message.h>
  20.  
  21. /*
  22.  6g_id's for messages used by vol driver.
  23.  */
  24. #define VOL_MSG_ID        0x355
  25. #define VOL_CHECK_MSG_ID    (VOL_MSG_ID+0)    /* new disk insert */
  26. #define VOL_PANEL_REQ        (VOL_MSG_ID+1)    /* panel request */
  27. #define VOL_PANEL_RESP        (VOL_MSG_ID+2)    /* panel response */
  28. #define VOL_PANEL_CANCEL    (VOL_MSG_ID+3)    /* panel cancel */
  29.  
  30. #define FORM_TYPE_LENGTH    64
  31.  
  32. /*
  33.  * New disk insertion notification (msg_id == VOL_CHECK_MSG_ID).
  34.  */
  35. struct insert_notify {
  36.     msg_header_t        in_header;
  37.     msg_type_t        in_vd_type;
  38.     int            in_vol_state;    /* IND_VS_xxx */
  39.     int            in_dev_desc;    /* IND_DD_xxx */
  40.     msg_type_t        in_flags_type;
  41.     int            in_flags;    /* IND_FLAGS_xxx */
  42.     msg_type_t        in_ft_type;
  43.     /*
  44.      * in_form_type contains the legal densities with with the 
  45.      * given media can be formatted, sprintf'd as decimal numbers
  46.      * of KBytes and separated by spaces. String is empty if disk
  47.      * if formatted.
  48.      */
  49.     char            in_form_type[FORM_TYPE_LENGTH];
  50.     /*
  51.      * dev_t or port follows...
  52.      */
  53. };
  54.  
  55. /*
  56.  * This struct will be used by fd, od, and SCSI drivers.
  57.  */
  58. #define OID_DEVSTR_LEN        6
  59.  
  60. struct of_insert_notify_dev {
  61.     struct insert_notify    oid_header;
  62.     msg_type_t        oid_dev_type;
  63.     dev_t            oid_bdev_t;    /* block device */
  64.     dev_t            oid_cdev_t;    /* raw device */
  65.     msg_type_t        oid_ds_type;
  66.     char            oid_dev_str[OID_DEVSTR_LEN];
  67.                         /* e.g., "fd0", "fd1" */
  68. };
  69.  
  70. /*
  71.  * For loadable drivers.
  72.  */
  73. struct of_insert_notify_port {
  74.     struct insert_notify    oip_header;
  75.     msg_type_t        oip_p_type;
  76.     port_t            oip_port;    /* describes other devices */
  77. };
  78.  
  79. /*
  80.  * in_vol_state values
  81.  */
  82. #define IND_VS_LABEL        0x00        /* volume contains valid Mach
  83.                          * label */
  84. #define IND_VS_FORMATTED    0x01        /* volume is formatted but
  85.                          * contains no label */
  86. #define IND_VS_UNFORMATTED    0x02        /* unformatted */
  87.  
  88. /*
  89.  * in_dev_desc values
  90.  */
  91. #define IND_DD_DEV        0x00        /* oin_dev_t contains a dev_t
  92.                          * for a device in /dev */
  93. #define IND_DD_PORT        0x01        /* oin_port contains a port
  94.                          * for a loadable server */
  95.  
  96. /*
  97.  * in_flags values
  98.  */
  99. #define IND_FLAGS_REMOVABLE    0x00000001    /* 1 = removable; 0 = fixed */
  100. #define IND_FLAGS_FIXED        0x00000000
  101. #define IND_FLAGS_WP        0x00000002    /* 1 = write protected */
  102.  
  103. /*
  104.  * Panel request (msg_id == VOL_PANEL_REQ)
  105.  */
  106. #define VP_STRING_LEN        40
  107.  
  108. struct vol_panel_req {
  109.     msg_header_t        pr_header;
  110.     msg_type_t        pr_int_desc;    /* describes following 7
  111.                          * fields */
  112.     int            pr_panel_type;    /* P7_xxx */
  113.     int            pr_resp_type;    /* PR_RT_xxx */
  114.     int             pr_tag;        /* identifies this panel */
  115.     /*
  116.      * meanings of these parameters vary per pr_panel_type.
  117.      */
  118.     int            pr_p1;
  119.     int            pr_p2;
  120.     int             pr_p3;
  121.     int            pr_p4;
  122.     msg_type_t        pr_string_desc;    /* describes following 2
  123.                          * fields */
  124.     char            pr_string1[VP_STRING_LEN];
  125.     char            pr_string2[VP_STRING_LEN];
  126. };
  127.  
  128. /*
  129.  * pr_panel_type values
  130.  */
  131. #define PR_PT_DISK_NUM        0    /* insert disk <p1> in 
  132.                      * <p2>(scsi|floppy|optical) drive <p3>
  133.                      */
  134. #define PR_PT_DISK_LABEL    1    /* insert disk <string1> in 
  135.                      * <p2>(scsi|floppy|optical) drive <p3>
  136.                      */
  137. #define PR_PT_DISK_NUM_W    2    /* wrong disk - insert disk <p1> in 
  138.                      * <p2>(scsi|floppy|optical) drive <p3>
  139.                      */
  140. #define PR_PT_DISK_LABEL_W    3    /* wrong disk - insert disk <string1>
  141.                      * in <p2>(scsi|floppy|optical) drive 
  142.                      * <p3>
  143.                      */
  144. #define PR_PT_SWAPDEV_FULL    4    /* swap device full */
  145. #define PR_PT_FILESYS_FULL    5    /* file system <string1> full */
  146. #define PR_RT_EJECT_REQ        6    /* eject disk in <p2> drive <p3> */
  147.  
  148. /*
  149.  * p2 values for PR_PT_DISK_NUM / PR_PT_DISK_LABEL
  150.  */
  151. #define PR_DRIVE_FLOPPY        0    /* floppy disk */
  152. #define PR_DRIVE_OPTICAL    1    /* OMD-1 (5.25") optical */
  153. #define PR_DRIVE_SCSI        2    /* removable SCSI disk */
  154.  
  155. /*
  156.  * pr_response_type values. Describes both format of panel and expected 
  157.  * response by Workspace Manager.
  158.  */
  159. #define PR_RT_NONE        0    /* no acknowledgement expected, no
  160.                      * cancel necesary */
  161. #define PR_RT_CANCEL        1    /* no ack; leave panel up until 
  162.                      * vol_panel_cancel message */
  163. #define PR_RT_ACK        2    /* just "OK" ack */
  164. #define PR_RT_INT        3    /* integer value expected */
  165.  
  166. /*
  167.  * Examples: 
  168.  *   'Insert floppy disk 3 in drive 0'
  169.  *    pr_panel_type      = PR_PT_DISK_NUM
  170.  *    p1          = 3
  171.  *    p2          = PR_DRIVE_FLOPPY
  172.  *    p3          = 0
  173.  *    pr_response_type = PR_RT_ACK (acknowledgement means "disk not 
  174.  *                   avaliable")
  175.  *
  176.  *   'Insert Optical disk "MyDisk" in drive 1'
  177.  *    pr_panel_type      = PR_PT_DISK_LABEL
  178.  *    string1         = "MyDisk"
  179.  *    p2          = PR_DRIVE_OPTICAL
  180.  *    p3          = 1
  181.  *    pr_response_type = PR_RT_ACK (acknowledgement means "disk not 
  182.  *                   avaliable")
  183.  *
  184.  *   'Swap Device Full'
  185.  *    pr_panel_type      = PR_PT_SWAPDEV_FULL
  186.  *    pr_response_type = PR_RT_ACK (acknowledgement means "OK to send more
  187.  *               of these messages") 
  188.  */
  189.  
  190. /*
  191.  * Panel response (msg_id == VOL_PANEL_RESP). Sent by Workspa8anager to 
  192.  * vol driver when use responds to panels with pr_response_type of PR_RT_ACK
  193.  * and PR_RT_INT.
  194.  */
  195. struct vol_panel_resp {
  196.     msg_header_t        ps_header;
  197.     msg_type_t        ps_int_desc;    /* describes following 2
  198.                          * fields */
  199.     int            ps_tag;        /* identifies panel request */
  200.     int            ps_value;    /* n/u for PR_RT_ACK requests;
  201.                          * integer for PR_RT_INT */
  202. };
  203.  
  204. /*
  205.  * Panel cancel request (msg_id == VOL_PANEL_CANCEL). Sent by vol driver to
  206.  * remove existing panel.
  207.  */
  208. struct vol_panel_cancel {
  209.     msg_header_t        pc_header;
  210.     msg_type_t        pc_int_desc;    /* describes following field */
  211.     int            pc_tag;        /* identifies panel request */
  212. };
  213.  
  214. #endif    _INSERTMSG_
  215.