diff --git a/src/afs/HPUX/osi_vnodeops.c b/src/afs/HPUX/osi_vnodeops.c index 711cae8e0b..85b5e56a12 100644 --- a/src/afs/HPUX/osi_vnodeops.c +++ b/src/afs/HPUX/osi_vnodeops.c @@ -789,7 +789,7 @@ afspgin_setup_io_ranges(vfspage_t * vm_info, pgcnt_t bpages, k_off_t isize, start_blk = dbd->dbd_data; maxpage = startindex + (bpages - (startindex + file_offset) % bpages); - maxpage = min(maxpage, multio_maxpage); + maxpage = opr_min(maxpage, multio_maxpage); count = expand_faultin_up(vm_info, dbdtype, bpages, maxpage, 1 /* count */ , diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index 17905b2a3d..7013188f6c 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -2482,14 +2482,14 @@ afsd_run(void) if (!filesSet) { cacheFiles = cacheBlocks / 32; /* Assume 32k avg filesize */ - cacheFiles = max(cacheFiles, 1000); + cacheFiles = opr_max(cacheFiles, 1000); /* Always allow more files than chunks. Presume average V-file * is ~67% of a chunk... (another guess, perhaps Honeyman will * have a grad student write a paper). i is KILOBYTES. */ i = 1 << (chunkSize < 10 ? 0 : chunkSize - 10); - cacheFiles = max(cacheFiles, 1.5 * (cacheBlocks / i)); + cacheFiles = opr_max(cacheFiles, 1.5 * (cacheBlocks / i)); /* never permit more files than blocks, while leaving space for * VolumeInfo and CacheItems files. VolumeInfo is usually 20K, diff --git a/src/afsmonitor/afsmon-output.c b/src/afsmonitor/afsmon-output.c index 7aa98eb157..72acc12be5 100644 --- a/src/afsmonitor/afsmon-output.c +++ b/src/afsmonitor/afsmon-output.c @@ -461,7 +461,7 @@ Print_fs_CallBackStats(struct xstat_fs_ProbeResults *a_fs_Results) a_fs_Results->collectionNumber, a_fs_Results->connP->hostName, a_fs_Results->probeNum, printableTime); - numInt32s = min(numInt32s, sizeof(CbCounterStrings)/sizeof(*CbCounterStrings)); + numInt32s = opr_min(numInt32s, sizeof(CbCounterStrings)/sizeof(*CbCounterStrings)); for (i=0; idata.AFS_CollData_len = - min(xstat_fs_Results.data.AFS_CollData_len, + opr_min(xstat_fs_Results.data.AFS_CollData_len, afsmon_fs_results_length[index]); memcpy(tmp_fsPR->data.AFS_CollData_val, xstat_fs_Results.data.AFS_CollData_val, @@ -2650,7 +2650,7 @@ save_CM_results_inCB(int a_newProbeCycle) /* start of new probe cycle ? */ /* copy the probe data information */ tmp_cmPR->data.AFSCB_CollData_len = - min(xstat_cm_Results.data.AFSCB_CollData_len, + opr_min(xstat_cm_Results.data.AFSCB_CollData_len, afsmon_cm_results_length[index]); memcpy(tmp_cmPR->data.AFSCB_CollData_val, xstat_cm_Results.data.AFSCB_CollData_val, diff --git a/src/aklog/aklog.c b/src/aklog/aklog.c index 3dba5f4561..ec2393713b 100644 --- a/src/aklog/aklog.c +++ b/src/aklog/aklog.c @@ -715,7 +715,7 @@ rxkad_build_native_token(krb5_context context, krb5_creds *v5cred, } } #else - len = min(get_princ_len(context, v5cred->client, 0), + len = opr_min(get_princ_len(context, v5cred->client, 0), second_comp(context, v5cred->client) ? MAXKTCNAMELEN - 2 : MAXKTCNAMELEN - 1); strncpy(username, get_princ_str(context, v5cred->client, 0), len); @@ -724,7 +724,7 @@ rxkad_build_native_token(krb5_context context, krb5_creds *v5cred, if (second_comp(context, v5cred->client)) { strcat(username, "."); p = username + strlen(username); - len = min(get_princ_len(context, v5cred->client, 1), + len = opr_min(get_princ_len(context, v5cred->client, 1), MAXKTCNAMELEN - strlen(username) - 1); strncpy(p, get_princ_str(context, v5cred->client, 1), len); p[len] = '\0'; diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 004ac1f7e9..357396a7a4 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -593,7 +593,7 @@ GetToken(struct ktc_principal *aserver, struct ktc_token *atoken, == 0) && (strcmp(local_tokens[i].server.cell, aserver->cell) == 0)) { memcpy(atoken, &local_tokens[i].token, - min(atokenLen, sizeof(struct ktc_token))); + opr_min(atokenLen, sizeof(struct ktc_token))); if (aclient) *aclient = local_tokens[i].client; UNLOCK_GLOBAL_MUTEX; @@ -624,7 +624,7 @@ GetToken(struct ktc_principal *aserver, struct ktc_token *atoken, if (aclient) strcpy(aclient->cell, lcell); memcpy(atoken, &ctoken, - min(atokenLen, sizeof(struct ktc_token))); + opr_min(atokenLen, sizeof(struct ktc_token))); afs_tf_close(); UNLOCK_GLOBAL_MUTEX; diff --git a/src/auth/ktc_nt.c b/src/auth/ktc_nt.c index 36575be80c..009729bdad 100644 --- a/src/auth/ktc_nt.c +++ b/src/auth/ktc_nt.c @@ -984,7 +984,7 @@ GetLocalToken(struct ktc_principal *aserver, struct ktc_token *atoken, 0) && (strcmp(local_tokens[i].server.cell, aserver->cell) == 0)) { memcpy(atoken, &local_tokens[i].token, - min(atokenLen, sizeof(struct ktc_token))); + opr_min(atokenLen, sizeof(struct ktc_token))); memcpy(aclient, &local_tokens[i].client, sizeof(struct ktc_principal)); UNLOCK_GLOBAL_MUTEX; diff --git a/src/bucoord/ubik_db_if.c b/src/bucoord/ubik_db_if.c index 6188388e39..ab0bc90195 100644 --- a/src/bucoord/ubik_db_if.c +++ b/src/bucoord/ubik_db_if.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -581,7 +582,7 @@ bcdb_SaveTextFile(udbClientTextP ctPtr) offset = 0; while (fileSize != 0) { - chunkSize = min(fileSize, bufferSize); + chunkSize = opr_min(fileSize, bufferSize); code = fread(charList.charListT_val, sizeof(char), chunkSize, ctPtr->textStream); diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index 504514443d..c9da2dae2f 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -499,7 +499,7 @@ writeText(struct ubik_trans *ut, int fid, int textType) if (code) ERROR(code); - writeSize = min(textSize, BLOCK_DATA_SIZE); + writeSize = opr_min(textSize, BLOCK_DATA_SIZE); if (!writeSize) break; diff --git a/src/budb/db_text.c b/src/budb/db_text.c index d66d8344db..54f1f04efa 100644 --- a/src/budb/db_text.c +++ b/src/budb/db_text.c @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -110,7 +111,7 @@ GetText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType, /* compute minimum of remaining text or user buffer */ textRemaining = ntohl(tbPtr->size) - offset; - transferSize = min(textRemaining, maxLength); + transferSize = opr_min(textRemaining, maxLength); /* allocate the transfer storage */ if (transferSize <= 0) { @@ -149,7 +150,7 @@ GetText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType, /* compute the data size to extract */ blockOffset = offset % BLOCK_DATA_SIZE; textRemaining = BLOCK_DATA_SIZE - blockOffset; - chunkSize = min(textRemaining, transferSize); + chunkSize = opr_min(textRemaining, transferSize); memcpy(textPtr, &block.a[blockOffset], chunkSize); @@ -365,7 +366,7 @@ SaveText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType, while (textLength) { /* compute the transfer size */ remainingInBlock = (BLOCK_DATA_SIZE - (offset % BLOCK_DATA_SIZE)); - chunkSize = min(remainingInBlock, textLength); + chunkSize = opr_min(remainingInBlock, textLength); /* copy in the data */ memcpy(&diskBlock.a[offset % BLOCK_DATA_SIZE], textptr, chunkSize); @@ -466,7 +467,7 @@ saveTextToFile(struct ubik_trans *ut, struct textBlock *tbPtr) totalSize = size = ntohl(tbPtr->size); blockAddr = ntohl(tbPtr->textAddr); while (size) { - chunkSize = min(BLOCK_DATA_SIZE, size); + chunkSize = opr_min(BLOCK_DATA_SIZE, size); dbread(ut, blockAddr, (char *)&block, sizeof(block)); if (write(fid, &block.a[0], chunkSize) < 0) break; diff --git a/src/butc/afsxbsa.c b/src/butc/afsxbsa.c index d8ec545d12..66980c1982 100644 --- a/src/butc/afsxbsa.c +++ b/src/butc/afsxbsa.c @@ -1538,7 +1538,7 @@ ObjectDescriptor *BSAobjDescP for that max len as well. For now these are the same value. ================================================================*/ if (strlen(BSAqryDescP->objName.pathName) > - min(DSM_MAX_HL_LENGTH, BSA_MAX_PATHNAME)) + opr_min(DSM_MAX_HL_LENGTH, BSA_MAX_PATHNAME)) { sprintf(traceStr2, "BSAQueryObject: pathName too long (%" AFS_SIZET_FMT ")", strlen(BSAqryDescP->objName.pathName)); @@ -2423,7 +2423,7 @@ BSA_Int16 BSACreateObject( check for that max len as well. For now these are the same value. =================================================================*/ if (strlen(BSAobjDescP->objName.pathName) > - min(DSM_MAX_HL_LENGTH, BSA_MAX_PATHNAME)) + opr_min(DSM_MAX_HL_LENGTH, BSA_MAX_PATHNAME)) { sprintf(traceStr2, "BSACreateObject: pathName too long (%" AFS_SIZET_FMT ")", strlen(BSAobjDescP->objName.pathName)); @@ -2755,7 +2755,7 @@ BSA_Int16 BSAMarkObjectInactive( check for that max len as well. For now these are the same value. =============================================================== */ if (strlen(BSAobjNameP->pathName) > - min(DSM_MAX_HL_LENGTH, BSA_MAX_PATHNAME)) + opr_min(DSM_MAX_HL_LENGTH, BSA_MAX_PATHNAME)) { sprintf(traceStr2, "BSAMarkObjectInactive: pathName too long (%" AFS_SIZET_FMT ")", strlen(BSAobjNameP->pathName)); diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index c91fbb49b4..33d43ff6d9 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -700,7 +700,7 @@ ChangePassWord(struct rx_call *call, char *aname, char *ainstance, if ((code = DES_key_sched(ktc_to_cblock(&tentry.key), &user_schedule))) es_Report("In KAChangePassword: key_sched returned %d\n", code); DES_pcbc_encrypt(arequest->SeqBody, &request, - min(arequest->SeqLen, sizeof(request)), &user_schedule, + opr_min(arequest->SeqLen, sizeof(request)), &user_schedule, ktc_to_cblockptr(&tentry.key), DECRYPT); /* validate the request */ @@ -1101,7 +1101,7 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance, if ((code = DES_key_sched(ktc_to_cblock(&tentry.key), &user_schedule))) es_Report("In KAAuthenticate: key_sched returned %d\n", code); DES_pcbc_encrypt(arequest->SeqBody, &request, - min(arequest->SeqLen, sizeof(request)), &user_schedule, + opr_min(arequest->SeqLen, sizeof(request)), &user_schedule, ktc_to_cblockptr(&tentry.key), DECRYPT); request.time = ntohl(request.time); /* reorder date */ diff --git a/src/scout/scout.c b/src/scout/scout.c index e47466264c..abccf25a31 100644 --- a/src/scout/scout.c +++ b/src/scout/scout.c @@ -2118,7 +2118,7 @@ scout_SetColumnWidths(struct cmd_item *a_width_item) if (width > 0) { int min_width = strlen(scout_underline[i]); if (min_width) { - width = max(width, min_width); + width = opr_max(width, min_width); } scout_col_width[i] = width + 1; } diff --git a/src/tests/afscp.c b/src/tests/afscp.c index 6e4ccf6d13..fd28fe3168 100644 --- a/src/tests/afscp.c +++ b/src/tests/afscp.c @@ -15,6 +15,7 @@ #include #include +#include #include #define FSINT_COMMON_XG 1 #include @@ -515,14 +516,14 @@ main(int argc, char **argv) /*printf("%d bytes remaining\n",bytesremaining); */ if (slcl) { if ((bytes = - read(sfd, databuffer, min(blksize, bytesremaining))) <= 0) { + read(sfd, databuffer, opr_min(blksize, bytesremaining))) <= 0) { fetchcode = errno; break; } } else { if ((bytes = rx_Read(scall, databuffer, - min(blksize, bytesremaining))) <= 0) + opr_min(blksize, bytesremaining))) <= 0) break; } if (dlcl) { diff --git a/src/tests/apwd.c b/src/tests/apwd.c index 7b9108df2d..0e9f4ef254 100644 --- a/src/tests/apwd.c +++ b/src/tests/apwd.c @@ -94,7 +94,7 @@ guarantee_room(char **buf, size_t * size, size_t len) if (*size > len) return 0; - return expand_string(buf, size, min(*size * 2, len)); + return expand_string(buf, size, opr_min(*size * 2, len)); } static char * diff --git a/src/tests/create-files.c b/src/tests/create-files.c index e6524baf63..88701af7fe 100644 --- a/src/tests/create-files.c +++ b/src/tests/create-files.c @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -71,7 +72,7 @@ creat_files(int count, long startsize) size_t len; ssize_t ret; - len = min(sizeof(buf), size); + len = opr_min(sizeof(buf), size); ret = write(fd, buf, len); if (ret < 0) diff --git a/src/tsm41/aix_aklog.c b/src/tsm41/aix_aklog.c index 911798e048..6fdc5f4288 100644 --- a/src/tsm41/aix_aklog.c +++ b/src/tsm41/aix_aklog.c @@ -9,6 +9,7 @@ #include #include +#include #include @@ -457,7 +458,7 @@ auth_to_cell(krb5_context context, char *user, char *cell, char *realm) int len; struct ktc_token atoken; - len = min(get_princ_len(context, v5cred->client, 0), + len = opr_min(get_princ_len(context, v5cred->client, 0), second_comp(context, v5cred->client) ? MAXKTCNAMELEN - 2 : MAXKTCNAMELEN - 1); strncpy(username, get_princ_str(context, v5cred->client, 0), len); @@ -466,7 +467,7 @@ auth_to_cell(krb5_context context, char *user, char *cell, char *realm) if (second_comp(context, v5cred->client)) { strcat(username, "."); p = username + strlen(username); - len = min(get_princ_len(context, v5cred->client, 1), + len = opr_min(get_princ_len(context, v5cred->client, 1), MAXKTCNAMELEN - strlen(username) - 1); strncpy(p, get_princ_str(context, v5cred->client, 1), len); p[len] = '\0'; diff --git a/src/util/tabular_output.c b/src/util/tabular_output.c index dd45fd2ff8..847de3ea93 100644 --- a/src/util/tabular_output.c +++ b/src/util/tabular_output.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -133,7 +134,7 @@ util_addTableBodyRow(struct util_Table *Table, char **Contents) { for (i=0;inumColumns;i++) { strncpy(Table->Body[indx]->CellContents[i],Contents[i],\ UTIL_T_MAX_CELLCONTENT_LEN); - thisRowLength += min(strlen(Contents[i]),UTIL_T_MAX_CELLCONTENT_LEN); + thisRowLength += opr_min(strlen(Contents[i]),UTIL_T_MAX_CELLCONTENT_LEN); } if (thisRowLength > Table->RowLength) Table->RowLength = thisRowLength; @@ -179,7 +180,7 @@ do_setTableRow(struct util_Table *Table, struct util_TableRow *aRow, char **Cont return -1; for (i=0;inumColumns;i++) { strcpy(aRow->CellContents[i],Contents[i]); - thisRowLength += min(strlen(Contents[i]),UTIL_T_MAX_CELLCONTENT_LEN); + thisRowLength += opr_min(strlen(Contents[i]),UTIL_T_MAX_CELLCONTENT_LEN); } if (thisRowLength > Table->RowLength) Table->RowLength = thisRowLength; diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 6d55ec8e73..c370137fac 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -178,7 +178,7 @@ ih_Initialize(void) */ fdMaxCacheSize /= 4; #endif - fdMaxCacheSize = min(fdMaxCacheSize, vol_io_params.fd_max_cachesize); + fdMaxCacheSize = opr_min(fdMaxCacheSize, vol_io_params.fd_max_cachesize); opr_Assert(fdMaxCacheSize > 0); } #elif defined(AFS_HPUX_ENV) @@ -186,12 +186,12 @@ ih_Initialize(void) fdMaxCacheSize = 0; #else { - long fdMax = max(sysconf(_SC_OPEN_MAX) - vol_io_params.fd_handle_setaside, + long fdMax = opr_max(sysconf(_SC_OPEN_MAX) - vol_io_params.fd_handle_setaside, 0); - fdMaxCacheSize = (int)min(fdMax, vol_io_params.fd_max_cachesize); + fdMaxCacheSize = (int)opr_min(fdMax, vol_io_params.fd_max_cachesize); } #endif - fdCacheSize = min(fdMaxCacheSize, vol_io_params.fd_initial_cachesize); + fdCacheSize = opr_min(fdMaxCacheSize, vol_io_params.fd_initial_cachesize); } /* Make the file descriptor cache as big as possible. Don't this call diff --git a/src/vol/salvaged.c b/src/vol/salvaged.c index 6badf34d22..e2f44b3c5b 100644 --- a/src/vol/salvaged.c +++ b/src/vol/salvaged.c @@ -229,7 +229,7 @@ handleit(struct cmd_syndesc *opts, void *arock) free(optstring); optstring = NULL; } else { - Parallel = min(DEFAULT_PARALLELISM, MAXPARALLEL); + Parallel = opr_min(DEFAULT_PARALLELISM, MAXPARALLEL); } if (cmd_OptionAsString(opts, OPT_tmpdir, &optstring) == 0) { DIR *dirp; diff --git a/src/vol/volume.c b/src/vol/volume.c index 41cc1592fa..926033341b 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -693,7 +693,7 @@ VInitAttachVolumes(ProgramType pt) queue_Append(¶ms,dpq); } - threads = min(parts, vol_attach_threads); + threads = opr_min(parts, vol_attach_threads); if (threads > 1) { /* spawn off a bunch of initialization threads */ @@ -819,7 +819,7 @@ VInitAttachVolumes(ProgramType pt) } /* number of worker threads; at least one, not to exceed the number of partitions */ - threads = min(parts, vol_attach_threads); + threads = opr_min(parts, vol_attach_threads); /* create volume work queue */ queue_Init(&vq); diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index c811042a34..31101a6480 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -10,6 +10,7 @@ #include #include +#include #include /* signal(), kill(), wait(), etc. */ #include @@ -685,10 +686,10 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname, /* If caller specified RW id, but not RO/BK ids, have them be RW+1 and RW+2 */ lastid = *anewid; if (aroid && *aroid != 0) { - lastid = max(lastid, *aroid); + lastid = opr_max(lastid, *aroid); } if (abkid && *abkid != 0) { - lastid = max(lastid, *abkid); + lastid = opr_max(lastid, *abkid); } if (aroid && *aroid == 0) { *aroid = ++lastid;