Skip to content

Commit

Permalink
Add inline bzero function. Change memset(x, 0, l) to bzero(x, l)
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/jj/hercules.svn/trunk@7601 956126f8-22a0-4046-8f4a-272fa8102e63
  • Loading branch information
Paul Gorlinsky committed Jul 20, 2011
1 parent 496baa4 commit 9083dcf
Show file tree
Hide file tree
Showing 82 changed files with 402 additions and 370 deletions.
6 changes: 3 additions & 3 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ int cache_release(int ix, int i, int flag)
buf = cacheblk[ix].cache[i].buf;
len = cacheblk[ix].cache[i].len;

memset (&cacheblk[ix].cache[i], 0, sizeof(CACHE));
bzero (&cacheblk[ix].cache[i], sizeof(CACHE));

if ((flag & CACHE_FREEBUF) && buf != NULL) {
free (buf);
Expand Down Expand Up @@ -460,7 +460,7 @@ static int cache_destroy (int ix)
free (cacheblk[ix].cache);
}
}
memset(&cacheblk[ix], 0, sizeof(CACHEBLK));
bzero(&cacheblk[ix], sizeof(CACHEBLK));
return 0;
}

Expand Down Expand Up @@ -569,7 +569,7 @@ static int cache_resize (int ix, int n)
}
cacheblk[ix].cache = cache;
for (i = cacheblk[ix].nbr; i < cacheblk[ix].nbr +n; i++)
memset(&cacheblk[ix].cache[i], 0, sizeof(CACHE));
bzero(&cacheblk[ix].cache[i], sizeof(CACHE));
cacheblk[ix].nbr += n;
cacheblk[ix].empty += n;
cacheblk[ix].adjusts++;
Expand Down
2 changes: 1 addition & 1 deletion cardpch.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ BYTE c; /* Output character */
memcpy (iobuf, dev->sense, num);

/* Clear the device sense bytes */
memset (dev->sense, 0, sizeof(dev->sense));
bzero (dev->sense, sizeof(dev->sense));

/* Return unit status */
*unitstat = CSW_CE | CSW_DE;
Expand Down
4 changes: 2 additions & 2 deletions cardrdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ int rc; /* Return code */

if ((rc > 0) && (rc < CARD_SIZE) && dev->autopad)
{
memset(&dev->buf[rc], 0, CARD_SIZE - rc);
bzero(&dev->buf[rc], CARD_SIZE - rc);
rc = CARD_SIZE;
}
else if /* Check for End of file */
Expand Down Expand Up @@ -809,7 +809,7 @@ int num; /* Number of bytes to move */
memcpy (iobuf, dev->sense, num);

/* Clear the device sense bytes */
memset (dev->sense, 0, sizeof(dev->sense));
bzero (dev->sense, sizeof(dev->sense));

/* Return unit status */
*unitstat = CSW_CE | CSW_DE;
Expand Down
2 changes: 1 addition & 1 deletion cckdcdsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ char *strtok_str = NULL; /* last token position */

