diff options
Diffstat (limited to 'usr/src/lib/libiscsit/common/libiscsit.c')
-rw-r--r-- | usr/src/lib/libiscsit/common/libiscsit.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/usr/src/lib/libiscsit/common/libiscsit.c b/usr/src/lib/libiscsit/common/libiscsit.c index c45b9b1..61b8b16 100644 --- a/usr/src/lib/libiscsit/common/libiscsit.c +++ b/usr/src/lib/libiscsit/common/libiscsit.c @@ -85,7 +85,7 @@ it_validate_tgtprops(nvlist_t *nvl, nvlist_t *errs); static int it_validate_iniprops(nvlist_t *nvl, nvlist_t *errs); -static boolean_t +static bool is_iscsit_enabled(void); static void @@ -233,7 +233,7 @@ it_config_commit(it_config_t *cfg) * the active service. */ if (ret == 0) { - boolean_t changed = B_FALSE; + bool changed = false; tgtp = cfg->config_tgt_list; for (; tgtp != NULL; tgtp = tgtp->tgt_next) { @@ -244,7 +244,7 @@ it_config_commit(it_config_t *cfg) PROP_OLD_TARGET_NAME)) { (void) nvlist_remove_all(tgtp->tgt_properties, PROP_OLD_TARGET_NAME); - changed = B_TRUE; + changed = true; } } @@ -729,7 +729,7 @@ it_tgt_setprop(it_config_t *cfg, it_tgt_t *tgt, nvlist_t *proplist, * EBUSY Target is online */ int -it_tgt_delete(it_config_t *cfg, it_tgt_t *tgt, boolean_t force) +it_tgt_delete(it_config_t *cfg, it_tgt_t *tgt, bool force) { int ret; it_tgt_t *ptgt; @@ -1082,7 +1082,7 @@ it_tpg_create(it_config_t *cfg, it_tpg_t **tpg, char *tpg_name, * EBUSY Portal group associated with one or more targets. */ int -it_tpg_delete(it_config_t *cfg, it_tpg_t *tpg, boolean_t force) +it_tpg_delete(it_config_t *cfg, it_tpg_t *tpg, bool force) { it_tpg_t *ptr; it_tpg_t *prev = NULL; @@ -1629,7 +1629,7 @@ it_validate_configprops(nvlist_t *nvl, nvlist_t *errs) char *name; char *val; struct sockaddr_storage sa; - boolean_t update_rad_server = B_FALSE; + bool update_rad_server = false; char *rad_server; char *auth = NULL; @@ -1730,7 +1730,7 @@ it_validate_configprops(nvlist_t *nvl, nvlist_t *errs) */ if (sockaddr_to_str(&sa, &rad_server) == 0) { - update_rad_server = B_TRUE; + update_rad_server = true; } } } else { @@ -1843,6 +1843,9 @@ it_iqn_generate(char *iqn_buf, int iqn_buf_len, char *opt_iqn_suffix) { int ret; uuid_t id; +#ifndef UUID_PRINTABLE_STRING_LENGTH +#define UUID_PRINTABLE_STRING_LENGTH 37 +#endif char id_str[UUID_PRINTABLE_STRING_LENGTH]; uuid_generate_random(id); @@ -1899,7 +1902,7 @@ it_val_pass(char *name, char *val, nvlist_t *e) * Ensures the passed-in string is a valid IQN or EUI iSCSI name * */ -boolean_t +bool validate_iscsi_name(char *in_name) { size_t in_len; @@ -1907,12 +1910,12 @@ validate_iscsi_name(char *in_name) char month[3]; if (in_name == NULL) { - return (B_FALSE); + return (false); } in_len = strlen(in_name); if (in_len < 12) { - return (B_FALSE); + return (false); } if (IS_IQN_NAME(in_name)) { @@ -1927,7 +1930,7 @@ validate_iscsi_name(char *in_name) (!isdigit(in_name[9])) || (!isdigit(in_name[10])) || (in_name[11] != '.')) { - return (B_FALSE); + return (false); } (void) strncpy(month, &(in_name[9]), 2); @@ -1935,7 +1938,7 @@ validate_iscsi_name(char *in_name) i = atoi(month); if ((i < 0) || (i > 12)) { - return (B_FALSE); + return (false); } /* @@ -1949,36 +1952,36 @@ validate_iscsi_name(char *in_name) if ((c != '-') && (c != '.') && (c != ':') && !isalpha(c) && !isdigit(c)) { - return (B_FALSE); + return (false); } } /* Finally, validate the overall length, in wide chars */ in_len = mbstowcs(NULL, in_name, 0); if (in_len > ISCSI_NAME_LEN_MAX) { - return (B_FALSE); + return (false); } } else if (IS_EUI_NAME(in_name)) { /* * EUI names are "eui." + 16 hex chars */ if (in_len != 20) { - return (B_FALSE); + return (false); } for (i = 4; i < in_len; i++) { if (!isxdigit(in_name[i])) { - return (B_FALSE); + return (false); } } } else { - return (B_FALSE); + return (false); } - return (B_TRUE); + return (true); } -static boolean_t +static bool is_iscsit_enabled(void) { char *state; @@ -1987,12 +1990,12 @@ is_iscsit_enabled(void) if (state != NULL) { if (strcmp(state, SCF_STATE_STRING_ONLINE) == 0) { free(state); - return (B_TRUE); + return (true); } free(state); } - return (B_FALSE); + return (false); } /* |