- case 'm':
- cmMemOpenMemLkFile(msOptArg);
- break;
-#endif
- case 'o':
- osCp.dep.fileOutFp = fopen(msOptArg, "w");
- break;
- case 'f':
- fileBasedMemCfg = TRUE;
- memOpt = fopen(msOptArg, "r");
-
- /* if file does not exist or could not be opened then use the
- * default memory configuration as defined in mt_ss.h
- */
- if (memOpt == (FILE *) NULLP)
- {
- sprintf(pBuf, "\nMTSS: Memory configuration file: %s could not\
- be opened, using default mem configuration\n", msOptArg);
- SPrint(pBuf);
- break;
- }
- i = 0;
- while (fgets((Txt *)line, 256, memOpt) != NULLP)
- {
- if(line[0] == '#' || line[0] < '0' || line[0] > '9') /* Comment line or non numeric character, so skip it and read next line */
- continue;
- if(error == TRUE)
- break;
- switch (i)
- {
- case 0: /*** INPUT: Number of regions ***/
- sscanf(line, "%ld", (long *) &numReg);
- mtMemoCfg.numRegions = numReg;
- if(mtMemoCfg.numRegions > SS_MAX_REGS)
- {
- printf("\n No. of regions are > SS_MAX_REGS:%d \n",SS_MAX_REGS);
- error = TRUE;
- break;
- }
- i++;
- break;
- case 1: /*** INPUT: Number of buckets and number of Pools ***/
- sscanf(line, "%ld %ld", (long *) &numBkts, (long *) &numPools);
- if(numBkts > MT_MAX_BKTS)
- {
- printf("\n No. of buckets are > MT_MAX_BKTS :%d \n",MT_MAX_BKTS);
- error = TRUE;
- break;
- }
- if(numPools > SS_MAX_POOLS_PER_REG)
- {
- printf("\n No. of pools are > SS_MAX_POOLS_PER_REG:%d \n",SS_MAX_POOLS_PER_REG);
- error = TRUE;
- break;
- }
- /*
- * Delay updation from local variable to global
- * structure of number of regions and heap data to
- * counter error conditions present above.
- */
- for(idx = 0; idx < cfgNumRegs; idx++)
- {
- mtMemoCfg.region[idx].numBkts = numBkts;
- cfgRegInfo[idx].region = idx;
- cfgRegInfo[idx].numPools = numPools;
- /*
- * Initialize the pool info as static type with size zero
- */
- for(poolIdx = 0; poolIdx < numPools; poolIdx++)
- {
- cfgRegInfo[idx].pools[poolIdx].type = SS_POOL_STATIC;
- cfgRegInfo[idx].pools[poolIdx].size = 0;
- }
- }
- i++;
- break;
- case 2: /*** INPUT: Bucket Id and size of the bucket ***/
- if(bktUpdtCnt < numBkts) /* more set of bucket can be added */
- {
- sscanf(line, "%ld %ld",(long *)&bktIdx, (long *) &bktSz);
- }
- if(bktIdx >= numBkts)
- {
- printf("\n Invalid Bucket Id, may be >= the No. of buckets:%ld\n",numBkts);
- error = TRUE;
- break;
-
- }
- mtBktInfo[bktIdx].blkSize = bktSz;
- bktUpdtCnt++;
- if(bktUpdtCnt == numBkts)
- {
- i++; /*done reading bkt info, start reading individual region info*/
- bktUpdtCnt = 0;
- }
- break;
- case 3: /*** INPUT: Region Id (ranges from 0 to numRegions-1) **/
- sscanf(line,"%ld",(long *) ®Id);
- if(regId >= mtMemoCfg.numRegions)
- {
- printf("\n Invalid Region Id, may be >= the No. of regions:%d\n",mtMemoCfg.numRegions);
+ case 'm':
+ cmMemOpenMemLkFile(msOptArg);
+ break;
+#endif
+ case 'o':
+ osCp.dep.fileOutFp = fopen(msOptArg, "w");
+ break;
+ case 'f':
+ fileBasedMemCfg = TRUE;
+ memOpt = fopen(msOptArg, "r");
+
+ /* if file does not exist or could not be opened then use the
+ * default memory configuration as defined in mt_ss.h
+ */
+ if (memOpt == (FILE *) NULLP)
+ {
+ sprintf(pBuf, "\nMTSS: Memory configuration file: %s could not\
+ be opened, using default mem configuration\n", msOptArg);
+ SPrint(pBuf);
+ break;
+ }
+ i = 0;
+ while (fgets((Txt *)line, 256, memOpt) != NULLP)
+ {
+ if(line[0] == '#' || line[0] < '0' || line[0] > '9') /* Comment line or non numeric character, so skip it and read next line */
+ continue;
+ if(error == TRUE)
+ break;
+ switch (i)
+ {
+ case 0: /*** INPUT: Number of regions ***/
+ sscanf(line, "%ld", (long *) &numReg);
+ mtMemoCfg.numRegions = numReg;
+ if(mtMemoCfg.numRegions > SS_MAX_REGS)
+ {
+ printf("\n No. of regions are > SS_MAX_REGS:%d \n",SS_MAX_REGS);
+ error = TRUE;
+ break;
+ }
+ i++;
+ break;
+ case 1: /*** INPUT: Number of buckets and number of Pools ***/
+ sscanf(line, "%ld %ld", (long *) &numBkts, (long *) &numPools);
+ if(numBkts > MT_MAX_BKTS)
+ {
+ printf("\n No. of buckets are > MT_MAX_BKTS :%d \n",MT_MAX_BKTS);
+ error = TRUE;
+ break;
+ }
+ if(numPools > SS_MAX_POOLS_PER_REG)
+ {
+ printf("\n No. of pools are > SS_MAX_POOLS_PER_REG:%d \n",SS_MAX_POOLS_PER_REG);
+ error = TRUE;
+ break;
+ }
+ /*
+ * Delay updation from local variable to global
+ * structure of number of regions and heap data to
+ * counter error conditions present above.
+ */
+ for(idx = 0; idx < cfgNumRegs; idx++)
+ {
+ mtMemoCfg.region[idx].numBkts = numBkts;
+ cfgRegInfo[idx].region = idx;
+ cfgRegInfo[idx].numPools = numPools;
+ /*
+ * Initialize the pool info as static type with size zero
+ */
+ for(poolIdx = 0; poolIdx < numPools; poolIdx++)
+ {
+ cfgRegInfo[idx].pools[poolIdx].type = SS_POOL_STATIC;
+ cfgRegInfo[idx].pools[poolIdx].size = 0;
+ }
+ }
+ i++;
+ break;
+ case 2: /*** INPUT: Bucket Id and size of the bucket ***/
+ if(bktUpdtCnt < numBkts) /* more set of bucket can be added */
+ {
+ sscanf(line, "%ld %ld",(long *)&bktIdx, (long *) &bktSz);
+ }
+ if(bktIdx >= numBkts)
+ {
+ printf("\n Invalid Bucket Id, may be >= the No. of buckets:%ld\n",numBkts);
+ error = TRUE;
+ break;
+
+ }
+ mtBktInfo[bktIdx].blkSize = bktSz;
+ bktUpdtCnt++;
+ if(bktUpdtCnt == numBkts)
+ {
+ i++; /*done reading bkt info, start reading individual region info*/
+ bktUpdtCnt = 0;
+ }
+ break;
+ case 3: /*** INPUT: Region Id (ranges from 0 to numRegions-1) **/
+ sscanf(line,"%ld",(long *) ®Id);
+ if(regId >= mtMemoCfg.numRegions)
+ {
+ printf("\n Invalid Region Id, may be >= the No. of regions:%d\n",mtMemoCfg.numRegions);