Print this page
*** NO COMMENTS ***


 111  *
 112  * If the 'li_cleanup' flag is set for any of the LOFI_UNMAP_* commands, then
 113  * if the device is busy, it is marked for removal at the next time it is
 114  * no longer held open by anybody.  When the device is last closed, it will be
 115  * torn down.
 116  *
 117  * Oh, and last but not least: these ioctls are totally private and only
 118  * for use by lofiadm(1M).
 119  *
 120  */
 121 
 122 typedef enum    iv_method {
 123         IVM_NONE,       /* no iv needed, iv is null */
 124         IVM_ENC_BLKNO   /* iv is logical block no. encrypted */
 125 } iv_method_t;
 126 
 127 struct lofi_ioctl {
 128         uint32_t        li_minor;
 129         boolean_t       li_force;
 130         boolean_t       li_cleanup;

 131         char    li_filename[MAXPATHLEN];
 132 
 133         /* the following fields are required for compression support */
 134         char    li_algorithm[MAXALGLEN];
 135 
 136         /* the following fields are required for encryption support */
 137         boolean_t       li_crypto_enabled;
 138         crypto_mech_name_t      li_cipher;      /* for data */
 139         uint32_t        li_key_len;             /* for data */
 140         char            li_key[56];     /* for data: max 448-bit Blowfish key */
 141         crypto_mech_name_t      li_iv_cipher;   /* for iv derivation */
 142         uint32_t        li_iv_len;              /* for iv derivation */
 143         iv_method_t     li_iv_type;             /* for iv derivation */
 144 };
 145 
 146 #define LOFI_IOC_BASE           (('L' << 16) | ('F' << 8))
 147 
 148 #define LOFI_MAP_FILE           (LOFI_IOC_BASE | 0x01)
 149 #define LOFI_MAP_FILE_MINOR     (LOFI_IOC_BASE | 0x02)
 150 #define LOFI_UNMAP_FILE         (LOFI_IOC_BASE | 0x03)


 206         uint16_t        version;                /* version of encrypted lofi */
 207         char            reserved1[96];          /* future use */
 208         uint32_t        data_sector;            /* start of data area */
 209         char            pad[404];               /* end on DEV_BSIZE bdry */
 210         /* second header block is not defined at this time */
 211 };
 212 
 213 struct lofi_state {
 214         vnode_t         *ls_vp;         /* open real vnode */
 215         vnode_t         *ls_stacked_vp; /* open vnode */
 216         kmutex_t        ls_vp_lock;     /* protects ls_vp */
 217         kcondvar_t      ls_vp_cv;       /* signal changes to ls_vp */
 218         uint32_t        ls_vp_iocount;  /* # pending I/O requests */
 219         boolean_t       ls_vp_closereq; /* force close requested */
 220         u_offset_t      ls_vp_size;
 221         uint32_t        ls_blk_open;
 222         uint32_t        ls_chr_open;
 223         uint32_t        ls_lyr_open_count;
 224         int             ls_openflag;
 225         boolean_t       ls_cleanup;     /* cleanup on close */

 226         taskq_t         *ls_taskq;
 227         kstat_t         *ls_kstat;
 228         kmutex_t        ls_kstat_lock;
 229         struct dk_geom  ls_dkg;
 230         struct vtoc     ls_vtoc;
 231         struct dk_cinfo ls_ci;
 232         zone_ref_t      ls_zone;
 233         list_node_t     ls_list;        /* all lofis */
 234         dev_t           ls_dev;         /* this node's dev_t */
 235 
 236         /* the following fields are required for compression support */
 237         int             ls_comp_algorithm_index; /* idx into compress_table */
 238         char            ls_comp_algorithm[MAXALGLEN];
 239         uint32_t        ls_uncomp_seg_sz; /* sz of uncompressed segment */
 240         uint32_t        ls_comp_index_sz; /* number of index entries */
 241         uint32_t        ls_comp_seg_shift; /* exponent for byte shift */
 242         uint32_t        ls_uncomp_last_seg_sz; /* sz of last uncomp segment */
 243         uint64_t        ls_comp_offbase; /* offset of actual compressed data */
 244         uint64_t        *ls_comp_seg_index; /* array of index entries */
 245         caddr_t         ls_comp_index_data; /* index pages loaded from file */




 111  *
 112  * If the 'li_cleanup' flag is set for any of the LOFI_UNMAP_* commands, then
 113  * if the device is busy, it is marked for removal at the next time it is
 114  * no longer held open by anybody.  When the device is last closed, it will be
 115  * torn down.
 116  *
 117  * Oh, and last but not least: these ioctls are totally private and only
 118  * for use by lofiadm(1M).
 119  *
 120  */
 121 
 122 typedef enum    iv_method {
 123         IVM_NONE,       /* no iv needed, iv is null */
 124         IVM_ENC_BLKNO   /* iv is logical block no. encrypted */
 125 } iv_method_t;
 126 
 127 struct lofi_ioctl {
 128         uint32_t        li_minor;
 129         boolean_t       li_force;
 130         boolean_t       li_cleanup;
 131         boolean_t       li_readonly;
 132         char    li_filename[MAXPATHLEN];
 133 
 134         /* the following fields are required for compression support */
 135         char    li_algorithm[MAXALGLEN];
 136 
 137         /* the following fields are required for encryption support */
 138         boolean_t       li_crypto_enabled;
 139         crypto_mech_name_t      li_cipher;      /* for data */
 140         uint32_t        li_key_len;             /* for data */
 141         char            li_key[56];     /* for data: max 448-bit Blowfish key */
 142         crypto_mech_name_t      li_iv_cipher;   /* for iv derivation */
 143         uint32_t        li_iv_len;              /* for iv derivation */
 144         iv_method_t     li_iv_type;             /* for iv derivation */
 145 };
 146 
 147 #define LOFI_IOC_BASE           (('L' << 16) | ('F' << 8))
 148 
 149 #define LOFI_MAP_FILE           (LOFI_IOC_BASE | 0x01)
 150 #define LOFI_MAP_FILE_MINOR     (LOFI_IOC_BASE | 0x02)
 151 #define LOFI_UNMAP_FILE         (LOFI_IOC_BASE | 0x03)


 207         uint16_t        version;                /* version of encrypted lofi */
 208         char            reserved1[96];          /* future use */
 209         uint32_t        data_sector;            /* start of data area */
 210         char            pad[404];               /* end on DEV_BSIZE bdry */
 211         /* second header block is not defined at this time */
 212 };
 213 
 214 struct lofi_state {
 215         vnode_t         *ls_vp;         /* open real vnode */
 216         vnode_t         *ls_stacked_vp; /* open vnode */
 217         kmutex_t        ls_vp_lock;     /* protects ls_vp */
 218         kcondvar_t      ls_vp_cv;       /* signal changes to ls_vp */
 219         uint32_t        ls_vp_iocount;  /* # pending I/O requests */
 220         boolean_t       ls_vp_closereq; /* force close requested */
 221         u_offset_t      ls_vp_size;
 222         uint32_t        ls_blk_open;
 223         uint32_t        ls_chr_open;
 224         uint32_t        ls_lyr_open_count;
 225         int             ls_openflag;
 226         boolean_t       ls_cleanup;     /* cleanup on close */
 227         boolean_t       ls_readonly;
 228         taskq_t         *ls_taskq;
 229         kstat_t         *ls_kstat;
 230         kmutex_t        ls_kstat_lock;
 231         struct dk_geom  ls_dkg;
 232         struct vtoc     ls_vtoc;
 233         struct dk_cinfo ls_ci;
 234         zone_ref_t      ls_zone;
 235         list_node_t     ls_list;        /* all lofis */
 236         dev_t           ls_dev;         /* this node's dev_t */
 237 
 238         /* the following fields are required for compression support */
 239         int             ls_comp_algorithm_index; /* idx into compress_table */
 240         char            ls_comp_algorithm[MAXALGLEN];
 241         uint32_t        ls_uncomp_seg_sz; /* sz of uncompressed segment */
 242         uint32_t        ls_comp_index_sz; /* number of index entries */
 243         uint32_t        ls_comp_seg_shift; /* exponent for byte shift */
 244         uint32_t        ls_uncomp_last_seg_sz; /* sz of last uncomp segment */
 245         uint64_t        ls_comp_offbase; /* offset of actual compressed data */
 246         uint64_t        *ls_comp_seg_index; /* array of index entries */
 247         caddr_t         ls_comp_index_data; /* index pages loaded from file */