17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53d7072f8Seschrock * Common Development and Distribution License (the "License"). 63d7072f8Seschrock * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22b9c7fb03SAlok Aggarwal * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 23cd69fabeSAlexander Eremin * 24cd69fabeSAlexander Eremin * Copyright 2013 Nexenta Systems, Inc. All rights reserved. 25a1b1a2a0SAndrey Sokolov * Copyright (c) 2016 Andrey Sokolov 26406fc510SToomas Soome * Copyright 2016 Toomas Soome <tsoome@me.com> 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _SYS_LOFI_H 307c478bd9Sstevel@tonic-gate #define _SYS_LOFI_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/types.h> 337c478bd9Sstevel@tonic-gate #include <sys/time.h> 347c478bd9Sstevel@tonic-gate #include <sys/taskq.h> 357c478bd9Sstevel@tonic-gate #include <sys/dkio.h> 367c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 374058a205Sjrgn.keil@googlemail.com #include <sys/list.h> 387d82f0f8SDina K Nimeh #include <sys/crypto/api.h> 390fbb751dSJohn Levon #include <sys/zone.h> 40406fc510SToomas Soome #ifdef _KERNEL 41406fc510SToomas Soome #include <sys/cmlb.h> 42406fc510SToomas Soome #include <sys/open.h> 43406fc510SToomas Soome #endif /* _KERNEL */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #ifdef __cplusplus 467c478bd9Sstevel@tonic-gate extern "C" { 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * /dev names: 517c478bd9Sstevel@tonic-gate * /dev/lofictl - master control device 527c478bd9Sstevel@tonic-gate * /dev/lofi - block devices, named by minor number 537c478bd9Sstevel@tonic-gate * /dev/rlofi - character devices, named by minor number 547c478bd9Sstevel@tonic-gate */ 557c478bd9Sstevel@tonic-gate #define LOFI_DRIVER_NAME "lofi" 567c478bd9Sstevel@tonic-gate #define LOFI_CTL_NODE "ctl" 577c478bd9Sstevel@tonic-gate #define LOFI_CTL_NAME LOFI_DRIVER_NAME LOFI_CTL_NODE 58406fc510SToomas Soome #define LOFI_BLOCK_NODE "disk" 59406fc510SToomas Soome #define LOFI_CHAR_NODE LOFI_BLOCK_NODE ",raw" 607c478bd9Sstevel@tonic-gate #define LOFI_BLOCK_NAME LOFI_DRIVER_NAME 617c478bd9Sstevel@tonic-gate #define LOFI_CHAR_NAME "r" LOFI_DRIVER_NAME 627c478bd9Sstevel@tonic-gate 6387117650Saalok #define SEGHDR 1 6487117650Saalok #define COMPRESSED 1 6587117650Saalok #define UNCOMPRESSED 0 6687117650Saalok #define MAXALGLEN 36 6787117650Saalok 68406fc510SToomas Soome #define LOFI_CMLB_SHIFT CMLBUNIT_FORCE_P0_SHIFT 69406fc510SToomas Soome #define LOFI_PART_MASK ((1 << LOFI_CMLB_SHIFT) - 1) 70406fc510SToomas Soome #define LOFI_PART_MAX (1 << LOFI_CMLB_SHIFT) 71406fc510SToomas Soome #define LOFI_PART(x) ((x) & LOFI_PART_MASK) 72406fc510SToomas Soome 73406fc510SToomas Soome /* 74406fc510SToomas Soome * The cmlb is using its own range of minor numbers for partitions, for 75406fc510SToomas Soome * unlabeled lofi devices, we need to use another range. 76406fc510SToomas Soome */ 77406fc510SToomas Soome /* unlabeled lofi device id to minor number. */ 78406fc510SToomas Soome #define LOFI_ID2MINOR(x) ((x) << LOFI_CMLB_SHIFT) 79406fc510SToomas Soome /* lofi id from minor number. */ 80406fc510SToomas Soome #define LOFI_MINOR2ID(x) ((x) >> LOFI_CMLB_SHIFT) 81406fc510SToomas Soome 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * 847c478bd9Sstevel@tonic-gate * Use is: 857c478bd9Sstevel@tonic-gate * ld = open("/dev/lofictl", O_RDWR | O_EXCL); 867c478bd9Sstevel@tonic-gate * 877c478bd9Sstevel@tonic-gate * lofi must be opened exclusively. Access is controlled by permissions on 887c478bd9Sstevel@tonic-gate * the device, which is 644 by default. Write-access is required for ioctls 897c478bd9Sstevel@tonic-gate * that change state, but only read-access is required for the ioctls that 907c478bd9Sstevel@tonic-gate * return information. Basically, only root can add and remove files, but 917c478bd9Sstevel@tonic-gate * non-root can look at the current lists. 927c478bd9Sstevel@tonic-gate * 937c478bd9Sstevel@tonic-gate * ioctl usage: 947c478bd9Sstevel@tonic-gate * 957c478bd9Sstevel@tonic-gate * kernel ioctls 967c478bd9Sstevel@tonic-gate * 977c478bd9Sstevel@tonic-gate * strcpy(li.li_filename, "somefilename"); 987c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_MAP_FILE, &li); 997c478bd9Sstevel@tonic-gate * newminor = li.li_minor; 1007c478bd9Sstevel@tonic-gate * 1017c478bd9Sstevel@tonic-gate * strcpy(li.li_filename, "somefilename"); 1027c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_UNMAP_FILE, &li); 1037c478bd9Sstevel@tonic-gate * 1047c478bd9Sstevel@tonic-gate * strcpy(li.li_filename, "somefilename"); 1057c478bd9Sstevel@tonic-gate * li.li_minor = minor_number; 1067c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_MAP_FILE_MINOR, &li); 1077c478bd9Sstevel@tonic-gate * 1087c478bd9Sstevel@tonic-gate * li.li_minor = minor_number; 1097c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_UNMAP_FILE_MINOR, &li); 1107c478bd9Sstevel@tonic-gate * 1117c478bd9Sstevel@tonic-gate * li.li_minor = minor_number; 1127c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_GET_FILENAME, &li); 1137d82f0f8SDina K Nimeh * filename = li.li_filename; 1147d82f0f8SDina K Nimeh * encrypted = li.li_crypto_enabled; 1157c478bd9Sstevel@tonic-gate * 1167c478bd9Sstevel@tonic-gate * strcpy(li.li_filename, "somefilename"); 1177c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_GET_MINOR, &li); 1187d82f0f8SDina K Nimeh * minor = li.li_minor; 1197c478bd9Sstevel@tonic-gate * 1207c478bd9Sstevel@tonic-gate * li.li_minor = 0; 1217c478bd9Sstevel@tonic-gate * ioctl(ld, LOFI_GET_MAXMINOR, &li); 1227c478bd9Sstevel@tonic-gate * maxminor = li.li_minor; 1237c478bd9Sstevel@tonic-gate * 12487117650Saalok * strcpy(li.li_filename, "somefilename"); 12587117650Saalok * li.li_minor = 0; 12687117650Saalok * ioctl(ld, LOFI_CHECK_COMPRESSED, &li); 12787117650Saalok * 1283d7072f8Seschrock * If the 'li_force' flag is set for any of the LOFI_UNMAP_* commands, then if 1293d7072f8Seschrock * the device is busy, the underlying vnode will be closed, and any subsequent 1303d7072f8Seschrock * operations will fail. It will behave as if the device had been forcibly 1313d7072f8Seschrock * removed, so the DKIOCSTATE ioctl will return DKIO_DEV_GONE. When the device 1323d7072f8Seschrock * is last closed, it will be torn down. 1333d7072f8Seschrock * 13493239addSjohnlev * If the 'li_cleanup' flag is set for any of the LOFI_UNMAP_* commands, then 13593239addSjohnlev * if the device is busy, it is marked for removal at the next time it is 13693239addSjohnlev * no longer held open by anybody. When the device is last closed, it will be 13793239addSjohnlev * torn down. 13893239addSjohnlev * 1397c478bd9Sstevel@tonic-gate * Oh, and last but not least: these ioctls are totally private and only 140bbf21555SRichard Lowe * for use by lofiadm(8). 1417c478bd9Sstevel@tonic-gate * 1427c478bd9Sstevel@tonic-gate */ 1437c478bd9Sstevel@tonic-gate 1447d82f0f8SDina K Nimeh typedef enum iv_method { 1457d82f0f8SDina K Nimeh IVM_NONE, /* no iv needed, iv is null */ 1467d82f0f8SDina K Nimeh IVM_ENC_BLKNO /* iv is logical block no. encrypted */ 1477d82f0f8SDina K Nimeh } iv_method_t; 1487d82f0f8SDina K Nimeh 1497c478bd9Sstevel@tonic-gate struct lofi_ioctl { 150406fc510SToomas Soome uint32_t li_id; /* lofi ID */ 1513d7072f8Seschrock boolean_t li_force; 15293239addSjohnlev boolean_t li_cleanup; 153cd69fabeSAlexander Eremin boolean_t li_readonly; 154406fc510SToomas Soome boolean_t li_labeled; 1556f02aa44SDina K Nimeh char li_filename[MAXPATHLEN]; 156406fc510SToomas Soome char li_devpath[MAXPATHLEN]; 1577d82f0f8SDina K Nimeh 1587d82f0f8SDina K Nimeh /* the following fields are required for compression support */ 15987117650Saalok char li_algorithm[MAXALGLEN]; 1607d82f0f8SDina K Nimeh 1617d82f0f8SDina K Nimeh /* the following fields are required for encryption support */ 1627d82f0f8SDina K Nimeh boolean_t li_crypto_enabled; 1637d82f0f8SDina K Nimeh crypto_mech_name_t li_cipher; /* for data */ 1647d82f0f8SDina K Nimeh uint32_t li_key_len; /* for data */ 1657d82f0f8SDina K Nimeh char li_key[56]; /* for data: max 448-bit Blowfish key */ 1667d82f0f8SDina K Nimeh crypto_mech_name_t li_iv_cipher; /* for iv derivation */ 1677d82f0f8SDina K Nimeh uint32_t li_iv_len; /* for iv derivation */ 1687d82f0f8SDina K Nimeh iv_method_t li_iv_type; /* for iv derivation */ 1697c478bd9Sstevel@tonic-gate }; 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate #define LOFI_IOC_BASE (('L' << 16) | ('F' << 8)) 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate #define LOFI_MAP_FILE (LOFI_IOC_BASE | 0x01) 1747c478bd9Sstevel@tonic-gate #define LOFI_MAP_FILE_MINOR (LOFI_IOC_BASE | 0x02) 1757c478bd9Sstevel@tonic-gate #define LOFI_UNMAP_FILE (LOFI_IOC_BASE | 0x03) 1767c478bd9Sstevel@tonic-gate #define LOFI_UNMAP_FILE_MINOR (LOFI_IOC_BASE | 0x04) 1777c478bd9Sstevel@tonic-gate #define LOFI_GET_FILENAME (LOFI_IOC_BASE | 0x05) 1787c478bd9Sstevel@tonic-gate #define LOFI_GET_MINOR (LOFI_IOC_BASE | 0x06) 1797c478bd9Sstevel@tonic-gate #define LOFI_GET_MAXMINOR (LOFI_IOC_BASE | 0x07) 18087117650Saalok #define LOFI_CHECK_COMPRESSED (LOFI_IOC_BASE | 0x08) 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* 1837c478bd9Sstevel@tonic-gate * file types that might be usable with lofi, maybe. Only regular 1847c478bd9Sstevel@tonic-gate * files are documented though. 1857c478bd9Sstevel@tonic-gate */ 1867c478bd9Sstevel@tonic-gate #define S_ISLOFIABLE(mode) \ 1877c478bd9Sstevel@tonic-gate (S_ISREG(mode) || S_ISBLK(mode) || S_ISCHR(mode)) 1887c478bd9Sstevel@tonic-gate 189a1b1a2a0SAndrey Sokolov /* 190a1b1a2a0SAndrey Sokolov * The basis for CRYOFF is derived from usr/src/uts/common/sys/fs/ufs_fs.h. 191a1b1a2a0SAndrey Sokolov * Crypto metadata, if it exists, is located at the end of the boot block 192a1b1a2a0SAndrey Sokolov * (BBOFF + BBSIZE, which is SBOFF). The super block and everything after 193a1b1a2a0SAndrey Sokolov * is offset by the size of the crypto metadata which is handled by 194a1b1a2a0SAndrey Sokolov * lsp->ls_crypto_offset. 195a1b1a2a0SAndrey Sokolov */ 196a1b1a2a0SAndrey Sokolov #define CRYOFF ((off_t)8192) 197a1b1a2a0SAndrey Sokolov 198a1b1a2a0SAndrey Sokolov #define LOFI_CRYPTO_MAGIC { 'C', 'F', 'L', 'O', 'F', 'I' } 199a1b1a2a0SAndrey Sokolov 2007c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 2017c478bd9Sstevel@tonic-gate 2024058a205Sjrgn.keil@googlemail.com 2034058a205Sjrgn.keil@googlemail.com /* 2044058a205Sjrgn.keil@googlemail.com * Cache decompressed data segments for the compressed lofi images. 2054058a205Sjrgn.keil@googlemail.com * 2064058a205Sjrgn.keil@googlemail.com * To avoid that we have to decompress data of a compressed 2074058a205Sjrgn.keil@googlemail.com * segment multiple times when accessing parts of the segment's 2084058a205Sjrgn.keil@googlemail.com * data we cache the uncompressed data, using a simple linked list. 2094058a205Sjrgn.keil@googlemail.com */ 2104058a205Sjrgn.keil@googlemail.com struct lofi_comp_cache { 2114058a205Sjrgn.keil@googlemail.com list_node_t lc_list; /* linked list */ 2124058a205Sjrgn.keil@googlemail.com uchar_t *lc_data; /* decompressed segment data */ 2134058a205Sjrgn.keil@googlemail.com uint64_t lc_index; /* segment index */ 2144058a205Sjrgn.keil@googlemail.com }; 2154058a205Sjrgn.keil@googlemail.com 2167c478bd9Sstevel@tonic-gate #define V_ISLOFIABLE(vtype) \ 2177c478bd9Sstevel@tonic-gate ((vtype == VREG) || (vtype == VBLK) || (vtype == VCHR)) 2187c478bd9Sstevel@tonic-gate 219b9c7fb03SAlok Aggarwal /* 220b9c7fb03SAlok Aggarwal * Pre-allocated memory buffers for the purpose of compression 221b9c7fb03SAlok Aggarwal */ 222b9c7fb03SAlok Aggarwal struct compbuf { 223b9c7fb03SAlok Aggarwal void *buf; 224b9c7fb03SAlok Aggarwal uint32_t bufsize; 225b9c7fb03SAlok Aggarwal int inuse; 226b9c7fb03SAlok Aggarwal }; 227b9c7fb03SAlok Aggarwal 2287d82f0f8SDina K Nimeh /* 2297d82f0f8SDina K Nimeh * Need exactly 6 bytes to identify encrypted lofi image 2307d82f0f8SDina K Nimeh */ 2317d82f0f8SDina K Nimeh extern const char lofi_crypto_magic[6]; 2327d82f0f8SDina K Nimeh #define LOFI_CRYPTO_VERSION ((uint16_t)0) 2337d82f0f8SDina K Nimeh #define LOFI_CRYPTO_DATA_SECTOR ((uint32_t)16) /* for version 0 */ 2347d82f0f8SDina K Nimeh 2357d82f0f8SDina K Nimeh /* 2367d82f0f8SDina K Nimeh * Crypto metadata for encrypted lofi images 2377d82f0f8SDina K Nimeh * The fields here only satisfy initial implementation requirements. 2387d82f0f8SDina K Nimeh */ 2397d82f0f8SDina K Nimeh struct crypto_meta { 2407d82f0f8SDina K Nimeh char magic[6]; /* LOFI_CRYPTO_MAGIC */ 2417d82f0f8SDina K Nimeh uint16_t version; /* version of encrypted lofi */ 2427d82f0f8SDina K Nimeh char reserved1[96]; /* future use */ 2437d82f0f8SDina K Nimeh uint32_t data_sector; /* start of data area */ 2447d82f0f8SDina K Nimeh char pad[404]; /* end on DEV_BSIZE bdry */ 2457d82f0f8SDina K Nimeh /* second header block is not defined at this time */ 2467d82f0f8SDina K Nimeh }; 2477d82f0f8SDina K Nimeh 2487c478bd9Sstevel@tonic-gate struct lofi_state { 2490fbb751dSJohn Levon vnode_t *ls_vp; /* open real vnode */ 2500fbb751dSJohn Levon vnode_t *ls_stacked_vp; /* open vnode */ 2513d7072f8Seschrock kmutex_t ls_vp_lock; /* protects ls_vp */ 2523d7072f8Seschrock kcondvar_t ls_vp_cv; /* signal changes to ls_vp */ 2533d7072f8Seschrock uint32_t ls_vp_iocount; /* # pending I/O requests */ 2543d7072f8Seschrock boolean_t ls_vp_closereq; /* force close requested */ 255406fc510SToomas Soome boolean_t ls_vp_ready; /* is vp ready for use? */ 2567c478bd9Sstevel@tonic-gate u_offset_t ls_vp_size; 257406fc510SToomas Soome uint32_t ls_open_lyr[LOFI_PART_MAX]; /* open count */ 258406fc510SToomas Soome uint64_t ls_open_reg[OTYPCNT]; /* bitmask */ 259406fc510SToomas Soome uint64_t ls_open_excl; /* bitmask */ 2607c478bd9Sstevel@tonic-gate int ls_openflag; 26193239addSjohnlev boolean_t ls_cleanup; /* cleanup on close */ 262cd69fabeSAlexander Eremin boolean_t ls_readonly; 263*03f27e8bSAndy Fiddaman boolean_t ls_canfree; /* supports DKIOCFREE */ 2647c478bd9Sstevel@tonic-gate taskq_t *ls_taskq; 2657c478bd9Sstevel@tonic-gate kstat_t *ls_kstat; 2667c478bd9Sstevel@tonic-gate kmutex_t ls_kstat_lock; 2677c478bd9Sstevel@tonic-gate struct dk_geom ls_dkg; 268a19609f8Sjv zone_ref_t ls_zone; 2690fbb751dSJohn Levon list_node_t ls_list; /* all lofis */ 270406fc510SToomas Soome dev_info_t *ls_dip; 2710fbb751dSJohn Levon dev_t ls_dev; /* this node's dev_t */ 27287117650Saalok 273406fc510SToomas Soome cmlb_handle_t ls_cmlbhandle; 274406fc510SToomas Soome uint32_t ls_lbshift; /* logical block shift */ 275406fc510SToomas Soome uint32_t ls_pbshift; /* physical block shift */ 276406fc510SToomas Soome 27787117650Saalok /* the following fields are required for compression support */ 27887117650Saalok int ls_comp_algorithm_index; /* idx into compress_table */ 27987117650Saalok char ls_comp_algorithm[MAXALGLEN]; 28087117650Saalok uint32_t ls_uncomp_seg_sz; /* sz of uncompressed segment */ 28187117650Saalok uint32_t ls_comp_index_sz; /* number of index entries */ 28287117650Saalok uint32_t ls_comp_seg_shift; /* exponent for byte shift */ 28387117650Saalok uint32_t ls_uncomp_last_seg_sz; /* sz of last uncomp segment */ 28487117650Saalok uint64_t ls_comp_offbase; /* offset of actual compressed data */ 28587117650Saalok uint64_t *ls_comp_seg_index; /* array of index entries */ 28687117650Saalok caddr_t ls_comp_index_data; /* index pages loaded from file */ 28787117650Saalok uint32_t ls_comp_index_data_sz; 28887117650Saalok u_offset_t ls_vp_comp_size; /* actual compressed file size */ 2897d82f0f8SDina K Nimeh 290b9c7fb03SAlok Aggarwal /* pre-allocated list of buffers for compressed segment data */ 291b9c7fb03SAlok Aggarwal kmutex_t ls_comp_bufs_lock; 292b9c7fb03SAlok Aggarwal struct compbuf *ls_comp_bufs; 293b9c7fb03SAlok Aggarwal 2944058a205Sjrgn.keil@googlemail.com /* lock and anchor for compressed segment caching */ 2954058a205Sjrgn.keil@googlemail.com kmutex_t ls_comp_cache_lock; /* protects ls_comp_cache */ 2964058a205Sjrgn.keil@googlemail.com list_t ls_comp_cache; /* cached decompressed segs */ 2974058a205Sjrgn.keil@googlemail.com uint32_t ls_comp_cache_count; 2984058a205Sjrgn.keil@googlemail.com 2997d82f0f8SDina K Nimeh /* the following fields are required for encryption support */ 3007d82f0f8SDina K Nimeh boolean_t ls_crypto_enabled; 3017d82f0f8SDina K Nimeh u_offset_t ls_crypto_offset; /* crypto meta size */ 3027d82f0f8SDina K Nimeh struct crypto_meta ls_crypto; 3037d82f0f8SDina K Nimeh crypto_mechanism_t ls_mech; /* for data encr/decr */ 3047d82f0f8SDina K Nimeh crypto_key_t ls_key; /* for data encr/decr */ 3057d82f0f8SDina K Nimeh crypto_mechanism_t ls_iv_mech; /* for iv derivation */ 3067d82f0f8SDina K Nimeh size_t ls_iv_len; /* for iv derivation */ 3077d82f0f8SDina K Nimeh iv_method_t ls_iv_type; /* for iv derivation */ 3087d82f0f8SDina K Nimeh kmutex_t ls_crypto_lock; 3097d82f0f8SDina K Nimeh crypto_ctx_template_t ls_ctx_tmpl; 3107c478bd9Sstevel@tonic-gate }; 3117c478bd9Sstevel@tonic-gate 31287117650Saalok #endif /* _KERNEL */ 31387117650Saalok 31487117650Saalok /* 31587117650Saalok * Common signature for all lofi compress functions 31687117650Saalok */ 31787117650Saalok typedef int lofi_compress_func_t(void *src, size_t srclen, void *dst, 31887117650Saalok size_t *destlen, int level); 31987117650Saalok 32087117650Saalok /* 32187117650Saalok * Information about each compression function 32287117650Saalok */ 32387117650Saalok typedef struct lofi_compress_info { 32487117650Saalok lofi_compress_func_t *l_decompress; 32587117650Saalok lofi_compress_func_t *l_compress; 32687117650Saalok int l_level; 32787117650Saalok char *l_name; /* algorithm name */ 32887117650Saalok } lofi_compress_info_t; 32987117650Saalok 33087117650Saalok enum lofi_compress { 33187117650Saalok LOFI_COMPRESS_GZIP = 0, 33287117650Saalok LOFI_COMPRESS_GZIP_6 = 1, 33387117650Saalok LOFI_COMPRESS_GZIP_9 = 2, 334b1efbcd6SAlok Aggarwal LOFI_COMPRESS_LZMA = 3, 33587117650Saalok LOFI_COMPRESS_FUNCTIONS 33687117650Saalok }; 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3397c478bd9Sstevel@tonic-gate } 3407c478bd9Sstevel@tonic-gate #endif 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate #endif /* _SYS_LOFI_H */ 343