for (i = 0; i < argc; i++)
{
memset (dev, 0, sizeof(DEVBLK));
bzero (dev, sizeof(DEVBLK));
dev->batch = 1;

/* open the file */
Expand Down
2 changes: 1 addition & 1 deletion cckdcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ DEVBLK *dev=&devblk; /* -> DEVBLK */

for (i = 0; i < argc; i++)
{
memset (dev, 0, sizeof(DEVBLK));
bzero (dev, sizeof(DEVBLK));
dev->batch = 1;

/* open the file */
Expand Down
31 changes: 17 additions & 14 deletions cckddasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ int i, j; /* Loop indexes */
return 0;

/* Clear the cckdblk */
memset(&cckdblk, 0, sizeof(CCKDBLK));
bzero(&cckdblk, sizeof(CCKDBLK));

/* Initialize locks and conditions */
memcpy (&cckdblk.id, "CCKDBLK ", sizeof(cckdblk.id));
Expand Down Expand Up @@ -266,7 +266,7 @@ int cckddasd_term ()
destroy_condition (&cckdblk.devcond);
destroy_condition (&cckdblk.termcond);

memset(&cckdblk, 0, sizeof(CCKDBLK));
bzero(&cckdblk, sizeof(CCKDBLK));

return 0;

Expand Down Expand Up @@ -1376,7 +1376,7 @@ BYTE *buf; /* Read buffer */
cckd_readahead (dev, trk);

/* Clear the buffer if batch mode */
if (dev->batch) memset(buf, 0, maxlen);
if (dev->batch) bzero(buf, maxlen);

/* Read the track image */
obtain_lock (&cckd->filelock);
Expand Down Expand Up @@ -1432,7 +1432,7 @@ int rc;
obtain_lock (&cckdblk.ralock);

/* Scan the cache to see if the tracks are already there */
memset(cckd->ralkup, 0, sizeof(cckd->ralkup));
bzero(cckd->ralkup, sizeof(cckd->ralkup));
cckd->ratrk = trk;
cache_lock(CACHE_DEVBUF);
cache_scan(CACHE_DEVBUF, cckd_readahead_scan, dev);
Expand Down Expand Up @@ -2337,7 +2337,7 @@ int sfx; /* File index */

cckd_trace (dev, "file[%d] read_chdr", sfx);

memset (&cckd->cdevhdr[sfx], 0, CCKDDASD_DEVHDR_SIZE);
bzero (&cckd->cdevhdr[sfx], CCKDDASD_DEVHDR_SIZE);

/* Read the device header */
if (cckd_read (dev, sfx, CKDDASD_DEVHDR_SIZE, &cckd->cdevhdr[sfx], CCKDDASD_DEVHDR_SIZE) < 0)
Expand Down Expand Up @@ -2422,7 +2422,10 @@ int i; /* Work integer */
len = cckd->cdevhdr[sfx].numl1tab * CCKD_L1ENT_SIZE;
if ((cckd->l1[sfx] = cckd_malloc (dev, "l1", len)) == NULL)
return -1;
memset(cckd->l1[sfx], sfx ? 0xFF : 0, len);
if ( sfx )
memset(cckd->l1[sfx], 0xFF, len);
else
bzero(cckd->l1[sfx], len);

/* Read the level 1 table */
if (cckd_read (dev, sfx, CCKD_L1TAB_POS, cckd->l1[sfx], len) < 0)
Expand Down Expand Up @@ -2798,7 +2801,7 @@ int nullfmt; /* Null track format */
/* Check for null table */
if (cckd->l1[sfx][l1x] == 0)
{
memset(buf, 0, CCKD_L2TAB_SIZE);
bzero(buf, CCKD_L2TAB_SIZE);
if (nullfmt)
for (i = 0; i < 256; i++)
buf[i].len = buf[i].size = nullfmt;
Expand Down Expand Up @@ -3305,7 +3308,7 @@ int len; /* Length of null track */
rechdr->rec = r;
rechdr->klen = 0;
store_hw(&rechdr->dlen, 8);
memset (pos, 0, 8);
bzero( pos, 8 );
pos += 8;
r++;

Expand Down Expand Up @@ -3335,7 +3338,7 @@ int len; /* Length of null track */
rechdr->klen = 0;
store_hw(&rechdr->dlen, 4096);
r++;
memset(pos, 0, 4096);
bzero( pos, 4096 );
pos += 4096;
}
}
Expand All @@ -3347,7 +3350,7 @@ int len; /* Length of null track */
}
else
{
memset (buf, 0, CFBA_BLOCK_SIZE + CKDDASD_TRKHDR_SIZE);
bzero( buf, CFBA_BLOCK_SIZE + CKDDASD_TRKHDR_SIZE);
store_fw(buf+1, trk);
len = CFBA_BLOCK_SIZE + CKDDASD_TRKHDR_SIZE;
}
Expand Down Expand Up @@ -4006,7 +4009,7 @@ BYTE buf[65536]; /* Buffer */

/* Read `from' l2 table */
if (cckd->l1[from_sfx][i] == 0)
memset (&from_l2, 0, CCKD_L2TAB_SIZE);
bzero( &from_l2, CCKD_L2TAB_SIZE );
else
{
pos = (off_t)cckd->l1[from_sfx][i];
Expand All @@ -4016,7 +4019,7 @@ BYTE buf[65536]; /* Buffer */

/* Read `to' l2 table */
if (cckd->l1[to_sfx][i] == 0)
memset (&to_l2, 0, CCKD_L2TAB_SIZE);
bzero( &to_l2, CCKD_L2TAB_SIZE );
else if (cckd->l1[to_sfx][i] == 0xffffffff)
memset (&to_l2, 0xff, CCKD_L2TAB_SIZE);
else
Expand Down Expand Up @@ -4113,7 +4116,7 @@ BYTE buf[65536]; /* Buffer */
/* Remove the old file */
cckd_close (dev, from_sfx);
cckd->l1[from_sfx] = cckd_free (dev, "l1", cckd->l1[from_sfx]);
memset (&cckd->cdevhdr[from_sfx], 0, CCKDDASD_DEVHDR_SIZE);
bzero( &cckd->cdevhdr[from_sfx], CCKDDASD_DEVHDR_SIZE);
rc = unlink (cckd_sf_name (dev, from_sfx));

/* adjust the stats */
Expand Down Expand Up @@ -5758,7 +5761,7 @@ int n; /* Trace Entries Printed */
} while (p != cckdblk.itracep);
if ( n == 0 )
WRMSG(HHC00397, "I");
memset (i, 0, cckdblk.itracen * sizeof(CCKD_TRACE));
bzero(i, cckdblk.itracen * sizeof(CCKD_TRACE));
cckdblk.itracep = i;
cckdblk.itrace = i;
} /* end function cckd_print_itrace */
Expand Down
2 changes: 1 addition & 1 deletion cckddiag.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ unsigned int ubufl; /* when size_t != unsigned int */
UNREFERENCED(msg);
#endif

