summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/lofi.h
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-06-22 12:55:10 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-06-22 12:55:10 +0000
commit8bae72dc3f645da905eab5fe960867037f57bae0 (patch)
tree24dce03bc58aa36ef080558a440d351c2237d4db /usr/src/uts/common/sys/lofi.h
parent766f41d1d95d047e65ac4942d66037ce7f924027 (diff)
parent01aaaf328842760a1002109b299908a027e94cf8 (diff)
downloadillumos-joyent-release-20160625.tar.gz
[illumos-gate merge]release-20160625
commit 01aaaf328842760a1002109b299908a027e94cf8 7051 want id_space(9F) docs commit c1de7575521deda5ee777b8054a9c5b12f15b1ee 7120 mDNS resync was not wsdiff safe commit 9c05409f2b9301e686735887a9573454cceb0331 7069 i386_XARCH should include -m32 commit 406fc5100dac8d225a315a6def6be8d628f34e24 6602 lofi should support labeled devices commit f3a07f941f1be263a48a040c059edbcb722cf436 4712 Prefer 'parsable' over 'parseable' in the manual pages commit 1b2031a95889aea96be6af55dcf31a0d5ffdfed9 7050 Prefer 'subcommand' over 'sub-command' in the manual pages commit 831b40b1c811223fd0b1131791a38e3ae5143377 7049 Prefer 'writable' over 'writeable' in the manual pages commit a716f1a92056bc2e231e57ae2a20725ce606ea73 7047 Fix spelling mistakes in sections 9E, 9F and 9S commit 95e15299a2c42b8014fa27631a6f3be2a93febc2 7048 Fix spelling mistakes in sections 7D, 7I, 7IPP, and 7P commit df23565fe1d0b225f9f898c50dfafea6749b0b7f 7046 Fix spelling mistakes in section 5 commit c855112f85cf71e42f6381a66f3f86f98e2ed24e 7045 Fix spelling mistakes in section 4 commit 843c398e8904ed9d833d2af3103894f909fb4b52 7042 Fix spelling mistakes in library sections commit 0db8de19c0e494758b68b702523a2b0eaffe3b2e 7044 Fix spelling mistakes in sections 1HAS and 2 commit df23d905b96680e56379c5a5ecb4b363f36b9e74 7041 Fix spelling mistakes in sections 1 and 1M commit 71af3be340c57171837478555e2eb0d496318cfc 7040 Detect common spelling errors in manual pages Conflicts: usr/src/uts/common/fs/vfs.c usr/src/man/man7d/cpuid.7d usr/src/man/man5/privileges.5 usr/src/man/man3c/signalfd.3c usr/src/cmd/lofiadm/main.c
Diffstat (limited to 'usr/src/uts/common/sys/lofi.h')
-rw-r--r--usr/src/uts/common/sys/lofi.h41
1 files changed, 33 insertions, 8 deletions
diff --git a/usr/src/uts/common/sys/lofi.h b/usr/src/uts/common/sys/lofi.h
index e4716c96af..f57388a098 100644
--- a/usr/src/uts/common/sys/lofi.h
+++ b/usr/src/uts/common/sys/lofi.h
@@ -23,6 +23,7 @@
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2016 Andrey Sokolov
+ * Copyright 2016 Toomas Soome <tsoome@me.com>
*/
#ifndef _SYS_LOFI_H
@@ -31,12 +32,15 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/taskq.h>
-#include <sys/vtoc.h>
#include <sys/dkio.h>
#include <sys/vnode.h>
#include <sys/list.h>
#include <sys/crypto/api.h>
#include <sys/zone.h>
+#ifdef _KERNEL
+#include <sys/cmlb.h>
+#include <sys/open.h>
+#endif /* _KERNEL */
#ifdef __cplusplus
extern "C" {
@@ -51,6 +55,8 @@ extern "C" {
#define LOFI_DRIVER_NAME "lofi"
#define LOFI_CTL_NODE "ctl"
#define LOFI_CTL_NAME LOFI_DRIVER_NAME LOFI_CTL_NODE
+#define LOFI_BLOCK_NODE "disk"
+#define LOFI_CHAR_NODE LOFI_BLOCK_NODE ",raw"
#define LOFI_BLOCK_NAME LOFI_DRIVER_NAME
#define LOFI_CHAR_NAME "r" LOFI_DRIVER_NAME
@@ -59,6 +65,20 @@ extern "C" {
#define UNCOMPRESSED 0
#define MAXALGLEN 36
+#define LOFI_CMLB_SHIFT CMLBUNIT_FORCE_P0_SHIFT
+#define LOFI_PART_MASK ((1 << LOFI_CMLB_SHIFT) - 1)
+#define LOFI_PART_MAX (1 << LOFI_CMLB_SHIFT)
+#define LOFI_PART(x) ((x) & LOFI_PART_MASK)
+
+/*
+ * The cmlb is using its own range of minor numbers for partitions, for
+ * unlabeled lofi devices, we need to use another range.
+ */
+/* unlabeled lofi device id to minor number. */
+#define LOFI_ID2MINOR(x) ((x) << LOFI_CMLB_SHIFT)
+/* lofi id from minor number. */
+#define LOFI_MINOR2ID(x) ((x) >> LOFI_CMLB_SHIFT)
+
/*
*
* Use is:
@@ -127,11 +147,13 @@ typedef enum iv_method {
} iv_method_t;
struct lofi_ioctl {
- uint32_t li_minor;
+ uint32_t li_id; /* lofi ID */
boolean_t li_force;
boolean_t li_cleanup;
boolean_t li_readonly;
+ boolean_t li_labeled;
char li_filename[MAXPATHLEN];
+ char li_devpath[MAXPATHLEN];
/* the following fields are required for compression support */
char li_algorithm[MAXALGLEN];
@@ -230,10 +252,11 @@ struct lofi_state {
kcondvar_t ls_vp_cv; /* signal changes to ls_vp */
uint32_t ls_vp_iocount; /* # pending I/O requests */
boolean_t ls_vp_closereq; /* force close requested */
+ boolean_t ls_vp_ready; /* is vp ready for use? */
u_offset_t ls_vp_size;
- uint32_t ls_blk_open;
- uint32_t ls_chr_open;
- uint32_t ls_lyr_open_count;
+ uint32_t ls_open_lyr[LOFI_PART_MAX]; /* open count */
+ uint64_t ls_open_reg[OTYPCNT]; /* bitmask */
+ uint64_t ls_open_excl; /* bitmask */
int ls_openflag;
boolean_t ls_cleanup; /* cleanup on close */
boolean_t ls_readonly;
@@ -241,12 +264,15 @@ struct lofi_state {
kstat_t *ls_kstat;
kmutex_t ls_kstat_lock;
struct dk_geom ls_dkg;
- struct vtoc ls_vtoc;
- struct dk_cinfo ls_ci;
zone_ref_t ls_zone;
list_node_t ls_list; /* all lofis */
+ dev_info_t *ls_dip;
dev_t ls_dev; /* this node's dev_t */
+ cmlb_handle_t ls_cmlbhandle;
+ uint32_t ls_lbshift; /* logical block shift */
+ uint32_t ls_pbshift; /* physical block shift */
+
/* the following fields are required for compression support */
int ls_comp_algorithm_index; /* idx into compress_table */
char ls_comp_algorithm[MAXALGLEN];
@@ -280,7 +306,6 @@ struct lofi_state {
iv_method_t ls_iv_type; /* for iv derivation */
kmutex_t ls_crypto_lock;
crypto_ctx_template_t ls_ctx_tmpl;
-
};
#endif /* _KERNEL */