mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
Remove almost all bcopy/bzero/bcmp calls
Get rid of some remaining references to bcopy, bzero, and bcmp. In a
few places (such as ka-forwarder.c, and linked_list.c), these were
being called without including strings.h, which causes errors on AIX
when using the clang-based xlc 17.1 compiler.
Remove references even inside comments or documentation, to make it
easier to make sure they've all been removed.
Leave some references inside platform-specific or kernel code, since
those are more likely to need bcopy() et al, and tend to only impact
that platform.
Note that most references to bcopy() et al were removed by commit
c5c521af0e
(convert-from-bsd-to-posix-string-and-memory-functions-20010807).
Change-Id: I28d1b139348c2a4b2259a259de0c93997c684c40
Reviewed-on: https://gerrit.openafs.org/15432
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
parent
59b7132256
commit
4fee9a2f9e
@ -669,7 +669,7 @@ Sample CLIENT code:
|
||||
vldb_list linkedvldbs;
|
||||
vldblist vllist, vllist1;
|
||||
|
||||
bzero(&linkedvldbs, sizeof(vldb_list));
|
||||
memset(&linkedvldbs, 0, sizeof(vldb_list));
|
||||
code = VL_LinkedList(&attributes, &nentries, &linkedvldbs);
|
||||
if (!code) {
|
||||
printf("We got %d vldb entries\n", nentries);
|
||||
|
@ -4389,7 +4389,7 @@
|
||||
* \par
|
||||
* \#define rx_Read(call, buf, nbytes)
|
||||
* \n ((call)->nLeft > (nbytes) ?
|
||||
* \n bcopy((call)->bufPtr, (buf), (nbytes)),
|
||||
* \n memcpy((buf), (call)->bufPtr, (nbytes)),
|
||||
* \n (call)->nLeft -= (nbytes), (call)->bufPtr += (nbytes), (nbytes)
|
||||
* \n : rx_ReadProc((call), (buf), (nbytes)))
|
||||
* \par
|
||||
@ -4410,7 +4410,7 @@
|
||||
* \par
|
||||
* \#define rx_Write(call, buf, nbytes)
|
||||
* \n ((call)->nFree > (nbytes) ?
|
||||
* \n bcopy((buf), (call)->bufPtr, (nbytes)),
|
||||
* \n memcpy((call)->bufPtr, (buf), (nbytes)),
|
||||
* \n (call)->nFree -= (nbytes),
|
||||
* \n (call)->bufPtr += (nbytes), (nbytes)
|
||||
* \n : rx_WriteProc((call), (buf), (nbytes)))
|
||||
@ -5269,7 +5269,7 @@
|
||||
* pn, rn, hostEntP->h_length, sizeof(u_long));
|
||||
* exit(1);
|
||||
* }
|
||||
* bcopy(hostEntP->h_addr, (char *)&hostIPAddr, sizeof(hostIPAddr));
|
||||
* memcpy(&hostIPAddr, hostEntP->h_addr, sizeof(hostIPAddr));
|
||||
* return(hostIPAddr);
|
||||
* } /* GetIpAddress */
|
||||
* \endcode
|
||||
|
@ -70,7 +70,7 @@ int afs_ustrategy(struct buf *abp)
|
||||
if ((abp->b_flags & B_READ) == B_READ) {
|
||||
#endif
|
||||
/* read b_bcount bytes into kernel address b_un.b_addr starting
|
||||
* at byte DEV_BSIZE * b_blkno. Bzero anything we can't read,
|
||||
* at byte DEV_BSIZE * b_blkno. Zero anything we can't read,
|
||||
* and finally call iodone(abp). File is in abp->b_vp. Credentials
|
||||
* are from u area??
|
||||
*/
|
||||
|
@ -2029,7 +2029,7 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte,
|
||||
|
||||
shortcut = 0;
|
||||
|
||||
/* check hints first! (might could use bcmp or some such...) */
|
||||
/* check hints first! */
|
||||
if ((tdc = avc->dchint)) {
|
||||
int dcLocked;
|
||||
|
||||
|
@ -335,7 +335,7 @@ afs_ComputePAGStats(void)
|
||||
|
||||
/*
|
||||
* Initialize the tallies, then sweep through each hash chain. We
|
||||
* can't bzero the structure, since some fields are cumulative over
|
||||
* can't zero the structure, since some fields are cumulative over
|
||||
* the CM's lifetime.
|
||||
*/
|
||||
authP = &(afs_stats_cmfullperf.authent);
|
||||
|
@ -40,7 +40,7 @@ void ll_init(linked_list *list)
|
||||
}
|
||||
|
||||
/* This sets everything to zero, which is what we want. */
|
||||
bzero((char *)list, sizeof(linked_list));
|
||||
memset(list, 0, sizeof(linked_list));
|
||||
}
|
||||
|
||||
ll_node *ll_add_node(linked_list *list, ll_end which_end)
|
||||
|
@ -136,7 +136,7 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
kvno = atoi(argv[2]);
|
||||
bzero(tkey, sizeof(tkey));
|
||||
memset(tkey, 0, sizeof(tkey));
|
||||
code = kname_parse(name, inst, realm, argv[4]);
|
||||
if (code != 0) {
|
||||
printf("Invalid kerberos name\n");
|
||||
|
@ -213,7 +213,7 @@ UpdateCache(struct ubik_trans *ut, void *rock)
|
||||
db.h.lastUpdate = db.h.lastDumpId = htonl(time(0));
|
||||
db.h.eofPtr = htonl(sizeof(db.h));
|
||||
|
||||
/* text ptrs cleared by bzero */
|
||||
/* text ptrs cleared by memset */
|
||||
ht_DBInit();
|
||||
|
||||
code = dbwrite(ut, 0, (char *)&db.h, sizeof(db.h));
|
||||
|
@ -108,7 +108,7 @@ setup_servers(int argc, char **argv)
|
||||
fprintf(stderr, "%s: unknown host %s\n", prog, host);
|
||||
exit(1);
|
||||
}
|
||||
bcopy(h->h_addr, &fwdaddr, 4);
|
||||
memcpy(&fwdaddr, h->h_addr, 4);
|
||||
}
|
||||
|
||||
servers[i].sin_family = AF_INET;
|
||||
@ -221,8 +221,8 @@ main(int argc, char **argv)
|
||||
|
||||
to = &reply;
|
||||
reply.sin_family = AF_INET;
|
||||
bcopy(bufp, &reply.sin_addr.s_addr, 4);
|
||||
bcopy(bufp + 4, &reply.sin_port, 2);
|
||||
memcpy(&reply.sin_addr.s_addr, bufp, 4);
|
||||
memcpy(&reply.sin_port, bufp + 4, 2);
|
||||
sendptr = bufp + 8;
|
||||
sendlen = rv - 8;
|
||||
}
|
||||
@ -232,8 +232,8 @@ main(int argc, char **argv)
|
||||
cur_server = (cur_server + 1) % num_servers;
|
||||
to = &servers[cur_server];
|
||||
|
||||
bcopy(&from.sin_addr.s_addr, bufp - 8, 4);
|
||||
bcopy(&from.sin_port, bufp - 4, 2);
|
||||
memcpy(bufp - 8, &from.sin_addr.s_addr, 4);
|
||||
memcpy(bufp - 4, &from.sin_port, 2);
|
||||
|
||||
sendptr = bufp - 8;
|
||||
sendlen = rv + 8;
|
||||
|
@ -260,7 +260,7 @@ NFSCopyToken(afs_int32 ahost, afs_int32 auid)
|
||||
char space[1200];
|
||||
struct ClearToken ct;
|
||||
afs_int32 index, newIndex;
|
||||
afs_int32 temp; /* for bcopy */
|
||||
afs_int32 temp;
|
||||
char *tp;
|
||||
struct ViceIoctl blob;
|
||||
|
||||
|
@ -3096,7 +3096,7 @@ rxi_FindPeer(afs_uint32 host, u_short port, int create)
|
||||
}
|
||||
if (!pp) {
|
||||
if (create) {
|
||||
pp = rxi_AllocPeer(); /* This bzero's *pp */
|
||||
pp = rxi_AllocPeer(); /* This zeroes *pp */
|
||||
pp->host = host; /* set here or in InitPeerParams is zero */
|
||||
pp->port = port;
|
||||
#ifdef AFS_RXERRQ_ENV
|
||||
@ -3219,7 +3219,7 @@ rxi_FindConnection(osi_socket socket, afs_uint32 host,
|
||||
*unknownService = 1;
|
||||
return (struct rx_connection *)0;
|
||||
}
|
||||
conn = rxi_AllocConnection(); /* This bzero's the connection */
|
||||
conn = rxi_AllocConnection(); /* This zeroes the connection */
|
||||
MUTEX_INIT(&conn->conn_call_lock, "conn call lock", MUTEX_DEFAULT, 0);
|
||||
MUTEX_INIT(&conn->conn_data_lock, "conn data lock", MUTEX_DEFAULT, 0);
|
||||
CV_INIT(&conn->conn_call_cv, "conn call cv", CV_DEFAULT, 0);
|
||||
|
@ -705,7 +705,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
|
||||
|
||||
pp->ifMTU = 0;
|
||||
rx_rto_setPeerTimeoutSecs(pp, 2);
|
||||
/* I don't initialize these, because I presume they are bzero'd...
|
||||
/* I don't initialize these, because I presume they are zeroed...
|
||||
* pp->burstSize pp->burst pp->burstWait.sec pp->burstWait.usec
|
||||
*/
|
||||
|
||||
|
@ -296,7 +296,7 @@ check_buffers(unsigned offset, unsigned size)
|
||||
unsigned op = 0;
|
||||
unsigned bad = 0;
|
||||
|
||||
if (bcmp(good_buf + offset, temp_buf, size) != 0) {
|
||||
if (memcmp(good_buf + offset, temp_buf, size) != 0) {
|
||||
prt("READ BAD DATA: offset = 0x%x, size = 0x%x\n", offset, size);
|
||||
prt("OFFSET\tGOOD\tBAD\tRANGE\n");
|
||||
while (size > 0) {
|
||||
@ -500,7 +500,7 @@ dowrite(unsigned offset, unsigned size)
|
||||
gendata(original_buf, good_buf, offset, size);
|
||||
if (file_size < offset + size) {
|
||||
if (file_size < offset)
|
||||
bzero(good_buf + file_size, offset - file_size);
|
||||
memset(good_buf + file_size, 0, offset - file_size);
|
||||
file_size = offset + size;
|
||||
if (lite) {
|
||||
warn("Lite file size bug in fsx!");
|
||||
@ -556,7 +556,7 @@ domapwrite(unsigned offset, unsigned size)
|
||||
gendata(original_buf, good_buf, offset, size);
|
||||
if (file_size < offset + size) {
|
||||
if (file_size < offset)
|
||||
bzero(good_buf + file_size, offset - file_size);
|
||||
memset(good_buf + file_size, 0, offset - file_size);
|
||||
file_size = offset + size;
|
||||
if (lite) {
|
||||
warn("Lite file size bug in fsx!");
|
||||
@ -618,7 +618,7 @@ dotruncate(unsigned size)
|
||||
log4(OP_TRUNCATE, size, (unsigned)file_size, 0);
|
||||
|
||||
if (size > file_size)
|
||||
bzero(good_buf + file_size, size - file_size);
|
||||
memset(good_buf + file_size, 0, size - file_size);
|
||||
file_size = size;
|
||||
|
||||
if (testcalls <= simulatedopcount)
|
||||
|
@ -339,7 +339,7 @@ main(int argc, char **argv)
|
||||
exit(2);
|
||||
}
|
||||
|
||||
bzero(&dp, sizeof(dp));
|
||||
memset(&dp, 0, sizeof(dp));
|
||||
dp.cb_error = my_error_cb;
|
||||
dp.repair_flags = repairflags;
|
||||
if (X->is_seekable)
|
||||
@ -365,7 +365,7 @@ main(int argc, char **argv)
|
||||
dt_uint64 where;
|
||||
|
||||
dp.print_flags = printflags & DSPRINT_DEBUG;
|
||||
bzero(&phi, sizeof(phi));
|
||||
memset(&phi, 0, sizeof(phi));
|
||||
phi.p = &dp;
|
||||
|
||||
if ((r = xftell(X, &where))
|
||||
|
@ -2426,7 +2426,7 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp,
|
||||
|
||||
for (i = 0; i < MAXINODETYPE; i++) {
|
||||
if (stuff[i].inodeType == VI_LINKTABLE) {
|
||||
/* Gross hack: SalvageHeader does a bcmp on the volume header.
|
||||
/* Gross hack: SalvageHeader does a memcmp on the volume header.
|
||||
* And we may have recreated the link table earlier, so set the
|
||||
* RW header as well. The header magic was already checked.
|
||||
*/
|
||||
|
@ -3236,7 +3236,7 @@ attach2(Error * ec, VolumeId volumeId, char *path, struct DiskPartition64 *partp
|
||||
|
||||
/*
|
||||
* We just read in the diskstuff part of the header. If the detailed
|
||||
* volume stats area has not yet been initialized, we should bzero the
|
||||
* volume stats area has not yet been initialized, we should zero the
|
||||
* area and mark it as initialized.
|
||||
*/
|
||||
if (!(V_stat_initialized(vp))) {
|
||||
@ -6761,7 +6761,7 @@ VAdjustVolumeStatistics_r(Volume * vp)
|
||||
V_dayUseDate(vp) = Midnight(now);
|
||||
|
||||
/*
|
||||
* All we need to do is bzero the entire VOL_STATS_BYTES of
|
||||
* All we need to do is zero the entire VOL_STATS_BYTES of
|
||||
* the detailed volume statistics area.
|
||||
*/
|
||||
memset((V_stat_area(vp)), 0, VOL_STATS_BYTES);
|
||||
|
Loading…
Reference in New Issue
Block a user