memset(obuf, 0x00, obuflen); /* clear output buffer */
bzero(obuf, obuflen); /* clear output buffer */

/* Uncompress the track/block image */
switch (ibuf[0] & CCKD_COMPRESS_MASK) {
Expand Down
4 changes: 2 additions & 2 deletions cckdfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ char pathname[MAX_PATH];
// devhdr.highcyl[0] = 0;
// devhdr.highcyl[1] = 0;

// memset (&devhdr.resv, 0, 492);
// bzero (&devhdr.resv, 492);


/* --------------------------------------- */
Expand Down Expand Up @@ -111,7 +111,7 @@ char pathname[MAX_PATH];
// cdevhdr.compress = CCKD_COMPRESS_BZIP2;
// cdevhdr.compress_parm = 5;

// memset (&cdevhdr.resv2, 0, 464);
// bzero (&cdevhdr.resv2, 464);

lseek (fd, 0, SEEK_SET);
write (fd, &devhdr, CKDDASD_DEVHDR_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion cckdswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ char *strtok_str = NULL;

for (i = 0; i < argc; i++)
{
memset (dev, 0, sizeof (DEVBLK));
bzero (dev, sizeof (DEVBLK));
dev->batch = 1;

/* open the input file */
Expand Down
4 changes: 2 additions & 2 deletions cckdutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ BYTE buf[65536*4]; /* Buffer */
/*---------------------------------------------------------------
* Build empty l2 tables
*---------------------------------------------------------------*/
memset (&zero_l2, 0, CCKD_L2TAB_SIZE);
bzero( &zero_l2, CCKD_L2TAB_SIZE );
if (cdevhdr.nullfmt != 0)
for (i = 0; i < 256; i++)
zero_l2[i].len = zero_l2[i].size = cdevhdr.nullfmt;
Expand Down Expand Up @@ -1476,7 +1476,7 @@ BYTE buf[4*65536]; /* buffer */
hipos -= len;
}

memset (&cdevhdr2, 0, CCKD_DEVHDR_SIZE);
bzero( &cdevhdr2, CCKD_DEVHDR_SIZE );
for (i = 0; spctab[i].typ != SPCTAB_EOF; i++)
{
/* Calculate gap size */
Expand Down
32 changes: 16 additions & 16 deletions channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,9 @@ int cc; /* Condition code */
irb->scsw = dev->pciscsw;

/* Clear the ESW and ECW in the IRB */
memset (&irb->esw, 0, sizeof(ESW));
bzero (&irb->esw, sizeof(ESW));
irb->esw.lpum = 0x80;
memset (irb->ecw, 0, sizeof(irb->ecw));
bzero (irb->ecw, sizeof(irb->ecw));

/* Clear the pending PCI status */
dev->pciscsw.flag2 &= ~(SCSW2_FC | SCSW2_AC);
Expand Down Expand Up @@ -786,9 +786,9 @@ int cc; /* Condition code */
irb->scsw = dev->attnscsw;

/* Clear the ESW and ECW in the IRB */
memset (&irb->esw, 0, sizeof(ESW));
bzero (&irb->esw, sizeof(ESW));
irb->esw.lpum = 0x80;
memset (irb->ecw, 0, sizeof(irb->ecw));
bzero (irb->ecw, sizeof(irb->ecw));
/* Clear the pending ATTN status */
dev->attnscsw.flag2 &= ~(SCSW2_FC | SCSW2_AC);
dev->attnscsw.flag3 &= ~(SCSW3_SC);
Expand Down Expand Up @@ -1218,20 +1218,20 @@ void device_reset (DEVBLK *dev)
dev->pmcw.flag25 &= ~PMCW25_VISC;
dev->pmcw.flag27 &= ~PMCW27_I;
#endif
memset (&dev->scsw, 0, sizeof(SCSW));
memset (&dev->pciscsw, 0, sizeof(SCSW));
memset (&dev->attnscsw, 0, sizeof(SCSW));
bzero (&dev->scsw, sizeof(SCSW));
bzero (&dev->pciscsw, sizeof(SCSW));
bzero (&dev->attnscsw, sizeof(SCSW));

dev->readpending = 0;
dev->ckdxtdef = 0;
dev->ckdsetfm = 0;
dev->ckdlcount = 0;
dev->ckdssi = 0;
memset (dev->sense, 0, sizeof(dev->sense));
bzero (dev->sense, sizeof(dev->sense));
dev->sns_pending = 0;
memset (dev->pgid, 0, sizeof(dev->pgid));
bzero (dev->pgid, sizeof(dev->pgid));
/* By Adrian - Reset drive password */
memset (dev->drvpwd, 0, sizeof(dev->drvpwd));
bzero (dev->drvpwd, sizeof(dev->drvpwd));

#if defined(_FEATURE_IO_ASSIST)
dev->mainstor = sysblk.mainstor;
Expand Down Expand Up @@ -2281,9 +2281,9 @@ DEVBLK *previoq, *ioq; /* Device I/O queue pointers */
dev->busy = dev->startpending = 1;

/* Initialize the subchannel status word */
memset (&dev->scsw, 0, sizeof(SCSW));
memset (&dev->pciscsw, 0, sizeof(SCSW));
memset (&dev->attnscsw, 0, sizeof(SCSW));
bzero (&dev->scsw, sizeof(SCSW));
bzero (&dev->pciscsw, sizeof(SCSW));
bzero (&dev->attnscsw, sizeof(SCSW));
dev->scsw.flag0 = (orb->flag4 & SCSW0_KEY); /*@IWZ*/
if (orb->flag4 & ORB4_S) dev->scsw.flag0 |= SCSW0_S; /*@IWZ*/
if (orb->flag5 & ORB5_F) dev->scsw.flag1 |= SCSW1_F; /*@IWZ*/
Expand Down Expand Up @@ -3347,11 +3347,11 @@ BYTE iobuf[65536]; /* Channel I/O buffer */
dev->scsw.flag3 |= SCSW3_SC_ALERT;

/* Build the format-1 extended status word */
memset (&dev->esw, 0, sizeof(ESW));
bzero (&dev->esw, sizeof(ESW));
dev->esw.lpum = 0x80;

/* Clear the extended control word */
memset (dev->ecw, 0, sizeof(dev->ecw));
bzero (dev->ecw, sizeof(dev->ecw));

/* Return sense information if PMCW allows concurrent sense */
if ((unitstat & CSW_UC) && (dev->pmcw.flag27 & PMCW27_S))
Expand All @@ -3361,7 +3361,7 @@ BYTE iobuf[65536]; /* Channel I/O buffer */
dev->esw.erw1 = (BYTE)((dev->numsense < (int)sizeof(dev->ecw)) ?
dev->numsense : (int)sizeof(dev->ecw));
memcpy (dev->ecw, dev->sense, dev->esw.erw1 & ERW1_SCNT);
memset (dev->sense, 0, sizeof(dev->sense));
bzero (dev->sense, sizeof(dev->sense));
dev->sns_pending = 0;
}
#endif /*FEATURE_CHANNEL_SUBSYSTEM*/
Expand Down
8 changes: 4 additions & 4 deletions chsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int ARCH_DEP(chsc_get_sch_desc) (CHSC_REQ *chsc_req, CHSC_RSP *chsc_rsp)
for(sch = f_sch; sch <= l_sch; sch++, chsc_rsp4++)
{
DEVBLK *dev;
memset(chsc_rsp4, 0x00, sizeof(CHSC_RSP4) );
bzero(chsc_rsp4, sizeof(CHSC_RSP4) );
if((dev = find_device_by_subchan((LCSS_TO_SSID(lcss) << 16)|sch)))
{
chsc_rsp4->sch_val = 1;
Expand Down Expand Up @@ -123,8 +123,8 @@ U16 req_len, rsp_len;

STORE_HW(chsc_rsp->length,rsp_len);

memset(chsc_rsp10->general_char, 0x00, sizeof(chsc_rsp10->general_char));
memset(chsc_rsp10->chsc_char, 0x00, sizeof(chsc_rsp10->chsc_char));
bzero(chsc_rsp10->general_char, sizeof(chsc_rsp10->general_char));
bzero(chsc_rsp10->chsc_char, sizeof(chsc_rsp10->chsc_char));

chsc_rsp10->general_char[0][0] = 0
#if defined(FEATURE_REGION_RELOCATE)
Expand Down Expand Up @@ -202,7 +202,7 @@ int ARCH_DEP(chsc_get_ssqd) (CHSC_REQ *chsc_req, CHSC_RSP *chsc_rsp)
for(sch = f_sch; sch <= l_sch; sch++, chsc_rsp24++)
{
DEVBLK *dev;
memset(chsc_rsp24, 0x00, sizeof(CHSC_RSP24) );
bzero(chsc_rsp24, sizeof(CHSC_RSP24) );
if((dev = find_device_by_subchan((LCSS_TO_SSID(lcss) << 16)|sch)))
if(dev->hnd->ssqd)
(dev->hnd->ssqd)(dev, chsc_rsp24);
Expand Down
Loading

0 comments on commit 9083dcf

Please sign in to comment.