#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header$");
+RCSID
+ ("$Header$");
#include <afs/stds.h>
/* Local declarations and definitions */
-#define CSDB_OP_ADD 0 /* add a client CellServDB entry */
-#define CSDB_OP_REM 1 /* remove a client CellServDB entry */
+#define CSDB_OP_ADD 0 /* add a client CellServDB entry */
+#define CSDB_OP_REM 1 /* remove a client CellServDB entry */
static int
-ClientCellServDbUpdate(int updateOp,
- void *hostHandle,
- const char *cellName,
- const char *dbentry,
- afs_status_p st);
+ ClientCellServDbUpdate(int updateOp, void *hostHandle, const char *cellName,
+ const char *dbentry, afs_status_p st);
static int
-CacheManagerStart(unsigned timeout,
- afs_status_p st);
+ CacheManagerStart(unsigned timeout, afs_status_p st);
static int
-CacheManagerStop(unsigned timeout,
- afs_status_p st);
+ CacheManagerStop(unsigned timeout, afs_status_p st);
* client (cache-manager); for example, the AFS Server Manager.
*/
int ADMINAPI
-cfg_ClientQueryStatus(const char *hostName, /* name of host */
- short *isInstalledP, /* client software installed */
- unsigned *versionP, /* client software version */
- afs_status_p configStP, /* client config status */
- char **cellNameP, /* client's cell */
- afs_status_p st) /* completion status */
-{
+cfg_ClientQueryStatus(const char *hostName, /* name of host */
+ short *isInstalledP, /* client software installed */
+ unsigned *versionP, /* client software version */
+ afs_status_p configStP, /* client config status */
+ char **cellNameP, /* client's cell */
+ afs_status_p st)
+{ /* completion status */
int rc = 1;
afs_status_t tst2, tst = 0;
afs_status_t clientSt = 0;
if (tst == 0) {
DWORD svcState;
- if (!cfgutil_WindowsServiceQuery(AFSREG_CLT_SVC_NAME,
- &svcState,
- &tst2)) {
+ if (!cfgutil_WindowsServiceQuery
+ (AFSREG_CLT_SVC_NAME, &svcState, &tst2)) {
/* CM not installed, or insufficient privilege to check */
if (tst2 == ADMNOPRIV) {
tst = tst2;
/* no cell set for client */
clientSt = ADMCFGCLIENTNOTINCELL;
} else {
- for (cellentry = confdir->entries;
- cellentry != NULL;
+ for (cellentry = confdir->entries; cellentry != NULL;
cellentry = cellentry->next) {
- if (!strcasecmp(confdir->cellName,
- cellentry->cellInfo.name)) {
+ if (!strcasecmp
+ (confdir->cellName, cellentry->cellInfo.name)) {
break;
}
}
if (tst == 0 && clientSt == 0) {
/* everything looks good; malloc cell name buffer to return */
clientCellName =
- (char *) malloc(strlen(cellentry->cellInfo.name) + 1);
+ (char *)malloc(strlen(cellentry->cellInfo.name) + 1);
if (clientCellName == NULL) {
tst = ADMNOMEM;
} else {
* Warning: client (cache-manager) should be stopped prior to setting cell.
*/
int ADMINAPI
-cfg_ClientSetCell(void *hostHandle, /* host config handle */
- const char *cellName, /* cell name */
- const char *cellDbHosts, /* cell database hosts */
- afs_status_p st) /* completion status */
-{
+cfg_ClientSetCell(void *hostHandle, /* host config handle */
+ const char *cellName, /* cell name */
+ const char *cellDbHosts, /* cell database hosts */
+ afs_status_p st)
+{ /* completion status */
int rc = 1;
afs_status_t tst2, tst = 0;
- cfg_host_p cfg_host = (cfg_host_p)hostHandle;
+ cfg_host_p cfg_host = (cfg_host_p) hostHandle;
/* validate parameters */
tst = ADMCFGHOSTNAMETOOLONG;
} else if (dbHostCount >= MAXHOSTSPERCELL) {
tst = ADMCFGCELLDBHOSTCOUNTTOOLARGE;
- } else if (!cfgutil_HostNameGetAddressString(dbHost,
- &dbHostAddrStr,
- &tst2)) {
+ } else
+ if (!cfgutil_HostNameGetAddressString
+ (dbHost, &dbHostAddrStr, &tst2)) {
tst = tst2;
- } else if (CSDB_AddCellServer(&clientDb,
- cellLinep,
- dbHostAddrStr,
- dbHost) == NULL) {
+ } else
+ if (CSDB_AddCellServer
+ (&clientDb, cellLinep, dbHostAddrStr,
+ dbHost) == NULL) {
tst = ADMNOMEM;
} else {
dbHostCount++;
* cfg_ClientCellServDbAdd() -- Add entry to client CellServDB on host.
*/
int ADMINAPI
-cfg_ClientCellServDbAdd(void *hostHandle, /* host config handle */
- const char *cellName, /* cell name */
- const char *dbentry, /* cell database entry */
- afs_status_p st) /* completion status */
-{
- return ClientCellServDbUpdate(CSDB_OP_ADD,
- hostHandle,
- cellName,
- dbentry,
+cfg_ClientCellServDbAdd(void *hostHandle, /* host config handle */
+ const char *cellName, /* cell name */
+ const char *dbentry, /* cell database entry */
+ afs_status_p st)
+{ /* completion status */
+ return ClientCellServDbUpdate(CSDB_OP_ADD, hostHandle, cellName, dbentry,
st);
}
* on host.
*/
int ADMINAPI
-cfg_ClientCellServDbRemove(void *hostHandle, /* host config handle */
- const char *cellName, /* cell name */
- const char *dbentry, /* cell database entry */
- afs_status_p st) /* completion status */
-{
- return ClientCellServDbUpdate(CSDB_OP_REM,
- hostHandle,
- cellName,
- dbentry,
+cfg_ClientCellServDbRemove(void *hostHandle, /* host config handle */
+ const char *cellName, /* cell name */
+ const char *dbentry, /* cell database entry */
+ afs_status_p st)
+{ /* completion status */
+ return ClientCellServDbUpdate(CSDB_OP_REM, hostHandle, cellName, dbentry,
st);
}
* Timeout is the maximum time (in seconds) to wait for client to stop.
*/
int ADMINAPI
-cfg_ClientStop(void *hostHandle, /* host config handle */
- unsigned int timeout, /* timeout in seconds */
- afs_status_p st) /* completion status */
-{
+cfg_ClientStop(void *hostHandle, /* host config handle */
+ unsigned int timeout, /* timeout in seconds */
+ afs_status_p st)
+{ /* completion status */
int rc = 1;
afs_status_t tst2, tst = 0;
- cfg_host_p cfg_host = (cfg_host_p)hostHandle;
+ cfg_host_p cfg_host = (cfg_host_p) hostHandle;
/* validate parameters */
* Timeout is the maximum time (in seconds) to wait for client to start.
*/
int ADMINAPI
-cfg_ClientStart(void *hostHandle, /* host config handle */
- unsigned int timeout, /* timeout in seconds */
- afs_status_p st) /* completion status */
-{
+cfg_ClientStart(void *hostHandle, /* host config handle */
+ unsigned int timeout, /* timeout in seconds */
+ afs_status_p st)
+{ /* completion status */
int rc = 1;
afs_status_t tst2, tst = 0;
- cfg_host_p cfg_host = (cfg_host_p)hostHandle;
+ cfg_host_p cfg_host = (cfg_host_p) hostHandle;
/* validate parameters */
* Common function implementing cfg_ClientCellServDb{Add/Remove}().
*/
static int
-ClientCellServDbUpdate(int updateOp,
- void *hostHandle,
- const char *cellName,
- const char *dbentry,
- afs_status_p st)
+ClientCellServDbUpdate(int updateOp, void *hostHandle, const char *cellName,
+ const char *dbentry, afs_status_p st)
{
int rc = 1;
afs_status_t tst2, tst = 0;
- cfg_host_p cfg_host = (cfg_host_p)hostHandle;
+ cfg_host_p cfg_host = (cfg_host_p) hostHandle;
char dbentryFull[MAXHOSTCHARS];
/* validate parameters and resolve dbentry to fully qualified name */
/* found cellName, now find server to add/remove */
CELLDBLINE *workingLinep;
- for (workingLinep = cellLinep->pNext;
- workingLinep != NULL;
+ for (workingLinep = cellLinep->pNext; workingLinep != NULL;
workingLinep = workingLinep->pNext) {
CELLDBLINEINFO lineInfo;
serverLineCount++;
- if (!cfgutil_HostAddressIsValid(dbentryFull,
- dbentryAddr,
- &isValid,
- &tst2)) {
+ if (!cfgutil_HostAddressIsValid
+ (dbentryFull, dbentryAddr, &isValid, &tst2)) {
tst = tst2;
break;
} else if (isValid) {
if (tst == 0) {
if (updateOp == CSDB_OP_ADD && serverLinep == NULL) {
if (cellLinep == NULL) {
- cellLinep = CSDB_AddCell(&clientDb,
- cellName, NULL, NULL);
+ cellLinep =
+ CSDB_AddCell(&clientDb, cellName, NULL, NULL);
}
if (cellLinep == NULL) {
} else {
const char *dbentryAddrStr;
- if (!cfgutil_HostNameGetAddressString(dbentryFull,
- &dbentryAddrStr,
- &tst2)) {
+ if (!cfgutil_HostNameGetAddressString
+ (dbentryFull, &dbentryAddrStr, &tst2)) {
tst = tst2;
} else {
- serverLinep = CSDB_AddCellServer(&clientDb,
- cellLinep,
- dbentryAddrStr,
- dbentryFull);
+ serverLinep =
+ CSDB_AddCellServer(&clientDb, cellLinep,
+ dbentryAddrStr,
+ dbentryFull);
if (serverLinep == NULL) {
tst = ADMNOMEM;
}
* RETURN CODES: 1 success, 0 failure (st indicates why)
*/
static int
-CacheManagerStart(unsigned timeout,
- afs_status_p st)
+CacheManagerStart(unsigned timeout, afs_status_p st)
{
int rc = 1;
afs_status_t tst2, tst = 0;
/* Windows - cache manager is a service */
short wasRunning;
- if (!cfgutil_WindowsServiceStart(AFSREG_CLT_SVC_NAME,
- 0, NULL,
- timeout,
- &wasRunning,
- &tst2)) {
+ if (!cfgutil_WindowsServiceStart
+ (AFSREG_CLT_SVC_NAME, 0, NULL, timeout, &wasRunning, &tst2)) {
tst = tst2;
}
#else
* RETURN CODES: 1 success, 0 failure (st indicates why)
*/
static int
-CacheManagerStop(unsigned timeout,
- afs_status_p st)
+CacheManagerStop(unsigned timeout, afs_status_p st)
{
int rc = 1;
afs_status_t tst2, tst = 0;
/* Windows - cache manager is a service */
short wasStopped;
- if (!cfgutil_WindowsServiceStop(AFSREG_CLT_SVC_NAME,
- timeout,
- &wasStopped,
- &tst2)) {
+ if (!cfgutil_WindowsServiceStop
+ (AFSREG_CLT_SVC_NAME, timeout, &wasStopped, &tst2)) {
tst = tst2;
}
#else