summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/stmfadm/stmfadm.c146
-rw-r--r--usr/src/cmd/stmfsvc/stmf.xml10
-rw-r--r--usr/src/cmd/stmfsvc/stmfsvc.c14
-rw-r--r--usr/src/lib/libstmf/common/libstmf.h17
-rw-r--r--usr/src/lib/libstmf/common/libstmf_impl.h34
-rw-r--r--usr/src/lib/libstmf/common/stmf.c193
-rw-r--r--usr/src/lib/libstmf/common/store.c42
7 files changed, 230 insertions, 226 deletions
diff --git a/usr/src/cmd/stmfadm/stmfadm.c b/usr/src/cmd/stmfadm/stmfadm.c
index 0c98614..f9b8e60 100644
--- a/usr/src/cmd/stmfadm/stmfadm.c
+++ b/usr/src/cmd/stmfadm/stmfadm.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <stdbool.h>
#include <strings.h>
#include <sys/types.h>
#include <unistd.h>
@@ -36,13 +37,14 @@
#include <string.h>
#include <assert.h>
#include <getopt.h>
-#include <cmdparse.h>
#include <stmfadm.h>
-#include <libstmf.h>
#include <signal.h>
#include <pthread.h>
#include <locale.h>
+#include "cmdparse.h"
+#include "libstmf.h"
+
static int addHostGroupMemberFunc(int, char **, cmdOptions_t *, void *);
static int addTargetGroupMemberFunc(int, char **, cmdOptions_t *, void *);
static int addViewFunc(int, char **, cmdOptions_t *, void *);
@@ -243,7 +245,7 @@ subCommandProps_t subcommands[] = {
OPERAND_MANDATORY_MULTIPLE, OPERANDSTRING_GROUP_MEMBER, NULL},
{"remove-view", removeViewFunc, "la", "l", NULL,
OPERAND_OPTIONAL_MULTIPLE, OPERANDSTRING_VIEW_ENTRY, NULL},
- {NULL, 0, NULL, NULL, 0, NULL, 0, NULL, NULL}
+ {NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL}
};
/* globals */
@@ -613,9 +615,9 @@ addViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
bzero(&viewEntry, sizeof (viewEntry));
/* init view entry structure */
- viewEntry.allHosts = B_TRUE;
- viewEntry.allTargets = B_TRUE;
- viewEntry.luNbrValid = B_FALSE;
+ viewEntry.allHosts = true;
+ viewEntry.allTargets = true;
+ viewEntry.luNbrValid = false;
/* check input length */
if (strlen(operands[0]) != GUID_INPUT) {
@@ -629,7 +631,7 @@ addViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
switch (options->optval) {
/* logical unit number */
case 'n':
- viewEntry.luNbrValid = B_TRUE;
+ viewEntry.luNbrValid = true;
inputLuNbr = atoi(options->optarg);
if (inputLuNbr > MAX_LU_NBR) {
(void) fprintf(stderr, "%s: %d: %s\n",
@@ -643,13 +645,13 @@ addViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
break;
/* host group */
case 'h':
- viewEntry.allHosts = B_FALSE;
+ viewEntry.allHosts = false;
bcopy(options->optarg, viewEntry.hostGroup,
strlen(options->optarg));
break;
/* target group */
case 't':
- viewEntry.allTargets = B_FALSE;
+ viewEntry.allTargets = false;
bcopy(options->optarg, viewEntry.targetGroup,
strlen(options->optarg));
break;
@@ -967,7 +969,7 @@ modifyLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
char sGuid[GUID_INPUT + 1];
char *prop = NULL;
char *propVal = NULL;
- boolean_t fnameUsed = B_FALSE;
+ bool fnameUsed = false;
uint32_t propId;
cmdOptions_t *optionStart = options;
@@ -975,7 +977,7 @@ modifyLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
for (; options->optval; options++) {
switch (options->optval) {
case 'f':
- fnameUsed = B_TRUE;
+ fnameUsed = true;
fname = operands[0];
break;
}
@@ -1327,11 +1329,11 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
int stmfRet;
unsigned int inGuid[sizeof (stmfGuid)];
stmfGuid delGuid;
- boolean_t keepViews = B_FALSE;
- boolean_t viewEntriesRemoved = B_FALSE;
- boolean_t noLunFound = B_FALSE;
- boolean_t views = B_FALSE;
- boolean_t notValidHexNumber = B_FALSE;
+ bool keepViews = false;
+ bool viewEntriesRemoved = false;
+ bool noLunFound = false;
+ bool views = false;
+ bool notValidHexNumber = false;
char sGuid[GUID_INPUT + 1];
stmfViewEntryList *viewEntryList = NULL;
@@ -1339,7 +1341,7 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
switch (options->optval) {
/* Keep views for logical unit */
case 'k':
- keepViews = B_TRUE;
+ keepViews = true;
break;
default:
(void) fprintf(stderr, "%s: %c: %s\n",
@@ -1353,18 +1355,18 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
for (i = 0; i < operandLen; i++) {
for (j = 0; j < GUID_INPUT; j++) {
if (!isxdigit(operands[i][j])) {
- notValidHexNumber = B_TRUE;
+ notValidHexNumber = true;
break;
}
sGuid[j] = tolower(operands[i][j]);
}
- if ((notValidHexNumber == B_TRUE) ||
+ if ((notValidHexNumber == true) ||
(strlen(operands[i]) != GUID_INPUT)) {
(void) fprintf(stderr, "%s: %s: %s%d%s\n",
cmdName, operands[i], gettext("must be "),
GUID_INPUT,
gettext(" hexadecimal digits long"));
- notValidHexNumber = B_FALSE;
+ notValidHexNumber = false;
ret++;
continue;
}
@@ -1387,7 +1389,7 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
case STMF_STATUS_SUCCESS:
break;
case STMF_ERROR_NOT_FOUND:
- noLunFound = B_TRUE;
+ noLunFound = true;
break;
case STMF_ERROR_BUSY:
(void) fprintf(stderr, "%s: %s\n", cmdName,
@@ -1416,7 +1418,7 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
}
/* check if viewEntryList is empty */
if (viewEntryList->cnt != 0)
- viewEntriesRemoved = B_TRUE;
+ viewEntriesRemoved = true;
stmfFreeMemory(viewEntryList);
} else {
(void) fprintf(stderr, "%s: %s\n", cmdName,
@@ -1429,7 +1431,7 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
stmfRet = stmfGetViewEntryList(&delGuid,
&viewEntryList);
if (stmfRet == STMF_STATUS_SUCCESS) {
- views = B_TRUE;
+ views = true;
stmfFreeMemory(viewEntryList);
}
}
@@ -1441,7 +1443,7 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options,
gettext("not found"));
ret++;
}
- noLunFound = viewEntriesRemoved = views = B_FALSE;
+ noLunFound = viewEntriesRemoved = views = false;
}
return (ret);
}
@@ -1650,9 +1652,9 @@ listHostGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
int ret = 0;
int stmfRet;
int i, j, outerLoop;
- boolean_t verbose = B_FALSE;
- boolean_t found = B_TRUE;
- boolean_t operandEntered;
+ bool verbose = false;
+ bool found = true;
+ bool operandEntered;
stmfGroupList *groupList;
stmfGroupProperties *groupProps;
wchar_t operandName[sizeof (stmfGroupName)];
@@ -1661,7 +1663,7 @@ listHostGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
for (; options->optval; options++) {
switch (options->optval) {
case 'v':
- verbose = B_TRUE;
+ verbose = true;
break;
default:
(void) fprintf(stderr, "%s: %c: %s\n",
@@ -1673,10 +1675,10 @@ listHostGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
if (operandLen > 0) {
outerLoop = operandLen;
- operandEntered = B_TRUE;
+ operandEntered = true;
} else {
outerLoop = 1;
- operandEntered = B_FALSE;
+ operandEntered = false;
}
stmfRet = stmfGetHostGroupList(&groupList);
@@ -1707,7 +1709,7 @@ listHostGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
}
for (i = 0; i < outerLoop; i++) {
- for (found = B_FALSE, j = 0; j < groupList->cnt; j++) {
+ for (found = false, j = 0; j < groupList->cnt; j++) {
(void) mbstowcs(groupNamePrint,
(char *)groupList->name[j],
sizeof (stmfGroupName) - 1);
@@ -1718,7 +1720,7 @@ listHostGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
operandName[sizeof (stmfGroupName) - 1] = 0;
if (wcscmp(operandName, groupNamePrint)
== 0) {
- found = B_TRUE;
+ found = true;
}
}
if ((found && operandEntered) || !operandEntered) {
@@ -1781,9 +1783,9 @@ listTargetGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
int ret = 0;
int stmfRet;
int i, j, outerLoop;
- boolean_t verbose = B_FALSE;
- boolean_t found = B_TRUE;
- boolean_t operandEntered;
+ bool verbose = false;
+ bool found = true;
+ bool operandEntered;
stmfGroupList *groupList;
stmfGroupProperties *groupProps;
wchar_t operandName[sizeof (stmfGroupName)];
@@ -1792,7 +1794,7 @@ listTargetGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
for (; options->optval; options++) {
switch (options->optval) {
case 'v':
- verbose = B_TRUE;
+ verbose = true;
break;
default:
(void) fprintf(stderr, "%s: %c: %s\n",
@@ -1804,10 +1806,10 @@ listTargetGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
if (operandLen > 0) {
outerLoop = operandLen;
- operandEntered = B_TRUE;
+ operandEntered = true;
} else {
outerLoop = 1;
- operandEntered = B_FALSE;
+ operandEntered = false;
}
stmfRet = stmfGetTargetGroupList(&groupList);
@@ -1838,7 +1840,7 @@ listTargetGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
}
for (i = 0; i < outerLoop; i++) {
- for (found = B_FALSE, j = 0; j < groupList->cnt; j++) {
+ for (found = false, j = 0; j < groupList->cnt; j++) {
(void) mbstowcs(groupNamePrint,
(char *)groupList->name[j],
sizeof (stmfGroupName) - 1);
@@ -1849,7 +1851,7 @@ listTargetGroupFunc(int operandLen, char *operands[], cmdOptions_t *options,
operandName[sizeof (stmfGroupName) - 1] = 0;
if (wcscmp(operandName, groupNamePrint)
== 0) {
- found = B_TRUE;
+ found = true;
}
}
if ((found && operandEntered) || !operandEntered) {
@@ -1889,25 +1891,25 @@ static int
listLuFunc(int operandLen, char *operands[], cmdOptions_t *options, void *args)
{
cmdOptions_t *optionList = options;
- boolean_t operandEntered;
+ bool operandEntered;
int i, j;
int ret = 0;
int stmfRet;
int outerLoop;
unsigned int inGuid[sizeof (stmfGuid)];
stmfGuid cmpGuid;
- boolean_t verbose = B_FALSE;
- boolean_t found;
+ bool verbose = false;
+ bool found;
char sGuid[GUID_INPUT + 1];
stmfGuidList *luList;
stmfLogicalUnitProperties luProps;
- boolean_t invalidInput = B_FALSE;
+ bool invalidInput = false;
stmfViewEntryList *viewEntryList;
for (; optionList->optval; optionList++) {
switch (optionList->optval) {
case 'v':
- verbose = B_TRUE;
+ verbose = true;
break;
}
}
@@ -1940,22 +1942,22 @@ listLuFunc(int operandLen, char *operands[], cmdOptions_t *options, void *args)
}
if (operandLen > 0) {
- operandEntered = B_TRUE;
+ operandEntered = true;
outerLoop = operandLen;
} else {
- operandEntered = B_FALSE;
+ operandEntered = false;
outerLoop = 1;
}
- for (invalidInput = B_FALSE, i = 0; i < outerLoop; i++) {
+ for (invalidInput = false, i = 0; i < outerLoop; i++) {
if (operandEntered) {
if (strlen(operands[i]) != GUID_INPUT) {
- invalidInput = B_TRUE;
+ invalidInput = true;
} else {
for (j = 0; j < GUID_INPUT; j++) {
if (!isxdigit(operands[i][j])) {
- invalidInput = B_TRUE;
+ invalidInput = true;
break;
}
}
@@ -1965,7 +1967,7 @@ listLuFunc(int operandLen, char *operands[], cmdOptions_t *options, void *args)
cmdName, operands[i], gettext("must be "),
GUID_INPUT,
gettext(" hexadecimal digits long"));
- invalidInput = B_FALSE;
+ invalidInput = false;
continue;
}
@@ -1986,11 +1988,11 @@ listLuFunc(int operandLen, char *operands[], cmdOptions_t *options, void *args)
}
}
- for (found = B_FALSE, j = 0; j < luList->cnt; j++) {
+ for (found = false, j = 0; j < luList->cnt; j++) {
if (operandEntered) {
if (bcmp(luList->guid[j].guid, cmpGuid.guid,
sizeof (stmfGuid)) == 0) {
- found = B_TRUE;
+ found = true;
}
}
if ((found && operandEntered) || !operandEntered) {
@@ -2452,7 +2454,7 @@ listStateFunc(int operandLen, char *operands[], cmdOptions_t *options,
{
int ret;
stmfState state;
- boolean_t aluaEnabled;
+ bool aluaEnabled;
uint32_t node;
if ((ret = getStmfState(&state)) != STMF_STATUS_SUCCESS)
@@ -2512,7 +2514,7 @@ listStateFunc(int operandLen, char *operands[], cmdOptions_t *options,
}
(void) printf("%-18s: ", "ALUA Status");
if (ret == STMF_STATUS_SUCCESS) {
- if (aluaEnabled == B_TRUE) {
+ if (aluaEnabled == true) {
(void) printf("enabled");
} else {
(void) printf("disabled");
@@ -2550,7 +2552,7 @@ listTargetFunc(int operandLen, char *operands[], cmdOptions_t *options,
int outerLoop;
stmfSessionList *sessionList;
stmfDevid devid;
- boolean_t operandEntered, found, verbose = B_FALSE;
+ bool operandEntered, found, verbose = false;
stmfDevidList *targetList;
wchar_t targetIdent[STMF_IDENT_LENGTH + 1];
stmfTargetProperties targetProps;
@@ -2587,17 +2589,17 @@ listTargetFunc(int operandLen, char *operands[], cmdOptions_t *options,
for (; optionList->optval; optionList++) {
switch (optionList->optval) {
case 'v':
- verbose = B_TRUE;
+ verbose = true;
break;
}
}
if (operandLen > 0) {
outerLoop = operandLen;
- operandEntered = B_TRUE;
+ operandEntered = true;
} else {
outerLoop = 1;
- operandEntered = B_FALSE;
+ operandEntered = false;
}
for (i = 0; i < outerLoop; i++) {
@@ -2605,11 +2607,11 @@ listTargetFunc(int operandLen, char *operands[], cmdOptions_t *options,
bzero(&devid, sizeof (devid));
(void) parseDevid(operands[i], &devid);
}
- for (found = B_FALSE, j = 0; j < targetList->cnt; j++) {
+ for (found = false, j = 0; j < targetList->cnt; j++) {
if (operandEntered) {
if (bcmp(&devid, &(targetList->devid[j]),
sizeof (devid)) == 0) {
- found = B_TRUE;
+ found = true;
}
}
if ((found && operandEntered) || !operandEntered) {
@@ -2676,8 +2678,8 @@ listViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
int ret = 0;
int stmfRet;
int i, j, outerLoop;
- boolean_t found = B_TRUE;
- boolean_t operandEntered;
+ bool found = true;
+ bool operandEntered;
uint16_t outputLuNbr;
wchar_t groupName[sizeof (stmfGroupName)];
char sGuid[GUID_INPUT + 1];
@@ -2707,10 +2709,10 @@ listViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
if (operandLen > 0) {
outerLoop = operandLen;
- operandEntered = B_TRUE;
+ operandEntered = true;
} else {
outerLoop = 1;
- operandEntered = B_FALSE;
+ operandEntered = false;
}
for (i = 0; i < 32; i++)
@@ -2761,11 +2763,11 @@ listViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
}
for (i = 0; i < outerLoop; i++) {
- for (found = B_FALSE, j = 0; j < viewEntryList->cnt; j++) {
+ for (found = false, j = 0; j < viewEntryList->cnt; j++) {
if (operandEntered) {
if (atoi(operands[i]) ==
viewEntryList->ve[j].veIndex) {
- found = B_TRUE;
+ found = true;
}
}
if ((found && operandEntered) || !operandEntered) {
@@ -3301,8 +3303,8 @@ removeViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
char *endPtr;
uint32_t veNbr;
int i;
- boolean_t all = B_FALSE;
- boolean_t luInput = B_FALSE;
+ bool all = false;
+ bool luInput = false;
int ret = 0;
int stmfRet;
@@ -3319,11 +3321,11 @@ removeViewFunc(int operandLen, char *operands[], cmdOptions_t *options,
return (1);
}
bcopy(options->optarg, sGuid, GUID_INPUT);
- luInput = B_TRUE;
+ luInput = true;
break;
case 'a':
/* removing all view entries for this GUID */
- all = B_TRUE;
+ all = true;
break;
default:
(void) fprintf(stderr, "%s: %c: %s\n",
@@ -3495,7 +3497,7 @@ main(int argc, char *argv[])
void *subcommandArgs = NULL;
(void) setlocale(LC_ALL, "");
- (void) textdomain(TEXT_DOMAIN);
+ textdomain(PACKAGE);
/* set global command name */
cmdName = getExecBasename(argv[0]);
diff --git a/usr/src/cmd/stmfsvc/stmf.xml b/usr/src/cmd/stmfsvc/stmf.xml
index b3119da..110afc9 100644
--- a/usr/src/cmd/stmfsvc/stmf.xml
+++ b/usr/src/cmd/stmfsvc/stmf.xml
@@ -1,5 +1,5 @@
<?xml version='1.0'?>
-<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
+<!DOCTYPE service_bundle SYSTEM '/usr/share/xml/schema/smf/service_bundle.dtd.1'>
<!--
@@ -40,7 +40,7 @@ Service manifests for SCSI Target Mode Framework
type='service'
version='1'>
- <create_default_instance enabled='false' />
+ <create_default_instance enabled='true' />
<single_instance/>
@@ -65,7 +65,7 @@ Service manifests for SCSI Target Mode Framework
/>
</method_context>
</exec_method>
-
+
<exec_method
type='method'
name='stop'
@@ -109,8 +109,8 @@ Service manifests for SCSI Target Mode Framework
<documentation>
<manpage title='stmf' section='7D'
manpath='/usr/share/man' />
- <manpage title='stmfadm' section='1M'
- manpath='/usr/share /man' />
+ <manpage title='stmfadm' section='8'
+ manpath='/usr/share/man' />
</documentation>
</template>
diff --git a/usr/src/cmd/stmfsvc/stmfsvc.c b/usr/src/cmd/stmfsvc/stmfsvc.c
index 814ebc2..d440a5d 100644
--- a/usr/src/cmd/stmfsvc/stmfsvc.c
+++ b/usr/src/cmd/stmfsvc/stmfsvc.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <stdbool.h>
#include <strings.h>
#include <sys/types.h>
#include <unistd.h>
@@ -33,12 +34,13 @@
#include <string.h>
#include <assert.h>
#include <getopt.h>
-#include <cmdparse.h>
-#include <libstmf.h>
#include <signal.h>
#include <pthread.h>
#include <locale.h>
+#include "cmdparse.h"
+#include "libstmf.h"
+
static int svcStart(int, char **, cmdOptions_t *, void *);
static int svcStop(int, char **, cmdOptions_t *, void *);
static int online();
@@ -90,7 +92,7 @@ svcStop(int operandLen, char *operands[], cmdOptions_t *options,
int stmfRet;
int ret = 0;
stmfState state;
- boolean_t serviceOffline = B_FALSE;
+ bool serviceOffline = false;
struct timespec rqtp;
bzero(&rqtp, sizeof (rqtp));
@@ -127,7 +129,7 @@ svcStop(int operandLen, char *operands[], cmdOptions_t *options,
break;
}
if (state.operationalState == STMF_SERVICE_STATE_OFFLINE) {
- serviceOffline = B_TRUE;
+ serviceOffline = true;
} else {
(void) nanosleep(&rqtp, NULL);
}
@@ -199,7 +201,7 @@ online()
int stmfRet;
int ret = 0;
stmfState state;
- boolean_t serviceOnline = B_FALSE;
+ bool serviceOnline = false;
struct timespec rqtp;
bzero(&rqtp, sizeof (rqtp));
@@ -236,7 +238,7 @@ online()
break;
}
if (state.operationalState == STMF_SERVICE_STATE_ONLINE) {
- serviceOnline = B_TRUE;
+ serviceOnline = true;
} else {
(void) nanosleep(&rqtp, NULL);
}
diff --git a/usr/src/lib/libstmf/common/libstmf.h b/usr/src/lib/libstmf/common/libstmf.h
index f9d05ad..734c08e 100644
--- a/usr/src/lib/libstmf/common/libstmf.h
+++ b/usr/src/lib/libstmf/common/libstmf.h
@@ -26,6 +26,7 @@
#define _LIBSTMF_H
#include <time.h>
+#include <stdbool.h>
#include <sys/param.h>
#include <libnvpair.h>
@@ -240,13 +241,13 @@ typedef struct _stmfSessionList
typedef struct _stmfViewEntry
{
- boolean_t veIndexValid; /* if B_TRUE, veIndex is valid value */
+ bool veIndexValid; /* if true, veIndex is valid value */
uint32_t veIndex; /* View Entry index */
- boolean_t allHosts; /* all initiator ports */
+ bool allHosts; /* all initiator ports */
stmfGroupName hostGroup; /* Host Group Name */
- boolean_t allTargets; /* B_TRUE = targetGroup is invalid */
+ bool allTargets; /* true = targetGroup is invalid */
stmfGroupName targetGroup; /* Target Group Name */
- boolean_t luNbrValid; /* if B_TRUE, luNbr is a valid value */
+ bool luNbrValid; /* if true, luNbr is a valid value */
uchar_t luNbr[8]; /* LU number for this view entry */
} stmfViewEntry;
@@ -323,7 +324,7 @@ int stmfDevidFromIscsiName(char *iscsiName, stmfDevid *devid);
int stmfDevidFromWwn(uchar_t wwn[8], stmfDevid *devid);
int stmfFreeLuResource(luResource hdl);
void stmfFreeMemory(void *);
-int stmfGetAluaState(boolean_t *enabled, uint32_t *node);
+int stmfGetAluaState(bool *enabled, uint32_t *node);
int stmfGetGlobalLuProp(uint16_t dType, uint32_t prop, char *propVal,
size_t *propLen);
int stmfGetHostGroupList(stmfGroupList **initiatorGroupList);
@@ -341,7 +342,7 @@ int stmfGetLogicalUnitProviderProperties(stmfProviderName *providerName,
int stmfGetLuProp(luResource hdl, uint32_t propType, char *prop,
size_t *propLen);
int stmfGetLuResource(stmfGuid *luGuid, luResource *hdl);
-int stmfGetPersistMethod(uint8_t *persistType, boolean_t serviceState);
+int stmfGetPersistMethod(uint8_t *persistType, bool serviceState);
int stmfGetProviderData(char *providerName, nvlist_t **nvl, int providerType);
int stmfGetProviderDataProt(char *providerName, nvlist_t **nvl,
int providerType, uint64_t *setToken);
@@ -373,10 +374,10 @@ int stmfRemoveFromHostGroup(stmfGroupName *hostGroupName,
int stmfRemoveFromTargetGroup(stmfGroupName *targetGroupName,
stmfDevid *targetName);
int stmfRemoveViewEntry(stmfGuid *lu, uint32_t viewEntryIndex);
-int stmfSetAluaState(boolean_t enabled, uint32_t node);
+int stmfSetAluaState(bool enabled, uint32_t node);
int stmfSetGlobalLuProp(uint16_t dType, uint32_t propType, const char *propVal);
int stmfSetLuProp(luResource hdl, uint32_t propType, const char *propVal);
-int stmfSetPersistMethod(uint8_t persistType, boolean_t serviceSet);
+int stmfSetPersistMethod(uint8_t persistType, bool serviceSet);
int stmfSetProviderData(char *providerName, nvlist_t *nvl, int providerType);
int stmfSetProviderDataProt(char *providerName, nvlist_t *nvl,
int providerType, uint64_t *setToken);
diff --git a/usr/src/lib/libstmf/common/libstmf_impl.h b/usr/src/lib/libstmf/common/libstmf_impl.h
index ec02fcd..94d031d 100644
--- a/usr/src/lib/libstmf/common/libstmf_impl.h
+++ b/usr/src/lib/libstmf/common/libstmf_impl.h
@@ -39,37 +39,37 @@ typedef struct _luResourceImpl {
typedef struct _diskResource {
- boolean_t luDataFileNameValid;
+ bool luDataFileNameValid;
char luDataFileName[MAXPATHLEN];
- boolean_t luMetaFileNameValid;
+ bool luMetaFileNameValid;
char luMetaFileName[MAXPATHLEN];
- boolean_t luSizeValid;
+ bool luSizeValid;
uint64_t luSize;
- boolean_t blkSizeValid;
+ bool blkSizeValid;
uint16_t blkSize;
- boolean_t luGuidValid;
+ bool luGuidValid;
uint8_t luGuid[16];
- boolean_t serialNumValid;
+ bool serialNumValid;
char serialNum[253];
- boolean_t companyIdValid;
+ bool companyIdValid;
uint32_t companyId;
- boolean_t luAliasValid;
+ bool luAliasValid;
char luAlias[256];
- boolean_t luMgmtUrlValid;
+ bool luMgmtUrlValid;
char luMgmtUrl[1024];
- boolean_t vidValid;
+ bool vidValid;
char vid[8];
- boolean_t pidValid;
+ bool pidValid;
char pid[16];
- boolean_t revValid;
+ bool revValid;
char rev[4];
- boolean_t writeProtectEnableValid;
- boolean_t writeProtectEnable;
- boolean_t writebackCacheDisableValid;
- boolean_t writebackCacheDisable;
+ bool writeProtectEnableValid;
+ bool writeProtectEnable;
+ bool writebackCacheDisableValid;
+ bool writebackCacheDisable;
uint16_t accessState;
uint32_t hostId;
- boolean_t hostIdValid;
+ bool hostIdValid;
} diskResource;
diff --git a/usr/src/lib/libstmf/common/stmf.c b/usr/src/lib/libstmf/common/stmf.c
index e12c189..89d7703 100644
--- a/usr/src/lib/libstmf/common/stmf.c
+++ b/usr/src/lib/libstmf/common/stmf.c
@@ -38,17 +38,16 @@
#include <libnvpair.h>
#include <pthread.h>
#include <syslog.h>
-#include <libstmf.h>
#include <netinet/in.h>
#include <inttypes.h>
-#include <store.h>
#include <locale.h>
#include <math.h>
-#include <libstmf_impl.h>
#include <sys/stmf_ioctl.h>
#include <sys/stmf_sbd_ioctl.h>
#include <sys/pppt_ioctl.h>
-#include <macros.h>
+
+#include "libstmf_impl.h"
+#include "store.h"
#define STMF_PATH "/devices/pseudo/stmf@0:admin"
#define SBD_PATH "/devices/pseudo/stmf_sbd@0:admin"
@@ -123,7 +122,7 @@ static int getDiskAllProps(stmfGuid *luGuid, luResource *hdl);
static int loadDiskPropsFromDriver(luResourceImpl *, sbd_lu_props_t *);
static int removeGuidFromDiskStore(stmfGuid *);
static int addGuidToDiskStore(stmfGuid *, char *);
-static int persistDiskGuid(stmfGuid *, char *, boolean_t);
+static int persistDiskGuid(stmfGuid *, char *, bool);
static int setDiskProp(luResourceImpl *, uint32_t, const char *);
static int getDiskGlobalProp(uint32_t prop, char *propVal, size_t *propLen);
static int checkHexUpper(char *);
@@ -147,8 +146,8 @@ static int loadStmfProp(int fd);
static pthread_mutex_t persistenceTypeLock = PTHREAD_MUTEX_INITIALIZER;
static int iPersistType = 0;
-/* when B_TRUE, no need to access SMF anymore. Just use iPersistType */
-static boolean_t iLibSetPersist = B_FALSE;
+/* when true, no need to access SMF anymore. Just use iPersistType */
+static bool iLibSetPersist = false;
/*
* Open for stmf module
@@ -624,7 +623,7 @@ done:
*
* lu - Logical Unit identifier to which the view entry is added
* viewEntry - view entry to add
- * init - When set to B_TRUE, we are in the init state, i.e. don't call open
+ * init - When set to true, we are in the init state, i.e. don't call open
*/
static int
addViewEntryIoctl(int fd, stmfGuid *lu, stmfViewEntry *viewEntry)
@@ -643,13 +642,13 @@ addViewEntryIoctl(int fd, stmfGuid *lu, stmfViewEntry *viewEntry)
ioctlViewEntry.ve_all_hosts = viewEntry->allHosts;
ioctlViewEntry.ve_all_targets = viewEntry->allTargets;
- if (viewEntry->allHosts == B_FALSE) {
+ if (viewEntry->allHosts == false) {
bcopy(viewEntry->hostGroup, &ioctlViewEntry.ve_host_group.name,
sizeof (stmfGroupName));
ioctlViewEntry.ve_host_group.name_size =
strlen((char *)viewEntry->hostGroup);
}
- if (viewEntry->allTargets == B_FALSE) {
+ if (viewEntry->allTargets == false) {
bcopy(viewEntry->targetGroup,
&ioctlViewEntry.ve_target_group.name,
sizeof (stmfGroupName));
@@ -726,7 +725,7 @@ addViewEntryIoctl(int fd, stmfGuid *lu, stmfViewEntry *viewEntry)
bcopy(&ioctlViewEntry.ve_lu_nbr, viewEntry->luNbr,
sizeof (ioctlViewEntry.ve_lu_nbr));
}
- viewEntry->luNbrValid = B_TRUE;
+ viewEntry->luNbrValid = true;
done:
return (ret);
@@ -758,18 +757,18 @@ stmfAddViewEntry(stmfGuid *lu, stmfViewEntry *viewEntry)
bcopy(viewEntry->hostGroup, iViewEntry.hostGroup,
sizeof (iViewEntry.hostGroup));
} else {
- iViewEntry.allHosts = B_TRUE;
+ iViewEntry.allHosts = true;
}
if (!viewEntry->allTargets) {
bcopy(viewEntry->targetGroup, iViewEntry.targetGroup,
sizeof (iViewEntry.targetGroup));
} else {
- iViewEntry.allTargets = B_TRUE;
+ iViewEntry.allTargets = true;
}
if (viewEntry->luNbrValid) {
- iViewEntry.luNbrValid = B_TRUE;
+ iViewEntry.luNbrValid = true;
bcopy(viewEntry->luNbr, iViewEntry.luNbr,
sizeof (iViewEntry.luNbr));
}
@@ -778,7 +777,7 @@ stmfAddViewEntry(stmfGuid *lu, stmfViewEntry *viewEntry)
* set users return view entry index valid flag to false
* in case of failure
*/
- viewEntry->veIndexValid = B_FALSE;
+ viewEntry->veIndexValid = false;
/* Check to ensure service exists */
if (psCheckService() != STMF_STATUS_SUCCESS) {
@@ -844,7 +843,7 @@ done:
/* set caller's view entry on success */
viewEntry->veIndexValid = iViewEntry.veIndexValid;
viewEntry->veIndex = iViewEntry.veIndex;
- viewEntry->luNbrValid = B_TRUE;
+ viewEntry->luNbrValid = true;
bcopy(iViewEntry.luNbr, viewEntry->luNbr,
sizeof (iViewEntry.luNbr));
}
@@ -1973,7 +1972,7 @@ done:
static int
removeGuidFromDiskStore(stmfGuid *guid)
{
- return (persistDiskGuid(guid, NULL, B_FALSE));
+ return (persistDiskGuid(guid, NULL, false));
}
@@ -1985,7 +1984,7 @@ removeGuidFromDiskStore(stmfGuid *guid)
static int
addGuidToDiskStore(stmfGuid *guid, char *filename)
{
- return (persistDiskGuid(guid, filename, B_TRUE));
+ return (persistDiskGuid(guid, filename, true));
}
@@ -1996,14 +1995,14 @@ addGuidToDiskStore(stmfGuid *guid, char *filename)
*
*/
static int
-persistDiskGuid(stmfGuid *guid, char *filename, boolean_t persist)
+persistDiskGuid(stmfGuid *guid, char *filename, bool persist)
{
char guidAsciiBuf[LU_ASCII_GUID_SIZE + 1] = {0};
nvlist_t *nvl = NULL;
uint64_t setToken;
- boolean_t retryGetProviderData = B_FALSE;
- boolean_t newData = B_FALSE;
+ bool retryGetProviderData = false;
+ bool newData = false;
int ret = STMF_STATUS_SUCCESS;
int retryCnt = 0;
int stmfRet;
@@ -2024,7 +2023,7 @@ persistDiskGuid(stmfGuid *guid, char *filename, boolean_t persist)
do {
- retryGetProviderData = B_FALSE;
+ retryGetProviderData = false;
stmfRet = stmfGetProviderDataProt("sbd", &nvl,
STMF_LU_PROVIDER_TYPE, &setToken);
if (stmfRet != STMF_STATUS_SUCCESS) {
@@ -2037,7 +2036,7 @@ persistDiskGuid(stmfGuid *guid, char *filename, boolean_t persist)
ret = STMF_STATUS_ERROR;
goto done;
}
- newData = B_TRUE;
+ newData = true;
} else {
/*
* if we're persisting the data, it's
@@ -2069,7 +2068,7 @@ persistDiskGuid(stmfGuid *guid, char *filename, boolean_t persist)
if (stmfRet != STMF_STATUS_SUCCESS) {
if (stmfRet == STMF_ERROR_BUSY) {
/* get/set failed, try again */
- retryGetProviderData = B_TRUE;
+ retryGetProviderData = true;
if (retryCnt++ > MAX_PROVIDER_RETRY) {
ret = stmfRet;
break;
@@ -2080,7 +2079,7 @@ persistDiskGuid(stmfGuid *guid, char *filename, boolean_t persist)
/* update failed, try again */
nvlist_free(nvl);
nvl = NULL;
- retryGetProviderData = B_TRUE;
+ retryGetProviderData = true;
if (retryCnt++ > MAX_PROVIDER_RETRY) {
ret = stmfRet;
break;
@@ -2273,11 +2272,11 @@ loadDiskPropsFromDriver(luResourceImpl *hdl, sbd_lu_props_t *sbdProps)
int ret = STMF_STATUS_SUCCESS;
diskResource *diskLu = hdl->resource;
/* copy guid */
- diskLu->luGuidValid = B_TRUE;
+ diskLu->luGuidValid = true;
bcopy(sbdProps->slp_guid, diskLu->luGuid, sizeof (sbdProps->slp_guid));
if (sbdProps->slp_separate_meta && sbdProps->slp_meta_fname_valid) {
- diskLu->luMetaFileNameValid = B_TRUE;
+ diskLu->luMetaFileNameValid = true;
if (strlcpy(diskLu->luMetaFileName,
(char *)&(sbdProps->slp_buf[sbdProps->slp_meta_fname_off]),
sizeof (diskLu->luMetaFileName)) >=
@@ -2287,7 +2286,7 @@ loadDiskPropsFromDriver(luResourceImpl *hdl, sbd_lu_props_t *sbdProps)
}
if (sbdProps->slp_data_fname_valid) {
- diskLu->luDataFileNameValid = B_TRUE;
+ diskLu->luDataFileNameValid = true;
if (strlcpy(diskLu->luDataFileName,
(char *)&(sbdProps->slp_buf[sbdProps->slp_data_fname_off]),
sizeof (diskLu->luDataFileName)) >=
@@ -2297,13 +2296,13 @@ loadDiskPropsFromDriver(luResourceImpl *hdl, sbd_lu_props_t *sbdProps)
}
if (sbdProps->slp_serial_valid) {
- diskLu->serialNumValid = B_TRUE;
+ diskLu->serialNumValid = true;
bcopy(&(sbdProps->slp_buf[sbdProps->slp_serial_off]),
diskLu->serialNum, sbdProps->slp_serial_size);
}
if (sbdProps->slp_mgmt_url_valid) {
- diskLu->luMgmtUrlValid = B_TRUE;
+ diskLu->luMgmtUrlValid = true;
if (strlcpy(diskLu->luMgmtUrl,
(char *)&(sbdProps->slp_buf[sbdProps->slp_mgmt_url_off]),
sizeof (diskLu->luMgmtUrl)) >=
@@ -2313,7 +2312,7 @@ loadDiskPropsFromDriver(luResourceImpl *hdl, sbd_lu_props_t *sbdProps)
}
if (sbdProps->slp_alias_valid) {
- diskLu->luAliasValid = B_TRUE;
+ diskLu->luAliasValid = true;
if (strlcpy(diskLu->luAlias,
(char *)&(sbdProps->slp_buf[sbdProps->slp_alias_off]),
sizeof (diskLu->luAlias)) >=
@@ -2322,7 +2321,7 @@ loadDiskPropsFromDriver(luResourceImpl *hdl, sbd_lu_props_t *sbdProps)
}
} else { /* set alias to data filename if not set */
if (sbdProps->slp_data_fname_valid) {
- diskLu->luAliasValid = B_TRUE;
+ diskLu->luAliasValid = true;
if (strlcpy(diskLu->luAlias,
(char *)&(sbdProps->slp_buf[
sbdProps->slp_data_fname_off]),
@@ -2333,29 +2332,29 @@ loadDiskPropsFromDriver(luResourceImpl *hdl, sbd_lu_props_t *sbdProps)
}
}
- diskLu->vidValid = B_TRUE;
+ diskLu->vidValid = true;
bcopy(sbdProps->slp_vid, diskLu->vid, sizeof (diskLu->vid));
- diskLu->pidValid = B_TRUE;
+ diskLu->pidValid = true;
bcopy(sbdProps->slp_pid, diskLu->pid, sizeof (diskLu->pid));
- diskLu->revValid = B_TRUE;
+ diskLu->revValid = true;
bcopy(sbdProps->slp_rev, diskLu->rev, sizeof (diskLu->rev));
- diskLu->writeProtectEnableValid = B_TRUE;
+ diskLu->writeProtectEnableValid = true;
if (sbdProps->slp_write_protected) {
- diskLu->writeProtectEnable = B_TRUE;
+ diskLu->writeProtectEnable = true;
}
- diskLu->writebackCacheDisableValid = B_TRUE;
+ diskLu->writebackCacheDisableValid = true;
if (sbdProps->slp_writeback_cache_disable_cur) {
- diskLu->writebackCacheDisable = B_TRUE;
+ diskLu->writebackCacheDisable = true;
}
- diskLu->blkSizeValid = B_TRUE;
+ diskLu->blkSizeValid = true;
diskLu->blkSize = sbdProps->slp_blksize;
- diskLu->luSizeValid = B_TRUE;
+ diskLu->luSizeValid = true;
diskLu->luSize = sbdProps->slp_lu_size;
diskLu->accessState = sbdProps->slp_access_state;
@@ -2397,7 +2396,7 @@ getDiskGlobalProp(uint32_t prop, char *propVal, size_t *propLen)
sbd_global_props_t *sbdProps;
void *sbd_realloc;
int retryCnt = 0;
- boolean_t retry;
+ bool retry;
int ioctlRet;
int savedErrno;
int sbdPropsSize = sizeof (*sbdProps) + MAX_SBD_PROPS;
@@ -2424,7 +2423,7 @@ getDiskGlobalProp(uint32_t prop, char *propVal, size_t *propLen)
}
do {
- retry = B_FALSE;
+ retry = false;
sbdIoctl.stmf_version = STMF_VERSION_1;
sbdIoctl.stmf_obuf_size = sbdPropsSize;
sbdIoctl.stmf_obuf = (uint64_t)(unsigned long)sbdProps;
@@ -2456,7 +2455,7 @@ getDiskGlobalProp(uint32_t prop, char *propVal, size_t *propLen)
ret = STMF_ERROR_NOMEM;
break;
}
- retry = B_TRUE;
+ retry = true;
} else {
ret = STMF_ERROR_NOMEM;
}
@@ -2555,7 +2554,7 @@ setDiskGlobalProp(uint32_t resourceProp, const char *propVal)
propLen = strlen(propVal);
mluBufSize += propLen + 1;
sbdGlobalPropsSize += sizeof (sbd_global_props_t) - 8 +
- max(8, mluBufSize);
+ MAX(8, mluBufSize);
/*
* 8 is the size of the buffer set aside for
* concatenation of variable length fields
@@ -2690,7 +2689,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
switch (prop) {
case STMF_LU_PROP_BLOCK_SIZE:
- if (diskLu->blkSizeValid == B_FALSE) {
+ if (diskLu->blkSizeValid == false) {
return (STMF_ERROR_NO_PROP);
}
reqLen = snprintf(propVal, *propLen, "%llu",
@@ -2701,7 +2700,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_FILENAME:
- if (diskLu->luDataFileNameValid == B_FALSE) {
+ if (diskLu->luDataFileNameValid == false) {
return (STMF_ERROR_NO_PROP);
}
if ((reqLen = strlcpy(propVal, diskLu->luDataFileName,
@@ -2711,7 +2710,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_META_FILENAME:
- if (diskLu->luMetaFileNameValid == B_FALSE) {
+ if (diskLu->luMetaFileNameValid == false) {
return (STMF_ERROR_NO_PROP);
}
if ((reqLen = strlcpy(propVal, diskLu->luMetaFileName,
@@ -2721,7 +2720,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_MGMT_URL:
- if (diskLu->luMgmtUrlValid == B_FALSE) {
+ if (diskLu->luMgmtUrlValid == false) {
return (STMF_ERROR_NO_PROP);
}
if ((reqLen = strlcpy(propVal, diskLu->luMgmtUrl,
@@ -2731,7 +2730,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_GUID:
- if (diskLu->luGuidValid == B_FALSE) {
+ if (diskLu->luGuidValid == false) {
return (STMF_ERROR_NO_PROP);
}
reqLen = snprintf(propVal, *propLen,
@@ -2751,7 +2750,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_SERIAL_NUM:
- if (diskLu->serialNumValid == B_FALSE) {
+ if (diskLu->serialNumValid == false) {
return (STMF_ERROR_NO_PROP);
}
if ((reqLen = strlcpy(propVal, diskLu->serialNum,
@@ -2761,14 +2760,14 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_SIZE:
- if (diskLu->luSizeValid == B_FALSE) {
+ if (diskLu->luSizeValid == false) {
return (STMF_ERROR_NO_PROP);
}
(void) snprintf(propVal, *propLen, "%llu",
(u_longlong_t)diskLu->luSize);
break;
case STMF_LU_PROP_ALIAS:
- if (diskLu->luAliasValid == B_FALSE) {
+ if (diskLu->luAliasValid == false) {
return (STMF_ERROR_NO_PROP);
}
if ((reqLen = strlcpy(propVal, diskLu->luAlias,
@@ -2778,7 +2777,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_VID:
- if (diskLu->vidValid == B_FALSE) {
+ if (diskLu->vidValid == false) {
return (STMF_ERROR_NO_PROP);
}
if (*propLen <= sizeof (diskLu->vid)) {
@@ -2788,7 +2787,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
propVal[sizeof (diskLu->vid)] = 0;
break;
case STMF_LU_PROP_PID:
- if (diskLu->pidValid == B_FALSE) {
+ if (diskLu->pidValid == false) {
return (STMF_ERROR_NO_PROP);
}
if (*propLen <= sizeof (diskLu->pid)) {
@@ -2798,7 +2797,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
propVal[sizeof (diskLu->pid)] = 0;
break;
case STMF_LU_PROP_WRITE_PROTECT:
- if (diskLu->writeProtectEnableValid == B_FALSE) {
+ if (diskLu->writeProtectEnableValid == false) {
return (STMF_ERROR_NO_PROP);
}
if (diskLu->writeProtectEnable) {
@@ -2816,7 +2815,7 @@ getDiskProp(luResourceImpl *hdl, uint32_t prop, char *propVal, size_t *propLen)
}
break;
case STMF_LU_PROP_WRITE_CACHE_DISABLE:
- if (diskLu->writebackCacheDisableValid == B_FALSE) {
+ if (diskLu->writebackCacheDisableValid == false) {
return (STMF_ERROR_NO_PROP);
}
if (diskLu->writebackCacheDisable) {
@@ -2877,7 +2876,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
sizeof (diskLu->luAlias)) {
return (STMF_ERROR_INVALID_PROPSIZE);
}
- diskLu->luAliasValid = B_TRUE;
+ diskLu->luAliasValid = true;
break;
case STMF_LU_PROP_BLOCK_SIZE: {
const char *tmp = propVal;
@@ -2891,7 +2890,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
return (STMF_ERROR_INVALID_PROPSIZE);
}
diskLu->blkSize = numericProp;
- diskLu->blkSizeValid = B_TRUE;
+ diskLu->blkSizeValid = true;
break;
}
case STMF_LU_PROP_COMPANY_ID:
@@ -2912,7 +2911,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
if (diskLu->companyId == 0) {
return (STMF_ERROR_INVALID_ARG);
}
- diskLu->companyIdValid = B_TRUE;
+ diskLu->companyIdValid = true;
break;
case STMF_LU_PROP_HOST_ID:
if ((strlcpy(hostIdProp, propVal,
@@ -2933,7 +2932,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
if (diskLu->hostId == 0) {
return (STMF_ERROR_INVALID_ARG);
}
- diskLu->hostIdValid = B_TRUE;
+ diskLu->hostIdValid = true;
break;
case STMF_LU_PROP_GUID:
if (strlen(propVal) != LU_ASCII_GUID_SIZE) {
@@ -2958,7 +2957,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
for (i = 0; i < sizeof (diskLu->luGuid); i++) {
diskLu->luGuid[i] = guid[i];
}
- diskLu->luGuidValid = B_TRUE;
+ diskLu->luGuidValid = true;
break;
case STMF_LU_PROP_FILENAME:
if ((strlcpy(diskLu->luDataFileName, propVal,
@@ -2966,7 +2965,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
sizeof (diskLu->luDataFileName)) {
return (STMF_ERROR_INVALID_PROPSIZE);
}
- diskLu->luDataFileNameValid = B_TRUE;
+ diskLu->luDataFileNameValid = true;
break;
case STMF_LU_PROP_META_FILENAME:
if ((strlcpy(diskLu->luMetaFileName, propVal,
@@ -2974,7 +2973,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
sizeof (diskLu->luMetaFileName)) {
return (STMF_ERROR_INVALID_PROPSIZE);
}
- diskLu->luMetaFileNameValid = B_TRUE;
+ diskLu->luMetaFileNameValid = true;
break;
case STMF_LU_PROP_MGMT_URL:
if ((strlcpy(diskLu->luMgmtUrl, propVal,
@@ -2982,7 +2981,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
sizeof (diskLu->luMgmtUrl)) {
return (STMF_ERROR_INVALID_PROPSIZE);
}
- diskLu->luMgmtUrlValid = B_TRUE;
+ diskLu->luMgmtUrlValid = true;
break;
case STMF_LU_PROP_PID:
if ((propSize = strlen(propVal)) >
@@ -2990,7 +2989,7 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
return (STMF_ERROR_INVALID_PROPSIZE);
}
(void) strncpy(diskLu->pid, propVal, propSize);
- diskLu->pidValid = B_TRUE;
+ diskLu->pidValid = true;
break;
case STMF_LU_PROP_SERIAL_NUM:
if ((propSize = strlen(propVal)) >
@@ -2998,13 +2997,13 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
return (STMF_ERROR_INVALID_PROPSIZE);
}
(void) strncpy(diskLu->serialNum, propVal, propSize);
- diskLu->serialNumValid = B_TRUE;
+ diskLu->serialNumValid = true;
break;
case STMF_LU_PROP_SIZE:
if ((niceStrToNum(propVal, &diskLu->luSize) != 0)) {
return (STMF_ERROR_INVALID_ARG);
}
- diskLu->luSizeValid = B_TRUE;
+ diskLu->luSizeValid = true;
break;
case STMF_LU_PROP_VID:
if ((propSize = strlen(propVal)) >
@@ -3012,27 +3011,27 @@ setDiskProp(luResourceImpl *hdl, uint32_t resourceProp, const char *propVal)
return (STMF_ERROR_INVALID_PROPSIZE);
}
(void) strncpy(diskLu->vid, propVal, propSize);
- diskLu->vidValid = B_TRUE;
+ diskLu->vidValid = true;
break;
case STMF_LU_PROP_WRITE_PROTECT:
if (strcasecmp(propVal, "TRUE") == 0) {
- diskLu->writeProtectEnable = B_TRUE;
+ diskLu->writeProtectEnable = true;
} else if (strcasecmp(propVal, "FALSE") == 0) {
- diskLu->writeProtectEnable = B_FALSE;
+ diskLu->writeProtectEnable = false;
} else {
return (STMF_ERROR_INVALID_ARG);
}
- diskLu->writeProtectEnableValid = B_TRUE;
+ diskLu->writeProtectEnableValid = true;
break;
case STMF_LU_PROP_WRITE_CACHE_DISABLE:
if (strcasecmp(propVal, "TRUE") == 0) {
- diskLu->writebackCacheDisable = B_TRUE;
+ diskLu->writebackCacheDisable = true;
} else if (strcasecmp(propVal, "FALSE") == 0) {
- diskLu->writebackCacheDisable = B_FALSE;
+ diskLu->writebackCacheDisable = false;
} else {
return (STMF_ERROR_INVALID_ARG);
}
- diskLu->writebackCacheDisableValid = B_TRUE;
+ diskLu->writebackCacheDisableValid = true;
break;
case STMF_LU_PROP_ACCESS_STATE:
ret = STMF_ERROR_INVALID_PROP;
@@ -4859,17 +4858,17 @@ stmfGetViewEntryList(stmfGuid *lu, stmfViewEntryList **viewEntryList)
/* copy to caller's buffer */
for (i = 0; i < listCnt; i++) {
- (*viewEntryList)->ve[i].veIndexValid = B_TRUE;
+ (*viewEntryList)->ve[i].veIndexValid = true;
(*viewEntryList)->ve[i].veIndex = fVeList[i].ve_ndx;
if (fVeList[i].ve_all_hosts == 1) {
- (*viewEntryList)->ve[i].allHosts = B_TRUE;
+ (*viewEntryList)->ve[i].allHosts = true;
} else {
bcopy(fVeList[i].ve_host_group.name,
(*viewEntryList)->ve[i].hostGroup,
fVeList[i].ve_host_group.name_size);
}
if (fVeList[i].ve_all_targets == 1) {
- (*viewEntryList)->ve[i].allTargets = B_TRUE;
+ (*viewEntryList)->ve[i].allTargets = true;
} else {
bcopy(fVeList[i].ve_target_group.name,
(*viewEntryList)->ve[i].targetGroup,
@@ -4877,7 +4876,7 @@ stmfGetViewEntryList(stmfGuid *lu, stmfViewEntryList **viewEntryList)
}
bcopy(fVeList[i].ve_lu_nbr, (*viewEntryList)->ve[i].luNbr,
sizeof ((*viewEntryList)->ve[i].luNbr));
- (*viewEntryList)->ve[i].luNbrValid = B_TRUE;
+ (*viewEntryList)->ve[i].luNbrValid = true;
}
/*
@@ -5193,7 +5192,7 @@ out:
*
*/
int
-stmfGetAluaState(boolean_t *enabled, uint32_t *node)
+stmfGetAluaState(bool *enabled, uint32_t *node)
{
int ret = STMF_STATUS_SUCCESS;
int fd;
@@ -5238,9 +5237,9 @@ stmfGetAluaState(boolean_t *enabled, uint32_t *node)
}
} else {
if (alua_state.alua_state == 1) {
- *enabled = B_TRUE;
+ *enabled = true;
} else {
- *enabled = B_FALSE;
+ *enabled = false;
}
*node = alua_state.alua_node;
}
@@ -5255,7 +5254,7 @@ stmfGetAluaState(boolean_t *enabled, uint32_t *node)
*
*/
int
-stmfSetAluaState(boolean_t enabled, uint32_t node)
+stmfSetAluaState(bool enabled, uint32_t node)
{
int ret = STMF_STATUS_SUCCESS;
int fd;
@@ -5263,7 +5262,7 @@ stmfSetAluaState(boolean_t enabled, uint32_t node)
stmf_alua_state_desc_t alua_state = {0};
int ioctlRet;
- if ((enabled != B_TRUE && enabled != B_FALSE) || (node > 1)) {
+ if ((enabled != true && enabled != false) || (node > 1)) {
return (STMF_ERROR_INVALID_ARG);
}
@@ -6137,7 +6136,7 @@ stmfRemoveViewEntry(stmfGuid *lu, uint32_t viewEntryIndex)
return (ret);
bzero(&ioctlViewEntry, sizeof (ioctlViewEntry));
- ioctlViewEntry.ve_ndx_valid = B_TRUE;
+ ioctlViewEntry.ve_ndx_valid = true;
ioctlViewEntry.ve_ndx = viewEntryIndex;
bcopy(lu, &ioctlViewEntry.ve_guid, sizeof (stmfGuid));
@@ -6340,7 +6339,7 @@ getProviderData(char *providerName, nvlist_t **nvl, int providerType,
int retryCnt = 0;
int retryCntMax = MAX_PROVIDER_RETRY;
stmf_ppioctl_data_t ppi = {0}, *ppi_out = NULL;
- boolean_t retry = B_TRUE;
+ bool retry = true;
stmf_iocdata_t stmfIoctl;
if (providerName == NULL) {
@@ -6411,7 +6410,7 @@ getProviderData(char *providerName, nvlist_t **nvl, int providerType,
free(ppi_out);
ppi_out = NULL;
if (retryCnt++ > retryCntMax) {
- retry = B_FALSE;
+ retry = false;
ret = STMF_ERROR_BUSY;
} else {
ret =
@@ -6574,7 +6573,7 @@ done:
* set the persistence method in the library only or library and service
*/
int
-stmfSetPersistMethod(uint8_t persistType, boolean_t serviceSet)
+stmfSetPersistMethod(uint8_t persistType, bool serviceSet)
{
int ret = STMF_STATUS_SUCCESS;
int oldPersist;
@@ -6583,14 +6582,14 @@ stmfSetPersistMethod(uint8_t persistType, boolean_t serviceSet)
oldPersist = iPersistType;
if (persistType == STMF_PERSIST_NONE ||
persistType == STMF_PERSIST_SMF) {
- iLibSetPersist = B_TRUE;
+ iLibSetPersist = true;
iPersistType = persistType;
} else {
(void) pthread_mutex_unlock(&persistenceTypeLock);
return (STMF_ERROR_INVALID_ARG);
}
/* Is this for this library open or in SMF */
- if (serviceSet == B_TRUE) {
+ if (serviceSet == true) {
ret = psSetServicePersist(persistType);
if (ret != STMF_PS_SUCCESS) {
ret = STMF_ERROR_PERSIST_TYPE;
@@ -6633,7 +6632,7 @@ iGetPersistMethod()
* serviceState
*/
int
-stmfGetPersistMethod(uint8_t *persistType, boolean_t serviceState)
+stmfGetPersistMethod(uint8_t *persistType, bool serviceState)
{
int ret = STMF_STATUS_SUCCESS;
@@ -6785,13 +6784,13 @@ validateLunNumIoctl(int fd, stmfViewEntry *viewEntry)
ioctlViewEntry.ve_all_hosts = viewEntry->allHosts;
ioctlViewEntry.ve_all_targets = viewEntry->allTargets;
- if (viewEntry->allHosts == B_FALSE) {
+ if (viewEntry->allHosts == false) {
bcopy(viewEntry->hostGroup, &ioctlViewEntry.ve_host_group.name,
sizeof (stmfGroupName));
ioctlViewEntry.ve_host_group.name_size =
strlen((char *)viewEntry->hostGroup);
}
- if (viewEntry->allTargets == B_FALSE) {
+ if (viewEntry->allTargets == false) {
bcopy(viewEntry->targetGroup,
&ioctlViewEntry.ve_target_group.name,
sizeof (stmfGroupName));
@@ -6894,18 +6893,18 @@ stmfValidateView(stmfViewEntry *viewEntry)
bcopy(viewEntry->hostGroup, iViewEntry.hostGroup,
sizeof (iViewEntry.hostGroup));
} else {
- iViewEntry.allHosts = B_TRUE;
+ iViewEntry.allHosts = true;
}
if (!viewEntry->allTargets) {
bcopy(viewEntry->targetGroup, iViewEntry.targetGroup,
sizeof (iViewEntry.targetGroup));
} else {
- iViewEntry.allTargets = B_TRUE;
+ iViewEntry.allTargets = true;
}
if (viewEntry->luNbrValid) {
- iViewEntry.luNbrValid = B_TRUE;
+ iViewEntry.luNbrValid = true;
bcopy(viewEntry->luNbr, iViewEntry.luNbr,
sizeof (iViewEntry.luNbr));
}
@@ -6914,7 +6913,7 @@ stmfValidateView(stmfViewEntry *viewEntry)
* set users return view entry index valid flag to false
* in case of failure
*/
- viewEntry->veIndexValid = B_FALSE;
+ viewEntry->veIndexValid = false;
/* Check to ensure service exists */
if (psCheckService() != STMF_STATUS_SUCCESS) {
diff --git a/usr/src/lib/libstmf/common/store.c b/usr/src/lib/libstmf/common/store.c
index b6eabd8..8cebaaa 100644
--- a/usr/src/lib/libstmf/common/store.c
+++ b/usr/src/lib/libstmf/common/store.c
@@ -170,7 +170,7 @@ struct sigaction currentActionQuit;
struct sigaction currentActionTerm;
struct sigaction currentActionInt;
-boolean_t actionSet = B_FALSE;
+bool actionSet = false;
/*
* Version info for the SMF schema
@@ -303,7 +303,7 @@ int addRemoveFlag)
int ret = STMF_PS_SUCCESS;
char buf[STMF_IDENT_LENGTH];
int commitRet;
- boolean_t found = B_FALSE;
+ bool found = false;
assert(pgName != NULL && groupName != NULL && memberName != NULL);
@@ -445,7 +445,7 @@ int addRemoveFlag)
ret = STMF_PS_ERROR_EXISTS;
break;
} else {
- found = B_TRUE;
+ found = true;
continue;
}
}
@@ -640,7 +640,7 @@ iPsAddRemoveLuViewEntry(char *luPgName, char *viewEntryPgName,
scf_transaction_t *tran = NULL;
scf_transaction_entry_t *entry = NULL;
scf_transaction_entry_t *entryVeName = NULL;
- boolean_t createVeCnt = B_FALSE;
+ bool createVeCnt = false;
uint64_t veCnt = 0;
int ret = STMF_PS_SUCCESS;
int commitRet;
@@ -682,7 +682,7 @@ iPsAddRemoveLuViewEntry(char *luPgName, char *viewEntryPgName,
ret = STMF_PS_ERROR;
} else {
/* we need to create the VE_CNT property */
- createVeCnt = B_TRUE;
+ createVeCnt = true;
ret = STMF_PS_SUCCESS;
}
} else if (scf_error() == SCF_ERROR_NOT_FOUND) {
@@ -931,7 +931,7 @@ iPsAddViewEntry(char *luPgName, char *viewEntryPgName, stmfViewEntry *viewEntry)
int j = 0;
int ret;
uint8_t scfBool;
- boolean_t createdVePg = B_FALSE;
+ bool createdVePg = false;
int backoutRet;
int commitRet;
@@ -990,7 +990,7 @@ iPsAddViewEntry(char *luPgName, char *viewEntryPgName, stmfViewEntry *viewEntry)
goto out;
}
- createdVePg = B_TRUE;
+ createdVePg = true;
/*
* Add the view entry as properties on the view entry group
@@ -1290,7 +1290,7 @@ psClearProviderData(char *providerName, int providerType)
scf_propertygroup_t *pg = NULL;
char pgName[MAXPATHLEN];
int ret = STMF_PS_SUCCESS;
- boolean_t pgNotFound = B_FALSE;
+ bool pgNotFound = false;
if (providerName == NULL || (providerType != STMF_LU_PROVIDER_TYPE &&
providerType != STMF_PORT_PROVIDER_TYPE)) {
@@ -1329,7 +1329,7 @@ psClearProviderData(char *providerName, int providerType)
ret = STMF_PS_ERROR;
goto out;
} else {
- pgNotFound = B_TRUE;
+ pgNotFound = true;
}
}
@@ -1393,7 +1393,7 @@ iPsCreateDeleteGroup(char *pgRefName, char *groupName, int addRemoveFlag)
char buf1[MAXNAMELEN];
char buf2[MAXNAMELEN];
char tmpbuf[MAXNAMELEN];
- boolean_t found = B_FALSE;
+ bool found = false;
int ret = STMF_PS_SUCCESS;
int commitRet;
@@ -1492,7 +1492,7 @@ iPsCreateDeleteGroup(char *pgRefName, char *groupName, int addRemoveFlag)
if (addRemoveFlag == ADD) {
ret = STMF_PS_ERROR_EXISTS;
}
- found = B_TRUE;
+ found = true;
/*
* buf1 contains the name for REMOVE
*/
@@ -3741,7 +3741,7 @@ iPsGetViewEntry(char *viewEntryPgName, stmfViewEntry *viewEntry)
/* Set the index */
viewEntry->veIndex = atoi(strtok(++indexPtr, "-"));
- viewEntry->veIndexValid = B_TRUE;
+ viewEntry->veIndexValid = true;
/* get allHosts property */
if (scf_pg_get_property(pg, STMF_VE_ALLHOSTS,
@@ -3884,7 +3884,7 @@ iPsGetViewEntry(char *viewEntryPgName, stmfViewEntry *viewEntry)
goto out;
}
/* set luNbrValid to true since we just got it */
- viewEntry->luNbrValid = B_TRUE;
+ viewEntry->luNbrValid = true;
out:
/*
@@ -4009,7 +4009,7 @@ psGetProviderData(char *providerName, nvlist_t **nvl, int providerType,
char dataPropertyName[STMF_PROVIDER_DATA_PROP_NAME_SIZE];
char *nvlistEncoded = NULL;
ssize_t nvlistEncodedSize = 0;
- boolean_t foundSetCnt = B_TRUE;
+ bool foundSetCnt = true;
int i;
int ret = STMF_PS_SUCCESS;
@@ -4101,7 +4101,7 @@ psGetProviderData(char *providerName, nvlist_t **nvl, int providerType,
if (scf_pg_get_property(pg, STMF_PROVIDER_DATA_PROP_SET_COUNT,
prop) == -1) {
if (scf_error() == SCF_ERROR_NOT_FOUND) {
- foundSetCnt = B_FALSE;
+ foundSetCnt = false;
} else {
syslog(LOG_ERR, "get property %s/%s "
"failed - %s", pgName,
@@ -4444,7 +4444,7 @@ psSetProviderData(char *providerName, nvlist_t *nvl, int providerType,
scf_value_t *value4 = NULL;
scf_value_t *value5 = NULL;
- boolean_t newPg = B_FALSE;
+ bool newPg = false;
char pgName[MAXPATHLEN];
char dataPropertyName[STMF_PROVIDER_DATA_PROP_NAME_SIZE];
char *nvlistEncoded = NULL;
@@ -4456,7 +4456,7 @@ psSetProviderData(char *providerName, nvlist_t *nvl, int providerType,
uint64_t oldBlockCnt = 0;
uint64_t blockCnt = 0;
uint64_t setCnt = 0;
- boolean_t foundSetCnt = B_TRUE;
+ bool foundSetCnt = true;
int ret = STMF_PS_SUCCESS;
int commitRet;
@@ -4519,7 +4519,7 @@ psSetProviderData(char *providerName, nvlist_t *nvl, int providerType,
ret = STMF_PS_ERROR;
goto out;
}
- newPg = B_TRUE;
+ newPg = true;
}
}
@@ -4577,7 +4577,7 @@ psSetProviderData(char *providerName, nvlist_t *nvl, int providerType,
if (scf_pg_get_property(pg, STMF_PROVIDER_DATA_PROP_SET_COUNT,
prop) == -1) {
if (scf_error() == SCF_ERROR_NOT_FOUND) {
- foundSetCnt = B_FALSE;
+ foundSetCnt = false;
} else {
syslog(LOG_ERR, "get property %s/%s failed - %s",
pgName, STMF_PROVIDER_DATA_PROP_SET_COUNT,
@@ -5300,7 +5300,7 @@ holdSignal(sigset_t *sigmaskRestore)
return (1);
}
- actionSet = B_TRUE;
+ actionSet = true;
}
/*
@@ -5354,7 +5354,7 @@ releaseSignal(sigset_t *sigmaskRestore)
ret = 1;
}
- actionSet = B_FALSE;
+ actionSet = false;
/*
* Restore previous signal mask for this thread