home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / vxvm / root.2 / usr / include / volintf.h / volintf
Text File  |  1998-08-19  |  29KB  |  643 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. /* @(#)lib.vxvm:libvxvm/common/libvxvm/volintf.h    1.1 1/24/97 21:49:59 - lib.vxvm:libvxvm/common/libvxvm/volintf.h */
  12. #ident    "@(#)lib.vxvm:libvxvm/common/libvxvm/volintf.h    1.1"
  13.  
  14. /*
  15.  * Copyright(C)1996 VERITAS Software Corporation.  ALL RIGHTS RESERVED.
  16.  * UNPUBLISHED -- RIGHTS RESERVED UNDER THE COPYRIGHT
  17.  * LAWS OF THE UNITED STATES.  USE OF A COPYRIGHT NOTICE
  18.  * IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
  19.  * OR DISCLOSURE.
  20.  * 
  21.  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND
  22.  * TRADE SECRETS OF VERITAS SOFTWARE.  USE, DISCLOSURE,
  23.  * OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
  24.  * EXPRESS WRITTEN PERMISSION OF VERITAS SOFTWARE.
  25.  * 
  26.  *               RESTRICTED RIGHTS LEGEND
  27.  * USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT IS
  28.  * SUBJECT TO RESTRICTIONS AS SET FORTH IN SUBPARAGRAPH
  29.  * (C) (1) (ii) OF THE RIGHTS IN TECHNICAL DATA AND
  30.  * COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013.
  31.  *               VERITAS SOFTWARE
  32.  * 1600 PLYMOUTH STREET, MOUNTAIN VIEW, CA 94043
  33.  */
  34.  
  35. #ifndef _VXVM_VOLINTF_H
  36. #define _VXVM_VOLINTF_H
  37.  
  38. /*
  39.  * volintf.h - interface structures for utilities and vold
  40.  */
  41.  
  42. /*
  43.  * vol_r_pol    - volume read policies (round-robin, preferred-plex)
  44.  * vol_kstate    - volume enabled state (disabled, detached, enabled)
  45.  * plex_kstate    - plex enabled state (must exactly match volume)
  46.  * vol_except    - volume exception policies
  47.  * plex_layout    - layout within a plex (striped, concatenated, raid5)
  48.  */
  49.  
  50. enum vol_r_pol {            /* type of volume read policy */
  51.     MIN_VOL_R_POL,            /* sentinel value, must be first */
  52.     V_ROUND,            /* round robin */
  53.     V_PREFER,            /* use a preferred plex */
  54.     V_R_POL_SELECT,            /* select based on plex layouts */
  55.     V_RAID,                /* use single RAID plex */
  56.     MAX_VOL_R_POL            /* sentinel value, must be last */
  57. };
  58. enum vol_kstate {            /* volume kernel state */
  59.     MIN_VOL_KSTATE,            /* sentinel value, must be first */
  60.     V_DISABLED,            /* volume is offline */
  61.     V_DETACHED,            /* volume is detached */
  62.     V_ENABLED,            /* volume is enabled */
  63.     MAX_VOL_KSTATE            /* sentinel value, must be last */
  64. };
  65. enum vol_except {            /* what to do in case of an error */
  66.     MIN_VOL_EXCEPT,            /* sentinel value, must be first */
  67.     V_NO_OP,            /* no additional action required */
  68.     V_FAIL_OP,            /* fail the operation */
  69.     V_DET_PL,            /* just detach plex */
  70.     V_FAIL_DET_PL,            /* fail operation and detach plex */
  71.     V_DET_VOL,            /* just detach volume */
  72.     V_FAIL_DET_VOL,            /* fail operation and detach volume */
  73.     V_GEN_DET,            /* detach plex, or volume if 
  74.                        no complete plexes would remain */
  75.     V_GEN_DET_SPARSE,        /* detach plex, or all incomplete
  76.                        plexes if no complete plexes would
  77.                        remain*/
  78.     V_GEN_FAIL,            /* detach plex and volume and fail */
  79.     V_GEN_DET2,            /* detach plex, or volume if no two
  80.                        complete plexes would remain */
  81.     MAX_VOL_EXCEPT            /* sentinel value, must be last */
  82. };
  83. enum plex_layout {        /* type of plex subdisk order */
  84.     MIN_PLEX_LAYOUT,    /* sentinel value, must be first */
  85.     PL_STRIPE,        /* stripe subdisks */
  86.     PL_CONCAT,        /* concatenate subdisks */
  87.     PL_RAID,        /* RAID layout */
  88.     MAX_PLEX_LAYOUT        /* sentinel value, must be last */
  89. };
  90.  
  91. /* plex_kstate type is provided for source-level backward compatibility
  92.  * it must exactly match vol_kstate */
  93. enum plex_kstate {    /* plex kernel state */
  94.     MIN_PLEX_KSTATE,    /* sentinel value, must be first */
  95.     PL_DISABLED,        /* plex is offline */
  96.     PL_DETACHED,        /* plex is detached */
  97.     PL_ENABLED,        /* plex is enabled */
  98.     MAX_PLEX_KSTATE        /* sentinel value, must be last */
  99. };
  100.  
  101. /*
  102.  * configuration id numbers
  103.  */
  104. struct vol_id {
  105.     long    config_id;        /* kept for source compatibility */
  106.     time_t    config_epoch;        /* kept for source compatibility */
  107.     volseqno_t config_tid;        /* last committed transaction ID */
  108. };
  109.  
  110. /*
  111.  * volume manager database summary
  112.  */
  113.  
  114. struct vol_summary {
  115.     size_t    vs_v_cnt;        /* number of volumes */
  116.     size_t    vs_pl_cnt;        /* number of plexes */
  117.     size_t    vs_sd_cnt;        /* number of subdisks */
  118.     size_t    vs_pl_n_cnt;        /* number of non-associated plexes */
  119.     size_t    vs_sd_n_cnt;        /* number of non-associated subdisks */
  120.     size_t    vs_dm_cnt;        /* number of disk media records */
  121.     size_t    vs_da_cnt;        /* number of disk access records */
  122.     size_t    vs_reserved_1;        /* reserved for future use */
  123.     size_t    vs_reserved_2;        /* reserved for future use */
  124. };
  125.  
  126. /*
  127.  * Fields marked with RO are strictly read-only fields.  Attempts to set
  128.  * these fields will be ignored.
  129.  *
  130.  * Fields marked with CO are interpreted when the record is created.
  131.  * Attempts to change these fields after record creation will be
  132.  * ignored.
  133.  */
  134.  
  135. /* volume structure */
  136. struct v_tmp {            /* volume items that go away on reboot */
  137.     char    v_tutil[UTIL_NUM][UTIL_SZ];    /* 'in kernel' utility field */
  138.     ulong_t    v_tflag;            /* temp flags for volume */
  139. /*RO*/    long    v_rec_lock;            /* 1 => record locked */
  140. /*RO*/    long    v_data_lock;            /* 1 => volume data locked */
  141. /*RO*/    long    v_lasterr;            /* VxVM 1.2 lasterr field */
  142.     enum vol_kstate v_kstate;        /* relation to file space */
  143.     enum vol_except v_r_all;        /* if all plex reads fail */
  144.     enum vol_except v_r_some;        /* if some plex reads fail */
  145.     enum vol_except v_w_all;        /* if all plex writes fail */
  146.     enum vol_except v_w_some;        /* if some plex writes fail */
  147. /*RO*/    enum vol_r_pol v_current_read_pol;    /* current read policy */
  148. /*RO*/    dev_t    v_node_bdev;            /* block dev for vol device */
  149. /*RO*/    dev_t    v_node_cdev;            /* char dev for vol device */
  150. /*RO*/    size_t    v_iosize;            /* minimum size for raw I/Os */
  151.     voff_t    v_recover_offset;        /* volume recovery offset */
  152.     long    v_log_serial_lo;        /* log serial number/low part */
  153.     long    v_log_serial_hi;        /* log serial number/hi part */
  154. /*RO*/    volseqno_t v_lasterr_tid;        /* config tid at last error */
  155. };
  156. struct v_perm {            /* volume items that exist after reboot */
  157. /*RO*/    char    v_name[NAME_SZ];        /* volume name */
  158.     char    v_putil[UTIL_NUM][UTIL_SZ];    /* 'on disk' utility field */
  159.     char    v_comment[COMMENT_SZ];        /* comment field */
  160.     char    v_state[STATE_SZ];        /* utility state of volume */
  161. /*RO*/    char    v_use_type[NAME_SZ];        /* volume usage type name */
  162.     char    v_fstype[FSTYPE_SZ];        /* guess of volumes fstype */
  163.     char    v_pref_name[NAME_SZ];        /* plex name if V_PREPER */
  164.     char    v_start_opts[V_STOPTS_SZ];    /* volume start options */
  165. /*RO*/    volrid_t v_rid;                /* unique identifier */
  166.     volrid_t v_pref_plex_rid;        /* preferred plex record ID */
  167. /*RO*/    volseqno_t v_update_tid;        /* trans id of last update */
  168. /*RO*/    volseqno_t v_detach_tid;        /* trans id of kernel detach */
  169.     enum vol_r_pol v_read_pol;        /* method of plex selection */
  170.     ulong_t    v_pflag;            /* perm flags for volume */
  171. /*CO*/    minor_t    v_minor;            /* minor number in disk group */
  172.     uid_t    v_uid;                /* owner of /dev/vol/name */
  173.     gid_t    v_gid;                /* group of /dev/vol/name */
  174.     mode_t    v_mode;                /* mode of /dev/vol/name */
  175. /*RO*/    long    v_pl_num;            /* associated plex count */
  176.     voff_t    v_len;                /* byte length of volume */
  177.     voff_t    v_log_len;            /* length of log area */
  178.     volrid_t v_log_rid;            /* rid of log object */
  179.     voff_t    v_recover_checkpoint;        /* ckpoint for recover_offset */
  180. /*RO*/    long    v_sd_num;            /* # subvolumes on volume */
  181.     long    v_recover_seqno;        /* ORM recovery seqno */
  182. };
  183.  
  184. struct volrec {
  185.     struct v_tmp    v_tmp;        /* items that go away on reboot */
  186.     char    v_tspare[16];        /* room for expansion */
  187.     struct v_perm    v_perm;        /* items that remain after reboot */
  188.     char    v_pspare[16];        /* room for expansion */
  189. };
  190.  
  191. /* VxVM 1.2 source backward compatibility */
  192. #define v_bdev    v_node_bdev
  193. #define v_cdev    v_node_cdev
  194.  
  195. /* non-persistent volume flags, stored in v_tmp.v_tflag: */
  196. #define V_TFLAG_MASK        0x000007    /* mask for volume tflag */
  197. #define V_TFLAG_READ        0x000001    /* volume is shared readable */
  198. #define V_TFLAG_WRITE        0x000002    /* volume is shared writable */
  199. #define V_TFLAG_RECOVER     0x000004    /* recover volume on reads */
  200. #define V_TFLAG_RMASK        0x01ff00    /* read-only volume tflag bits */
  201. #define V_TFLAG_KRECOVER    0x000100    /* kernel still in recovery mode */
  202. #define V_TFLAG_INVALID        0x000200    /* volume is unusable */
  203. #define V_TFLAG_LOGGING     0x000400    /* volume requires logging */
  204. #define V_TFLAG_DIRTY        0x000800    /* volume has been written */
  205. #define V_TFLAG_BUSY        0x001000    /* volume is part of open vol device */
  206. #define V_TFLAG_DEGRADED    0x002000    /* RAID 5 degraded mode */
  207. #define V_TFLAG_UNUSABLE    0x004000    /* RAID 5 is unusable */
  208. #define V_TFLAG_HAS_LOGS    0x008000    /* volume has log subdisks or log
  209.                      * plexes */
  210. #define V_TFLAG_APP_DIRTY   0x010000    /* volume dirtied in APP_RECOV mode */
  211. #define V_TFLAG_DEVOPEN        VK_OPEN    /* device node is open on object */
  212.  
  213. /* the VK_OPEN flag is kept for backward compatibility with VxVM 1.2: */
  214. #define VK_OPEN          0x01000000    /* volume, plex, or subdisk is open */
  215. #define VOL_TFLAG_KMASK      0xff000000    /* mask of bits reserved for kernel */
  216.  
  217. /* non-persistent volume flags, stored in v_tmp.v_tflag: */
  218. #define V_PFLAG_MASK        0x001fff    /* mask for volume pflag */
  219. #define V_PFLAG_RMASK        0x000000    /* read-only volume pflag bits */
  220. #define V_PFLAG_WRITEBACK   0x000001    /* writeback error enabled */
  221. #define V_PFLAG_WRITECOPY   0x000002    /* log block numbers being changed */
  222. #define V_PFLAG_ACTIVE        0x000004    /* kernel logged activity on volume */
  223. #define V_PFLAG_FORCEMINOR  0x000008    /* force use of specified minor
  224.                      * used for root and swap vols */
  225. #define V_PFLAG_LOGTYPE        0x0000f0    /* mask for log type */
  226. #define V_PFLAG_LOGUNDEF    0x000000    /* no logging on volume, can default */
  227. #define V_PFLAG_LOGNONE        0x000010    /* no logging on volume */
  228. #define V_PFLAG_LOGDRL      0x000020    /* dirty region logging on volume */
  229. #define V_PFLAG_BADLOG        0x000100    /* volume activity log failed */
  230. #define V_PFLAG_SPECIFY_WRITECOPY 0x200    /* set if writecopy was specified
  231.                      * explicitly, off to use default */
  232. #define V_PFLAG_KDETACH        0x000400    /* kernel detached volume */
  233. #define V_PFLAG_STORAGE        0x000800    /* can create subvolumes on volume */
  234. #define V_PFLAG_APP_RECOVER 0x001000    /* requres application recovery */
  235.  
  236. /*
  237.  * minimum log length for RAID-5, measured in full stripes
  238.  * NOTE: This must match VOLKRA_LOG_MIN in vxvm/voldobject.h.
  239.  */
  240. #define V_RAID_LOG_MIN        3        /* must have at least 3 stripes */
  241.  
  242.  
  243. /* volume structure change mask flags: */
  244. #define EDIT_V_MASK          0x07ffffff
  245. #define EDIT_V_TUTIL          0x00000001    /* v_tutil */
  246. #define EDIT_V_KSTATE          0x00000002    /* v_kstate */
  247. #define EDIT_V_R_ALL          0x00000004    /* v_r_all */
  248. #define EDIT_V_R_SOME          0x00000008    /* v_r_some */
  249. #define EDIT_V_W_ALL          0x00000010    /* v_w_all */
  250. #define EDIT_V_W_SOME          0x00000020    /* v_w_some */
  251. #define EDIT_V_TFLAG          0x00000040    /* v_tflag */
  252. #define EDIT_V_FSTYPE          0x00000080    /* v_fstype */
  253. #define EDIT_V_COMMENT          0x00000100    /* v_comment */
  254. #define EDIT_V_PUTIL          0x00000200    /* v_putil */
  255. #define EDIT_V_STATE          0x00000400    /* v_state */
  256. #define EDIT_V_PFLAG          0x00000800    /* v_pflag */
  257. #define EDIT_V_PREFPLEX          0x00001000    /* v_pref_name */
  258. #define EDIT_V_READ_POL          0x00002000    /* v_read_pol */
  259. #define EDIT_V_UID          0x00004000    /* v_uid */
  260. #define EDIT_V_GID          0x00008000    /* v_gid */
  261. #define EDIT_V_MODE          0x00010000    /* v_mode */
  262. #define EDIT_V_LEN          0x00020000    /* v_len */
  263. #define EDIT_V_USE_TYPE          0x00040000    /* v_use_type */
  264. #define EDIT_V_LOG_LEN          0x00080000    /* v_log_len */
  265. #define EDIT_V_LOG_SERIAL      0x00100000    /* v_log_serial */
  266. #define EDIT_V_START_OPTS      0x00200000    /* v_start_opts */
  267. #define EDIT_V_PREFPLEX_RID      0x00400000    /* v_pref_plex_rid */
  268. #define EDIT_V_RECOVER_OFFSET      0x00800000    /* v_rwback_offset */
  269. #define EDIT_V_MINOR          0x01000000    /* v_minor */
  270. #define EDIT_V_RECOVER_CHECKPOINT 0x02000000    /* v_recover_checkpoint */
  271. #define EDIT_V_RECOVER_SEQNO      0x04000000    /* v_recover_seqno */
  272.  
  273. /* 
  274.  * plex - one or more subdisks, replication of volume data
  275.  */
  276.  
  277. /* plex structure */
  278. struct pl_tmp {            /* plex items that go away on reboot */
  279.     char    pl_tutil[UTIL_NUM][UTIL_SZ];    /* 'in mem' utility field */
  280.     ulong_t    pl_tflag;            /* flag, see PL_TFLAG_XXX */
  281. /*RO*/    long    pl_lock;            /* 1 => record locked */
  282. /*RO*/    long    pl_lasterr;            /* VxVM 1.2 lasterr field */
  283.     enum vol_kstate pl_kstate;        /* relation to volume */
  284. /*RO*/    long    pl_compact;            /* 1 => plex has no holes */
  285. /*RO*/    minor_t    pl_minor;            /* minor number of plex dev */
  286. /*RO*/    voff_t    pl_len;                /* byte length of plex */
  287. /*RO*/    voff_t    pl_contig_len;            /* contiguous len from start */
  288. /*RO*/    dev_t    pl_dev;                /* plex device number */
  289. /*RO*/    volseqno_t pl_lasterr_tid;        /* config tid at last error */
  290. };
  291. struct pl_perm {        /* plex items that exist after reboot */
  292. /*RO*/    char    pl_name[NAME_SZ];        /* plex name */
  293.     char    pl_putil[UTIL_NUM][UTIL_SZ];    /* 'on disk' utility field */
  294.     char    pl_comment[COMMENT_SZ];        /* comment field */
  295. /*RO*/    char    pl_v_name[NAME_SZ];        /* volume name or \0 */
  296.     char    pl_state[STATE_SZ];        /* utility state of plex */
  297. /*RO*/    volrid_t pl_rid;            /* unique identifier */
  298. /*RO*/    volrid_t pl_vol_rid;            /* record ID for volume */
  299. /*RO*/    volrid_t pl_log_sd_rid;            /* record ID of log subdisk */
  300. /*RO*/    volseqno_t pl_update_tid;        /* trans id of last update */
  301. /*RO*/    volseqno_t pl_detach_tid;        /* trans id of kernel detach */
  302. /*CO*/    enum plex_layout pl_layout;        /* layout of subdisks */
  303. /*CO*/    voff_t    pl_st_width;            /* stripe element width if
  304.                          * PL_STRIPE or PL_RAID */
  305.     ulong_t    pl_pflag;            /* flag, see PL_FLAG_XXX */
  306. /*RO*/    long    pl_sd_num;            /* number of associated sds */
  307.     char    pl_log_sd[NAME_SZ];        /* name of log subdisk */
  308. /*CO*/    long    pl_ncolumn;            /* number of stripe columns */
  309. };
  310.  
  311. struct plexrec {
  312.     struct pl_tmp pl_tmp;        /* items that go away on reboot */
  313.     char    pl_tspare[16];        /* room for expansion */
  314.     struct pl_perm pl_perm;        /* items that remain after reboot */
  315.     char    pl_pspare[16];        /* room for expansion */
  316. };
  317.  
  318. /* non-persistent plex flags, stored in pl_tmp.pl_tflag: */
  319. #define PL_TFLAG_MASK        0x000b    /* mask for plex tflag */
  320. #define PL_TFLAG_RMASK        0x3f04    /* mask for plex read-only tflag bits */
  321. #define PL_TFLAG_READ        0x0001    /* 1=>read ops are allowed */
  322. #define PL_TFLAG_WRITE        0x0002    /* 1=>write ops are allowed */
  323. #define PL_TFLAG_LOG        0x0004    /* plex has enabled log subdisk */
  324. #define PL_TFLAG_COMPLETE   0x0008    /* plex is complete w.r.t. volume */
  325. #define PL_TFLAG_VOLATILE   0x0100    /* an associated disk is volatile */
  326. #define PL_TFLAG_REMOVED    0x0200    /* a disk device for plex is removed */
  327. #define PL_TFLAG_NODAREC    0x0400    /* expected physical disk not found */
  328. #define PL_TFLAG_DIRTY        0x0800    /* plex has been written */
  329. #define PL_TFLAG_BUSY        0x1000    /* plex is part of open vol device */
  330. #define PL_TFLAG_DEVOPEN    VK_OPEN    /* device node is open on object */
  331. #define PL_TFLAG_RAIDLOG    0x2000    /* plex is a RAID log mirror */
  332.  
  333. /* persistent plex flags, stored in pl_perm.pl_pflag: */
  334. #define PL_PFLAG_MASK        0x0007    /* mask for plex pflag */
  335. #define PL_PFLAG_RMASK        0x0000    /* mask for plex read-only pflag bits */
  336. #define PL_PFLAG_NOERROR    0x0001    /* 0=>participate in errors,
  337.                      * 1=>don't participate */
  338. #define PL_PFLAG_STALE        0x0002    /* plex needs recovery */
  339. #define PL_PFLAG_KDETACH    0x0004    /* kernel logged a detach */
  340.  
  341. /* plex structure change mask flags: */
  342. #define EDIT_PL_MASK        0x000003ff
  343. #define EDIT_PL_TUTIL        0x00000001    /* pl_tutil */
  344. #define EDIT_PL_TFLAG        0x00000002    /* pl_tflag */
  345. #define EDIT_PL_KSTATE        0x00000004    /* pl_kstate */
  346. #define EDIT_PL_COMMENT        0x00000008    /* pl_comment */
  347. #define EDIT_PL_PUTIL        0x00000010    /* pl_putil */
  348. #define EDIT_PL_PFLAG        0x00000020    /* pl_pflag */
  349. #define EDIT_PL_LAYOUT        0x00000040    /* pl_layout */
  350. #define EDIT_PL_ST_WIDTH    0x00000080    /* pl_st_width */
  351. #define EDIT_PL_STATE        0x00000100    /* pl_state */
  352. #define EDIT_PL_NCOLUMN        0x00000200    /* pl_ncolumn */
  353.  
  354. /* 
  355.  * subdisk - physical component of a plex
  356.  */
  357.  
  358. /* subdisk structure */
  359. struct sd_tmp {            /* subdisk items that go away on reboot */
  360.     char    sd_tutil[UTIL_NUM][UTIL_SZ];    /* 'in mem' utility field */
  361. /*CO*/    char    sd_da_name[NAME_SZ];        /* disk access name */
  362. /*CO*/    char    sd_dm_name[NAME_SZ];        /* disk media name */
  363. /*RO*/    char    sd_device_tag[NAME_SZ];        /* device tag */
  364.     ulong_t    sd_tflag;            /* temp flags for subdisk */
  365. /*RO*/    long    sd_lock;            /* 1 => record locked */
  366. /*RO*/    dev_t    sd_dev;                /* block device of disk */
  367. /*RO*/    volseqno_t sd_lasterr_tid;        /* config tid of last error */
  368. /*RO*/    dev_t    sd_node_bdev;            /* block dev of vol device */
  369. /*RO*/    dev_t    sd_node_cdev;            /* char dev of vol device */
  370. };
  371. struct sd_perm {        /* subdisk items that exist after reboot */
  372. /*RO*/    char    sd_name[NAME_SZ];        /* subdisk record name */
  373. /*CO*/    char    sd_path[SD_PATH_SZ];        /* subdisk block device path */
  374. /*RO*/    char    sd_pl_name[NAME_SZ];        /* associated plex name or \0 */
  375.     char    sd_comment[COMMENT_SZ];        /* comment field */
  376.     char    sd_putil[UTIL_NUM][UTIL_SZ];    /* 'on disk' utility field */
  377. /*RO*/    volrid_t sd_rid;            /* unique identifier */
  378. /*RO*/    volrid_t sd_plex_rid;            /* record ID of plex */
  379. /*CO*/    volrid_t sd_dm_rid;            /* disk media or volume rid */
  380. /*RO*/    volseqno_t sd_update_tid;        /* trans id of last update */
  381.     ulong_t    sd_pflag;            /* flag, see SD_FLAG_XXX */
  382. /*RO*/    voff_t    sd_dev_offset;            /* offset within bdev */
  383. /*RO*/    voff_t    sd_pl_offset;            /* offset of subdisk in plex */
  384. /*RO*/    voff_t    sd_dm_offset;            /* offset relative to disk */
  385.     voff_t    sd_len;                /* byte length of subdisk */
  386.     minor_t    sd_minor;            /* minor number of vol device */
  387. /*RO*/    volseqno_t sd_detach_tid;        /* trans id of kernel detach */
  388. /*RO*/    long    sd_column;            /* stripe column of subdisk */
  389. };
  390.  
  391. struct sdrec {
  392.     struct sd_tmp sd_tmp;        /* items that go away on reboot */
  393.     char    sd_tspare[16];        /* room for expansion */
  394.     struct sd_perm sd_perm;        /* items that remain after reboot */
  395.     char    sd_pspare[16];        /* room for expansion */
  396. };
  397.  
  398. /* non-persistent subdisk flags, stored in sd_tmp.sd_tflag: */
  399. #define SD_TFLAG_MASK        0x0003    /* mask for subdisk tflag */
  400. #define SD_TFLAG_DETACH        0x0001    /* detach subdisk from plex or RAID */
  401. #define SD_TFLAG_WRITEONLY  0x0002    /* subdisk is attached write-only */
  402. #define SD_TFLAG_RMASK        0x3f00    /* mask for sd read-only tflag bits */
  403. #define SD_TFLAG_IS_LOG        0x0100    /* subdisk is used as a log area */
  404. #define SD_TFLAG_DIRTY        0x0200    /* subdisk has been written */
  405. #define SD_TFLAG_DEVOPEN    0x0400    /* device node is open on object */
  406. #define SD_TFLAG_BUSY        VK_OPEN    /* subdisk is part of open vol device */
  407. #define SD_TFLAG_ENABLED    0x0800    /* subdisk is enabled (has a disk) */
  408. #define SD_TFLAG_NODAREC    0x1000    /* no physical disk backs the subdisk */
  409. #define SD_TFLAG_REMOVED    0x2000    /* physical disk was removed */
  410.  
  411. /* persistent subdisk flags, stored in sd_perm.sd_pflag: */
  412. #define SD_PFLAG_MASK        0x003f    /* mask for subdisk pflag */
  413. #define SD_PFLAG_MKDEVICE   0x0001    /* create device node for subdisk */
  414. #define SD_PFLAG_FORCEMINOR 0x0002    /* force minor field of subdisk */
  415. #define SD_PFLAG_SUBVOLUME  0x0004    /* subdisk resides on a volume */
  416. #define SD_PFLAG_STALE        0x0008    /* subdisk contents require recovery */
  417. #define SD_PFLAG_KDETACH    0x0010    /* kernel detached subdisk */
  418. #define SD_PFLAG_RELOCATE   0x0020    /* subdisk failure during plex attach */
  419. #ifdef SOLARIS
  420. #define SD_PFLAG_RMASK        0x0300    /* mask for read-only sd pflag bits */
  421. #else    /* not SOLARIS */
  422. #define SD_PFLAG_RMASK        0x0100    /* mask for read-only sd pflag bits */
  423. #endif    /* SOLARIS */
  424. #define SD_PFLAG_VOLATILE   0x0100    /* sd contents do not survive reboot */
  425. #ifdef SOLARIS
  426. #define SD_PFLAG_BLOCKZERO  0x0200    /* block-zero overlap subdisk */
  427. #endif    /* SOLARIS */
  428.  
  429. /*
  430.  * NOTE: The VOLATILE pflag flag is kept in the pflag field purely for
  431.  *     historical reasons.  This flag is no longer persistent, but is
  432.  *     a property of the physical disk represented by the disk access
  433.  *     record (which is dynamically bound to the subdisk).
  434.  */
  435.  
  436. /* subdisk structure change mask flags: */
  437. #define EDIT_SD_MASK      0x0000007f
  438. #define EDIT_SD_TUTIL      0x00000001    /* sd_tmp.sd_tutil */
  439. #define EDIT_SD_TFLAG      0x00000002    /* sd_tmp.sd_tflag */
  440. #define EDIT_SD_COMMENT      0x00000004    /* sd_perm.sd_comment */
  441. #define EDIT_SD_PUTIL      0x00000008    /* sd_perm.sd_putil */
  442. #define EDIT_SD_LEN      0x00000010    /* sd_perm.sd_len */
  443. #define EDIT_SD_PFLAG      0x00000020    /* sd_perm.sd_pflag */
  444. #define EDIT_SD_MINOR      0x00000040    /* sd_perm.sd_minor */
  445.  
  446. /*
  447.  * dmrec - disk media interface structure
  448.  */
  449.  
  450. struct dmrec {
  451.  
  452.     /* temporary part */
  453.  
  454.     char    dm_tutil[UTIL_NUM][UTIL_SZ];    /* non-persistent util fields */
  455. /*RO*/    char    dm_da_name[NAME_SZ];        /* disk access name */
  456. /*RO*/    char    dm_device_tag[NAME_SZ];        /* component of this device */
  457. /*RO*/    char    dm_da_type[DA_TYPE_SZ];        /* type from diskdev record */
  458. /*RO*/    char    dm_pub_bpath[DK_PATH_SZ];    /* path of public block dev */
  459. /*RO*/    char    dm_priv_bpath[DK_PATH_SZ];    /* path of private block dev */
  460. /*RO*/    char    dm_pub_cpath[DK_PATH_SZ];    /* path of public raw dev */
  461. /*RO*/    char    dm_priv_cpath[DK_PATH_SZ];    /* path of private raw dev */
  462.     ulong_t    dm_tflag;            /* temp flags for disk */
  463. /*RO*/    long    dm_lock;            /* 1 => record locked */
  464. /*RO*/    dev_t    dm_pub_bdev;            /* dev of public partition */
  465. /*RO*/    dev_t    dm_priv_bdev;            /* dev of private partition */
  466. /*RO*/    voff_t    dm_pub_offset;            /* offset of public region */
  467. /*RO*/    voff_t    dm_priv_offset;            /* offset of private region */
  468. /*RO*/    voff_t    dm_pub_len;            /* length of public partition */
  469. /*RO*/    voff_t    dm_priv_len;            /* len of private partition */
  470. /*RO*/    size_t    dm_atomic_iosize;        /* minimum I/O size */
  471. /*RO*/    long    dm_sd_num;            /* cnt of subdisks using disk */
  472.     char    dm_tspare[32];            /* room for expansion */
  473.  
  474.     /* persistent part */
  475.  
  476. /*RO*/    char    dm_name[NAME_SZ];        /* disk name for disk group */
  477.     char    dm_comment[COMMENT_SZ];        /* comment field */
  478.     char    dm_putil[UTIL_NUM][UTIL_SZ];    /* persistent util fields */
  479. /*RO*/    char    dm_diskid[VOL_UUID_SZ];        /* unique ID for disk */
  480. /*RO*/    char    dm_last_da_name[NAME_SZ];    /* last associated DA record */
  481. /*RO*/    volrid_t dm_rid;            /* record ID */
  482. /*RO*/    volseqno_t dm_update_tid;        /* trans id of last update */
  483.     ulong_t    dm_pflag;            /* persistent flags */
  484.     char    dm_pspare[32];            /* room for expansion */
  485. };
  486.  
  487. /* non-persistent disk media record flags, stored in dm_tflag: */
  488. #define    DM_TFLAG_MASK        0x0000    /* mask for disk tflag */
  489. #define    DM_TFLAG_RMASK        0x1f00    /* mask of read-only flags */
  490. #define DM_TFLAG_PRIVATE    0x0100    /* disk has a private region */
  491. #define DM_TFLAG_COMPONENT    0x0200    /* component of another device */
  492. #define DM_TFLAG_VOLATILE    0x0400    /* disk contents don't survive reboot */
  493. #define DM_TFLAG_NODAREC    0x0800    /* disk not found on reboot */
  494. #define DM_TFLAG_AUTOCONFIG    0x1000    /* da record was auto-configured */
  495. #define DM_TFLAG_BUSY        VK_OPEN    /* volume on disk is open */
  496.  
  497. /* persistent disk media record flags, stored in dm_pflag: */
  498. #define DM_PFLAG_MASK      0x00000007    /* mask of modifiable pflag bits */
  499. #define DM_PFLAG_RESERVE  0x00000001    /* disk is reserved for special uses */
  500. #define DM_PFLAG_SPARE      0x00000002    /* disk is a spare for disk group */
  501. #define DM_PFLAG_FAILING  0x00000004    /* disk has had subdisk failure */
  502. #define DM_PFLAG_RMASK      0x00000100    /* mask of read-only pflag bits */
  503. #define DM_PFLAG_REMOVED  0x00000100    /* disk is currently inaccessible */
  504.  
  505. /* disk media structure change mask flags: */
  506. #define EDIT_DM_MASK      0x0000001f
  507. #define EDIT_DM_TUTIL      0x00000001    /* dm_tutil */
  508. #define EDIT_DM_TFLAG      0x00000002    /* dm_tflag */
  509. #define EDIT_DM_COMMENT      0x00000004    /* dm_comment */
  510. #define EDIT_DM_PUTIL      0x00000008    /* dm_putil */
  511. #define EDIT_DM_PFLAG      0x00000010    /* dm_pflag */
  512.  
  513. /*
  514.  * dgrec - disk group interface structure
  515.  */
  516.  
  517. struct dgrec {
  518.  
  519.     /* temporary part */
  520.  
  521.     char    dg_tutil[UTIL_NUM][UTIL_SZ];    /* non-persistent util fields */
  522. /*CO*/    char    dg_name[NAME_SZ];        /* import name (maybe alias) */
  523.     ulong_t    dg_tflag;            /* non-persistent flags */
  524. /*RO*/    long    dg_lock;            /* 1 => record locked */
  525. /*RO*/    volrid_t dg_import_id;            /* non-persistent import ID */
  526.     char    dg_tspare[32];            /* room for expansion */
  527.  
  528.     /* persistent part */
  529.  
  530. /*RO*/    char    dg_real_name[NAME_SZ];        /* name stored in disk group */
  531.     char    dg_comment[COMMENT_SZ];        /* comment field */
  532.     char    dg_putil[UTIL_NUM][UTIL_SZ];    /* persistent utility fields */
  533. /*RO*/    char    dg_dgid[VOL_UUID_SZ];        /* unique ID for disk group */
  534. /*RO*/    volrid_t dg_rid;            /* record ID in disk group */
  535. /*RO*/    volseqno_t dg_update_tid;        /* trans id of last update */
  536.     ulong_t    dg_pflag;            /* persistent flags */
  537.     long    dg_nconfig;            /* #config copies to enable */
  538.     long    dg_nlog;            /* #log copies to enable */
  539.     minor_t dg_base_minor;            /* base minor# for devices */
  540.     char    dg_pspare[20];            /* room for expansion */
  541. };
  542.  
  543. /* non-persistent disk group flags, stored in dg_tflag: */
  544. #define DG_TFLAG_MASK      0x000000    /* mask for disk group tflag */
  545. #define DG_TFLAG_RMASK      0x000300    /* read-only disk group tflag bits */
  546. #define DG_TFLAG_DISABLED 0x000100    /* disk group is disabled */
  547. #define DG_TFLAG_NO_AUTOIMPORT 0x200    /* do not auto-reimport disk group */
  548.  
  549. /* persistent disk group flags, stored in dg_pflag: */
  550. #define DG_PFLAG_MASK      0x000000    /* mask for disk pflag */
  551. #define DG_PFLAG_RMASK      0x000000    /* read-only disk group tflag bits */
  552.  
  553. /* disk group structure change mask flags: */
  554. #define EDIT_DG_MASK      0x000000ff
  555. #define EDIT_DG_TUTIL      0x00000001    /* dg_tutil */
  556. #define EDIT_DG_TFLAG      0x00000002    /* dg_tflag */
  557. #define EDIT_DG_COMMENT      0x00000004    /* dg_comment */
  558. #define EDIT_DG_PUTIL      0x00000008    /* dg_putil */
  559. #define EDIT_DG_PFLAG      0x00000010    /* dg_pflag */
  560. #define EDIT_DG_NCONFIG      0x00000020    /* dg_nconfig */
  561. #define EDIT_DG_NLOG      0x00000040    /* dg_nlog */
  562. #define EDIT_DG_BASE_MINOR 0x0000080    /* dg_base_minor */
  563.  
  564. /*
  565.  * Default number of enabled config and log copies per disk group.
  566.  *
  567.  * A value of 0 for the default config and log copy counts indicates
  568.  * that the "volume manager knows best" policy should be used by
  569.  * default to determine which copies to enable.
  570.  */
  571. #define DFLT_DG_NCONFIG   0        /* default #config copies to enable */
  572. #define DFLT_DG_NLOG      0        /* default #log copies to enable */
  573.  
  574. /*
  575.  * darec - disk access interface structure
  576.  */
  577.  
  578. struct darec {
  579.  
  580.     /* temporary part */
  581.  
  582. /*RO*/    char    da_dm_name[NAME_SZ];        /* media name in disk group */
  583. /*RO*/    char    da_dg_name[NAME_SZ];        /* disk group name, if any */
  584. /*RO*/    char    da_device_tag[NAME_SZ];        /* part of this device */
  585. /*RO*/    char    da_pub_bpath[DK_PATH_SZ];    /* path of public block dev */
  586. /*RO*/    char    da_priv_bpath[DK_PATH_SZ];    /* path of private block dev */
  587. /*RO*/    char    da_pub_cpath[DK_PATH_SZ];    /* path of public raw dev */
  588. /*RO*/    char    da_priv_cpath[DK_PATH_SZ];    /* path of private raw dev */
  589. /*RO*/    ulong_t    da_tflag;            /* temp flags for disk dev */
  590. /*RO*/    long    da_lock;            /* 1 => record locked */
  591. /*RO*/    volrid_t da_dg_import_id;        /* disk group import ID */
  592. /*RO*/    volrid_t da_dm_rid;            /* media record rid */
  593. /*RO*/    dev_t    da_pub_bdev;            /* dev of public partition */
  594. /*RO*/    dev_t    da_priv_bdev;            /* dev of private partition */
  595. /*RO*/    long    da_fail_code;            /* failed operation */
  596. /*RO*/    long    da_fail_errno;            /* error number for failure */
  597. /*RO*/    size_t    da_maxiosize;            /* max I/O size (blocks) */
  598.     char    da_tspare[28];            /* room for expansion */
  599.  
  600.     /* persistent part */
  601.  
  602. /*RO*/    char    da_name[NAME_SZ];        /* device name */
  603.     char    da_comment[COMMENT_SZ];        /* comment field */
  604. /*CO*/    char    da_type[DA_TYPE_SZ];        /* disk device type */
  605. /*CO*/    char    da_info[DA_INFO_SZ];        /* type-specific info */
  606. /*RO*/    volrid_t da_rid;            /* record ID in root config */
  607. /*RO*/    volseqno_t da_update_tid;        /* trans id of last update */
  608.     ulong_t    da_pflag;            /* persistent flags */
  609.     char    da_pspare[32];            /* room for expansion */
  610. };
  611.  
  612. /* operations in da_fail_code */
  613. #define DA_FAIL_ONLINE        1    /* implicit online operation failed */
  614. #define DA_FAIL_JOIN        2    /* implicit join operation failed */
  615.  
  616. /* non-persistent disk access record flags, stored in da_tflag: */
  617. #define DA_TFLAG_MASK        0x00000    /* mask for disk group tflag */
  618. #define DA_TFLAG_RMASK        0x0ff00    /* mask of read-only flags */
  619. #define DA_TFLAG_PRIVATE    0x00100    /* disk has a private region */
  620. #define DA_TFLAG_COMPONENT    0x00200    /* device is part of a disk */
  621. #define DA_TFLAG_VOLATILE    0x00400    /* disk is volatile */
  622. #define DA_TFLAG_BADTYPE    0x00800    /* disk type is unknown */
  623. #define DA_TFLAG_READY        0x01000    /* disk is accessible */
  624. #define DA_TFLAG_INVALID    0x02000    /* configuration error */
  625. #define DA_TFLAG_AUTOCONFIG    0x04000    /* generated DA record, not stored */
  626. #define DA_TFLAG_RESERVE    0x08000    /* reserved bit is set in DM record */
  627. #define DA_TFLAG_SPARE        0x10000 /* hotspare bit is set in DM record */
  628. #define DA_TFLAG_MPTH_DISABLE    0x20000 /* DA record subsumed by multipathing */
  629. #define DA_TFLAG_FAILING    0x40000    /* failing bit is set in DM record */
  630.  
  631. /* persistent disk access record flags, stored in da_pflag: */
  632. #define DA_PFLAG_MASK        0x00000    /* mask for disk pflag */
  633. #define DA_PFLAG_RMASK        0x00100    /* mask of read-only flags */
  634. #define DA_PFLAG_ONLINE        0x00100    /* disk should be made accessible */
  635.  
  636. /* disk access structure change mask flags: */
  637. #define EDIT_DA_MASK        0x00000007
  638. #define EDIT_DA_COMMENT        0x00000001    /* da_comment */
  639. #define EDIT_DA_TFLAG        0x00000002    /* da_tflag */
  640. #define EDIT_DA_PFLAG        0x00000004    /* da_pflag */
  641.  
  642. #endif    /* _VXVM_VOLINTF_H */
  643.