Merge of master-melb:xfs-cmds:30883a by kenmcd.
nRemove sysv3 legacy functions
/* save what we need (agf) in the btree buffer */
- bcopy(ag_hdr.xfs_agf, btree_buf.data, source_sectorsize);
+ memmove(btree_buf.data, ag_hdr.xfs_agf, source_sectorsize);
ag_hdr.xfs_agf = (xfs_agf_t *) btree_buf.data;
btree_buf.length = source_blocksize;
* Need root access from here on (using raw devices)...
*/
- bzero(&xi, sizeof(xi));
+ memset(&xi, 0, sizeof(xi));
xi.dname = datadev;
xi.logname = logdev;
xi.rtname = rtdev;
do { /* loop a miximum of two times */
- bzero(map, sizeof(*map)); /* zero header */
+ memset(map, 0, sizeof(*map)); /* zero header */
map->bmv_length = -1;
map->bmv_count = map_size;
{
handlep->fh_fshandle = *fshandlep;
handlep->fh_sz_following = FILEHANDLE_SZ_FOLLOWING;
- bzero(handlep->fh_pad, FILEHANDLE_SZ_PAD);
+ memset(handlep->fh_pad, 0, FILEHANDLE_SZ_PAD);
handlep->fh_gen = statp->bs_gen;
handlep->fh_ino = statp->bs_ino;
}
xlog_op_header_t hbuf;
/*
- * bcopy because on 64/n32, partial reads can cause the op_head
+ * memmove because on 64/n32, partial reads can cause the op_head
* pointer to come in pointing to an odd-numbered byte
*/
- bcopy(op_head, &hbuf, sizeof(xlog_op_header_t));
+ memmove(&hbuf, op_head, sizeof(xlog_op_header_t));
op_head = &hbuf;
*ptr += sizeof(xlog_op_header_t);
printf("Oper (%d): tid: %x len: %d clientid: %s ", i,
ushort flags;
/*
- * bcopy to ensure 8-byte alignment for the long longs in
+ * memmove to ensure 8-byte alignment for the long longs in
* buf_log_format_t structure
*/
- bcopy(*ptr, &lbuf, MIN(sizeof(xfs_buf_log_format_t), len));
+ memmove(&lbuf, *ptr, MIN(sizeof(xfs_buf_log_format_t), len));
f = &lbuf;
*ptr += len;
} else {
printf("\n");
/*
- * bcopy because *ptr may not be 8-byte aligned
+ * memmove because *ptr may not be 8-byte aligned
*/
- bcopy(*ptr, &x, sizeof(long long));
- bcopy(*ptr+8, &y, sizeof(long long));
+ memmove(&x, *ptr, sizeof(long long));
+ memmove(&y, *ptr+8, sizeof(long long));
printf("icount: %lld ifree: %lld ",
INT_GET(x, ARCH_CONVERT),
INT_GET(y, ARCH_CONVERT));
- bcopy(*ptr+16, &x, sizeof(long long));
- bcopy(*ptr+24, &y, sizeof(long long));
+ memmove(&x, *ptr+16, sizeof(long long));
+ memmove(&y, *ptr+24, sizeof(long long));
printf("fdblks: %lld frext: %lld\n",
INT_GET(x, ARCH_CONVERT),
INT_GET(y, ARCH_CONVERT));
uint core_size = sizeof(xfs_efd_log_format_t) - sizeof(xfs_extent_t);
/*
- * bcopy to ensure 8-byte alignment for the long longs in
+ * memmove to ensure 8-byte alignment for the long longs in
* xfs_efd_log_format_t structure
*/
- bcopy(*ptr, &lbuf, MIN(core_size, len));
+ memmove(&lbuf, *ptr, MIN(core_size, len));
f = &lbuf;
*ptr += len;
if (len >= core_size) {
int error = 0;
/*
- * bcopy to ensure 8-byte alignment for the long longs in
+ * memmove to ensure 8-byte alignment for the long longs in
* xfs_efi_log_format_t structure
*/
if ((src_f = (xfs_efi_log_format_t *)malloc(src_len)) == NULL) {
fprintf(stderr, "%s: xlog_print_trans_efi: malloc failed\n", progname);
exit(1);
}
- bcopy(*ptr, (char*)src_f, src_len);
+ memmove((char*)src_f, *ptr, src_len);
*ptr += src_len;
/* convert to native format */
xfs_qoff_logformat_t *f;
xfs_qoff_logformat_t lbuf;
- bcopy(*ptr, &lbuf, MIN(sizeof(xfs_qoff_logformat_t), len));
+ memmove(&lbuf, *ptr, MIN(sizeof(xfs_qoff_logformat_t), len));
f = &lbuf;
*ptr += len;
if (len >= sizeof(xfs_qoff_logformat_t)) {
printf("SHORTFORM DIRECTORY size %d count %d\n",
size, sfp->hdr.count);
- bcopy(&(sfp->hdr.parent), &ino, sizeof(ino));
+ memmove(&ino, &(sfp->hdr.parent), sizeof(ino));
printf(".. ino 0x%llx\n", (unsigned long long)INT_GET(ino, ARCH_CONVERT));
count = (uint)(sfp->hdr.count);
sfep = &(sfp->list[0]);
for (i = 0; i < count; i++) {
- bcopy(&(sfep->inumber), &ino, sizeof(ino));
- bcopy((sfep->name), namebuf, sfep->namelen);
+ memmove(&ino, &(sfep->inumber), sizeof(ino));
+ memmove(namebuf, (sfep->name), sfep->namelen);
namebuf[sfep->namelen] = '\0';
printf("%s ino 0x%llx namelen %d\n",
namebuf, (unsigned long long)ino, sfep->namelen);
/*
* print inode type header region
*
- * bcopy to ensure 8-byte alignment for the long longs in
+ * memmove to ensure 8-byte alignment for the long longs in
* xfs_inode_log_format_t structure
*
- * len can be smaller than xfs_inode_log_format_32|64_t
+ * len can be smaller than xfs_inode_log_format_32|64_t
* if format data is split over operations
*/
- bcopy(*ptr, &src_lbuf, MIN(sizeof(xfs_inode_log_format_64_t), len));
+ memmove(&src_lbuf, *ptr, MIN(sizeof(xfs_inode_log_format_64_t), len));
(*i)++; /* bump index */
*ptr += len;
if (len == sizeof(xfs_inode_log_format_32_t) ||
len == sizeof(xfs_inode_log_format_64_t)) {
- f = xfs_inode_item_format_convert((char*)&src_lbuf, len, &dst_lbuf);
+ f = xfs_inode_item_format_convert((char*)&src_lbuf, len, &dst_lbuf);
printf("INODE: ");
printf("#regs: %d ino: 0x%llx flags: 0x%x dsize: %d\n",
f->ilf_size, (unsigned long long)f->ilf_ino,
return f->ilf_size-1;
}
- bcopy(*ptr, &dino, sizeof(dino));
+ memmove(&dino, *ptr, sizeof(dino));
mode = dino.di_mode & S_IFMT;
size = (int)dino.di_size;
xlog_print_trans_inode_core(&dino);
/*
* print dquot header region
*
- * bcopy to ensure 8-byte alignment for the long longs in
+ * memmove to ensure 8-byte alignment for the long longs in
* xfs_dq_logformat_t structure
*/
- bcopy(*ptr, &lbuf, MIN(sizeof(xfs_dq_logformat_t), len));
+ memmove(&lbuf, *ptr, MIN(sizeof(xfs_dq_logformat_t), len));
f = &lbuf;
(*i)++; /* bump index */
*ptr += len;
head = (xlog_op_header_t *)*ptr;
xlog_print_op_header(head, *i, ptr);
ASSERT(INT_GET(head->oh_len, ARCH_CONVERT) == sizeof(xfs_disk_dquot_t));
- bcopy(*ptr, &ddq, sizeof(xfs_disk_dquot_t));
+ memmove(&ddq, *ptr, sizeof(xfs_disk_dquot_t));
printf("DQUOT: magic 0x%hx flags 0%ho\n",
INT_GET(ddq.d_magic, ARCH_CONVERT),
INT_GET(ddq.d_flags, ARCH_CONVERT));
ASSERT(xhdrs != NULL);
/* from extra headers */
j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
- k = i % (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
+ k = i % (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
INT_SET(*(uint *)ptr, ARCH_CONVERT,
INT_GET(xhdrs[j-1].xh_cycle_data[k], ARCH_CONVERT));
}
-
+
}
ptr = buf;
break;
}
printf("h_size: %d\n", INT_GET(head->h_size, ARCH_CONVERT));
-
+
*len = INT_GET(head->h_len, ARCH_CONVERT);
return(INT_GET(head->h_num_logops, ARCH_CONVERT));
} /* xlog_print_rec_head */
}
/* for V2 logs read each extra hdr and print it out */
-static int
+static int
xlog_print_extended_headers(
int fd,
int len,
char xhbuf[XLOG_HEADER_SIZE];
xlog_rec_ext_header_t *x;
- num_required = howmany(len, XLOG_HEADER_CYCLE_SIZE);
+ num_required = howmany(len, XLOG_HEADER_CYCLE_SIZE);
num_hdrs = INT_GET(hdr->h_size, ARCH_CONVERT) / XLOG_HEADER_CYCLE_SIZE;
if (num_required > num_hdrs) {
}
else {
if (i == num_hdrs - 1) {
- /* last header */
- coverage_bb = BTOBB(len) %
- (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
+ /* last header */
+ coverage_bb = BTOBB(len) %
+ (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
}
else {
/* earliear header */
*/
x->xh_cycle = ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle;
for (j = 0; j < XLOG_HEADER_CYCLE_SIZE / BBSIZE; j++) {
- x->xh_cycle_data[j] =
- ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle_data[j];
+ x->xh_cycle_data[j] =
+ ((xlog_rec_ext_header_t*)xhbuf)->xh_cycle_data[j];
}
}
return 0;
xfs_caddr_t partial_buf;
int zeroed = 0;
int cleared = 0;
-
+
logBBsize = log->l_logBBsize;
/*
zeroed = 0;
}
- if (num_ops == ZEROED_LOG ||
+ if (num_ops == ZEROED_LOG ||
num_ops == CLEARED_BLKS ||
num_ops == BAD_HEADER) {
if (num_ops == ZEROED_LOG) {
num_ops == CLEARED_BLKS ||
num_ops == BAD_HEADER) {
/* we only expect zeroed log entries or cleared log
- * entries at the end of the _physical_ log,
+ * entries at the end of the _physical_ log,
* so treat them the same as bad blocks here
*/
print_xlog_bad_header(blkno-1, hbuf);
}
partial_log_read:
- error= xlog_print_record(fd,
+ error= xlog_print_record(fd,
num_ops,
- len,
+ len,
&read_type,
&partial_buf,
(xlog_rec_header_t *)hbuf,
if (dolocal && len <= XFS_IFORK_DSIZE(ip)) {
libxfs_idata_realloc(ip, len, XFS_DATA_FORK);
if (buf)
- bcopy(buf, ip->i_df.if_u1.if_data, len);
+ memmove(ip->i_df.if_u1.if_data, buf, len);
ip->i_d.di_size = len;
ip->i_df.if_flags &= ~XFS_IFEXTENTS;
ip->i_df.if_flags |= XFS_IFINLINE;
d = XFS_FSB_TO_DADDR(mp, map.br_startblock);
bp = libxfs_trans_get_buf(logit ? tp : 0, mp->m_dev, d,
nb << mp->m_blkbb_log, 0);
- bcopy(buf, XFS_BUF_PTR(bp), len);
+ memmove(XFS_BUF_PTR(bp), buf, len);
if (len < XFS_BUF_COUNT(bp))
- bzero(XFS_BUF_PTR(bp) + len, XFS_BUF_COUNT(bp) - len);
+ memset(XFS_BUF_PTR(bp) + len, 0, XFS_BUF_COUNT(bp) - len);
if (logit)
libxfs_trans_log_buf(tp, bp, 0, XFS_BUF_COUNT(bp) - 1);
else
cred_t creds;
char *value;
- bzero(&creds, sizeof(creds));
+ memset(&creds, 0, sizeof(creds));
mstr = getstr(pp);
switch (mstr[0]) {
case '-':
tp = libxfs_trans_alloc(mp, 0);
if ((i = libxfs_trans_reserve(tp, MKFS_BLOCKRES_INODE, 0, 0, 0, 0)))
res_failed(i);
- bzero(&creds, sizeof(creds));
- bzero(&fsxattrs, sizeof(fsxattrs));
+ memset(&creds, 0, sizeof(creds));
+ memset(&fsxattrs, 0, sizeof(fsxattrs));
error = libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0,
&creds, &fsxattrs, &rbmip);
if (error) {
_("error reading existing superblock -- failed to memalign buffer\n"));
return;
}
- bzero(buf, new_sb->sb_sectsize);
+ memset(buf, 0, new_sb->sb_sectsize);
if (pread(xi->dfd, buf, new_sb->sb_sectsize, 0) != new_sb->sb_sectsize) {
fprintf(stderr, _("existing superblock read failed: %s\n"),
/*
* block size and basic geometry seems alright, zero the secondaries.
*/
- bzero(buf, new_sb->sb_sectsize);
+ memset(buf, 0, new_sb->sb_sectsize);
off = 0;
for (i = 1; i < sb.sb_agcount; i++) {
off += sb.sb_agblocks;
force_overwrite = 0;
worst_freelist = 0;
lazy_sb_counters = 0;
- bzero(&fsx, sizeof(fsx));
+ memset(&fsx, 0, sizeof(fsx));
- bzero(&xi, sizeof(xi));
+ memset(&xi, 0, sizeof(xi));
xi.isdirect = LIBXFS_DIRECT;
xi.isreadonly = LIBXFS_EXCLUSIVELY;
bsize = 1 << (blocklog - BBSHIFT);
mp = &mbuf;
sbp = &mp->m_sb;
- bzero(mp, sizeof(xfs_mount_t));
+ memset(mp, 0, sizeof(xfs_mount_t));
sbp->sb_blocklog = (__uint8_t)blocklog;
sbp->sb_sectlog = (__uint8_t)sectorlog;
sbp->sb_agblklog = (__uint8_t)libxfs_log2_roundup((unsigned int)agsize);
* ext[2,3] and reiserfs (64k) - and hopefully all else.
*/
buf = libxfs_getbuf(xi.ddev, 0, BTOBB(WHACK_SIZE));
- bzero(XFS_BUF_PTR(buf), WHACK_SIZE);
+ memset(XFS_BUF_PTR(buf), 0, WHACK_SIZE);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
libxfs_purgebuf(buf);
/* OK, now write the superblock */
buf = libxfs_getbuf(xi.ddev, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1));
- bzero(XFS_BUF_PTR(buf), sectorsize);
+ memset(XFS_BUF_PTR(buf), 0, sectorsize);
libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, XFS_SB_ALL_BITS);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
if (!xi.disfile) {
buf = libxfs_getbuf(xi.ddev, (xi.dsize - BTOBB(WHACK_SIZE)),
BTOBB(WHACK_SIZE));
- bzero(XFS_BUF_PTR(buf), WHACK_SIZE);
+ memset(XFS_BUF_PTR(buf), 0, WHACK_SIZE);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
libxfs_purgebuf(buf);
}
buf = libxfs_getbuf(xi.ddev,
XFS_AG_DADDR(mp, agno, XFS_SB_DADDR),
XFS_FSS_TO_BB(mp, 1));
- bzero(XFS_BUF_PTR(buf), sectorsize);
+ memset(XFS_BUF_PTR(buf), 0, sectorsize);
libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, XFS_SB_ALL_BITS);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1));
agf = XFS_BUF_TO_AGF(buf);
- bzero(agf, sectorsize);
+ memset(agf, 0, sectorsize);
if (agno == agcount - 1)
agsize = dblocks - (xfs_drfsbno_t)(agno * agsize);
INT_SET(agf->agf_magicnum, ARCH_CONVERT, XFS_AGF_MAGIC);
XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1));
agi = XFS_BUF_TO_AGI(buf);
- bzero(agi, sectorsize);
+ memset(agi, 0, sectorsize);
INT_SET(agi->agi_magicnum, ARCH_CONVERT, XFS_AGI_MAGIC);
INT_SET(agi->agi_versionnum, ARCH_CONVERT, XFS_AGI_VERSION);
INT_SET(agi->agi_seqno, ARCH_CONVERT, agno);
XFS_AGB_TO_DADDR(mp, agno, XFS_BNO_BLOCK(mp)),
bsize);
block = XFS_BUF_TO_SBLOCK(buf);
- bzero(block, blocksize);
+ memset(block, 0, blocksize);
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_ABTB_MAGIC);
INT_SET(block->bb_level, ARCH_CONVERT, 0);
INT_SET(block->bb_numrecs, ARCH_CONVERT, 1);
XFS_AGB_TO_DADDR(mp, agno, XFS_CNT_BLOCK(mp)),
bsize);
block = XFS_BUF_TO_SBLOCK(buf);
- bzero(block, blocksize);
+ memset(block, 0, blocksize);
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_ABTC_MAGIC);
INT_SET(block->bb_level, ARCH_CONVERT, 0);
INT_SET(block->bb_numrecs, ARCH_CONVERT, 1);
XFS_AGB_TO_DADDR(mp, agno, XFS_IBT_BLOCK(mp)),
bsize);
block = XFS_BUF_TO_SBLOCK(buf);
- bzero(block, blocksize);
+ memset(block, 0, blocksize);
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC);
INT_SET(block->bb_level, ARCH_CONVERT, 0);
INT_SET(block->bb_numrecs, ARCH_CONVERT, 0);
*/
buf = libxfs_getbuf(mp->m_dev,
(xfs_daddr_t)XFS_FSB_TO_BB(mp, dblocks - 1LL), bsize);
- bzero(XFS_BUF_PTR(buf), blocksize);
+ memset(XFS_BUF_PTR(buf), 0, blocksize);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
if (mp->m_rtdev && rtblocks > 0) {
buf = libxfs_getbuf(mp->m_rtdev,
XFS_FSB_TO_BB(mp, rtblocks - 1LL), bsize);
- bzero(XFS_BUF_PTR(buf), blocksize);
+ memset(XFS_BUF_PTR(buf), 0, blocksize);
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
}
xfs_alloc_arg_t args;
xfs_trans_t *tp;
- bzero(&args, sizeof(args));
+ memset(&args, 0, sizeof(args));
args.tp = tp = libxfs_trans_alloc(mp, 0);
args.mp = mp;
args.agno = agno;
* the inprogress fields, version numbers, and counters
* are allowed to differ as well as all fields after the
- * counters to cope with the pre-6.5 mkfs non-bzeroed
+ * counters to cope with the pre-6.5 mkfs non-zeroed
* secondary superblock sectors.
*/
* (e.g. were pre-6.5 beta) could leave garbage in the secondary
* superblock sectors. Anything stamping the shared fs bit or better
* into the secondaries is ok and should generate clean secondary
- * superblock sectors. so only run the bzero check on the
+ * superblock sectors. so only run the zero check on the
* potentially garbaged secondaries.
*/
if (pre_65_beta ||
do_warn(
_("zeroing unused portion of %s superblock (AG #%u)\n"),
!i ? _("primary") : _("secondary"), i);
- bzero((void *)((__psint_t)sb + size),
+ memset((void *)((__psint_t)sb + size), 0,
mp->m_sb.sb_sectsize - size);
} else
do_warn(
/*
* now look for the fields we can manipulate directly.
- * if we did a bzero and that bzero could have included
+ * if we did a zero and that zero could have included
* the field in question, just silently reset it. otherwise,
* complain.
*
int
valuecheck(char *namevalue, char *value, int namelen, int valuelen)
{
- /* for proper alignment issues, get the structs and bcopy the values */
+ /* for proper alignment issues, get the structs and memmove the values */
xfs_mac_label_t macl;
xfs_acl_t thisacl;
void *valuep;
(strncmp(namevalue, SGI_ACL_DEFAULT,
SGI_ACL_DEFAULT_SIZE) == 0)) {
if (value == NULL) {
- bzero(&thisacl, sizeof(xfs_acl_t));
- bcopy(namevalue+namelen, &thisacl, valuelen);
+ memset(&thisacl, 0, sizeof(xfs_acl_t));
+ memmove(&thisacl, namevalue+namelen, valuelen);
valuep = &thisacl;
} else
valuep = value;
}
} else if (strncmp(namevalue, SGI_MAC_FILE, SGI_MAC_FILE_SIZE) == 0) {
if (value == NULL) {
- bzero(&macl, sizeof(xfs_mac_label_t));
- bcopy(namevalue+namelen, &macl, valuelen);
+ memset(&macl, 0, sizeof(xfs_mac_label_t));
+ memmove(&macl, namevalue+namelen, valuelen);
valuep = &macl;
} else
valuep = value;
}
ASSERT(mp->m_sb.sb_blocksize == XFS_BUF_COUNT(bp));
length = MIN(XFS_BUF_COUNT(bp), valuelen - amountdone);
- bcopy(XFS_BUF_PTR(bp), value, length);
+ memmove(value, XFS_BUF_PTR(bp), length);
amountdone += length;
value += length;
i++;
* the way. Then walk the leaf blocks left-to-right, calling
* a parent-verification routine each time we traverse a block.
*/
- bzero(&da_cursor, sizeof(da_bt_cursor_t));
+ memset(&da_cursor, 0, sizeof(da_bt_cursor_t));
da_cursor.active = 0;
da_cursor.type = 0;
da_cursor.ino = ino;
/* and clear the forks */
if (dirty && !no_modify)
- bzero(&dino->di_u, XFS_LITINO(mp));
+ memset(&dino->di_u, 0, XFS_LITINO(mp));
return(dirty);
}
* local symlink, just copy the symlink out of the
* inode into the data area
*/
- bcopy((char *)XFS_DFORK_DPTR(dino),
- symlink, INT_GET(dinoc->di_size, ARCH_CONVERT));
+ memmove(symlink, (char *)XFS_DFORK_DPTR(dino),
+ INT_GET(dinoc->di_size, ARCH_CONVERT));
} else {
/*
* stored in a meta-data file, have to bmap one block
buf_data = (char *)XFS_BUF_PTR(bp);
size = MIN(INT_GET(dinoc->di_size, ARCH_CONVERT)
- amountdone, (int)XFS_FSB_TO_BB(mp, 1)*BBSIZE);
- bcopy(buf_data, cptr, size);
+ memmove(cptr, buf_data, size);
cptr += size;
amountdone += size;
i++;
* happened.
*/
if (junkit) {
- bcopy(sf_entry->name, name, namelen);
+ memmove(name, sf_entry->name, namelen);
name[namelen] = '\0';
if (!no_modify) {
INT_MOD(sf->hdr.count, ARCH_CONVERT, -1);
num_entries--;
- bzero((void *) ((__psint_t) sf_entry + tmp_len),
+ memset((void *) ((__psint_t) sf_entry + tmp_len), 0,
tmp_elen);
/*
void
init_da_freemap(da_freemap_t *dir_freemap)
{
- bzero(dir_freemap, sizeof(da_freemap_t) * DA_BMAP_SIZE);
+ memset(dir_freemap, 0, sizeof(da_freemap_t) * DA_BMAP_SIZE);
}
/*
da_hole_map_t holemap;
init_da_freemap(dir_freemap);
- bzero(&holemap, sizeof(da_hole_map_t));
+ memset(&holemap, 0, sizeof(da_hole_map_t));
set_da_freemap(mp, dir_freemap, 0, 50);
set_da_freemap(mp, dir_freemap, 100, 126);
memmove(entry, entry + 1, (INT_GET(hdr->count, ARCH_CONVERT) - i) *
sizeof(xfs_dir_leaf_entry_t));
}
- bzero((void *) ((__psint_t) entry +
+ memset((void *) ((__psint_t) entry +
(INT_GET(leaf->hdr.count, ARCH_CONVERT) - i - 1) *
- sizeof(xfs_dir_leaf_entry_t)),
+ sizeof(xfs_dir_leaf_entry_t)), 0,
sizeof(xfs_dir_leaf_entry_t));
start = (__psint_t) &leaf->entries[INT_GET(hdr->count, ARCH_CONVERT)] -
(INT_GET(leaf->hdr.count, ARCH_CONVERT) - i - 1) *
sizeof(xfs_dir_leaf_entry_t));
}
- bzero((void *) ((__psint_t) entry +
+ memset((void *) ((__psint_t) entry +
(INT_GET(leaf->hdr.count, ARCH_CONVERT) - i - 1) *
- sizeof(xfs_dir_leaf_entry_t)),
+ sizeof(xfs_dir_leaf_entry_t)), 0,
sizeof(xfs_dir_leaf_entry_t));
/*
sizeof(xfs_dir_leaf_entry_t)) {
memmove(entry, entry + 1,
bytes);
- bzero((void *)
- ((__psint_t) entry + bytes),
+ memset((void *)
+ ((__psint_t) entry + bytes), 0,
sizeof(xfs_dir_leaf_entry_t));
} else {
- bzero(entry,
+ memset(entry, 0,
sizeof(xfs_dir_leaf_entry_t));
}
*/
if (bytes > sizeof(xfs_dir_leaf_entry_t)) {
memmove(entry, entry + 1, bytes);
- bzero((void *)
- ((__psint_t) entry + bytes),
+ memset((void *)
+ ((__psint_t) entry + bytes), 0,
sizeof(xfs_dir_leaf_entry_t));
} else {
- bzero(entry,
+ memset(entry, 0,
sizeof(xfs_dir_leaf_entry_t));
}
* making it impossible for the stored length
* value to be out of range.
*/
- bcopy(namest->name, fname, entry->namelen);
+ memmove(fname, namest->name, entry->namelen);
fname[entry->namelen] = '\0';
hashval = libxfs_da_hashname((uchar_t *) fname, entry->namelen);
* (XFS_DIR_LEAF_MAPSIZE (3) * biggest regions)
* and see if they match what's in the block
*/
- bzero(&holemap, sizeof(da_hole_map_t));
+ memset(&holemap, 0, sizeof(da_hole_map_t));
process_da_freemap(mp, dir_freemap, &holemap);
if (zero_len_entries) {
/*
* copy leaf block header
*/
- bcopy(&leaf->hdr, &new_leaf->hdr,
+ memmove(&new_leaf->hdr, &leaf->hdr,
sizeof(xfs_dir_leaf_hdr_t));
/*
d_entry->namelen = s_entry->namelen;
d_entry->pad2 = 0;
- bcopy((char *) leaf + INT_GET(s_entry->nameidx, ARCH_CONVERT),
- first_byte, bytes);
+ memmove(first_byte, (char *) leaf + INT_GET(s_entry->nameidx, ARCH_CONVERT),
+ bytes);
num_entries++;
d_entry++;
/*
* zero space between end of table and top of heap
*/
- bzero(d_entry, (__psint_t) first_byte
+ memset(d_entry, 0, (__psint_t) first_byte
- (__psint_t) d_entry);
/*
/*
* final step, copy block back
*/
- bcopy(new_leaf, leaf, mp->m_sb.sb_blocksize);
+ memmove(leaf, new_leaf, mp->m_sb.sb_blocksize);
*buf_dirty = 1;
} else {
* the way. Then walk the leaf blocks left-to-right, calling
* a parent-verification routine each time we traverse a block.
*/
- bzero(&da_cursor, sizeof(da_bt_cursor_t));
+ memset(&da_cursor, 0, sizeof(da_bt_cursor_t));
da_cursor.active = 0;
da_cursor.type = 0;
}
for (i = off = 0; i < nex; i++, off += XFS_BUF_COUNT(bp)) {
bp = bplist[i];
- bcopy(XFS_BUF_PTR(bp), (char *)dabuf->data + off,
+ memmove((char *)dabuf->data + off, XFS_BUF_PTR(bp),
XFS_BUF_COUNT(bp));
}
}
dabuf->dirty = 0;
for (i=off=0; i < dabuf->nbuf; i++, off += XFS_BUF_COUNT(bp)) {
bp = dabuf->bps[i];
- bcopy((char *)dabuf->data + off, XFS_BUF_PTR(bp),
+ memmove(XFS_BUF_PTR(bp), (char *)dabuf->data + off,
XFS_BUF_COUNT(bp));
}
}
do_error(_("couldn't malloc dir2 buffer list\n"));
exit(1);
}
- bcopy(dabuf->bps, bplist, nbuf * sizeof(*bplist));
+ memmove(bplist, dabuf->bps, nbuf * sizeof(*bplist));
for (i = off = 0; i < nbuf; i++, off += XFS_BUF_COUNT(bp)) {
bp = bplist[i];
- bcopy((char *)dabuf->data + off, XFS_BUF_PTR(bp),
+ memmove(XFS_BUF_PTR(bp), (char *)dabuf->data + off,
XFS_BUF_COUNT(bp));
}
}
do_error(_("couldn't malloc dir2 buffer list\n"));
exit(1);
}
- bcopy(dabuf->bps, bplist, nbuf * sizeof(*bplist));
+ memmove(bplist, dabuf->bps, nbuf * sizeof(*bplist));
}
da_buf_done(dabuf);
for (i = 0; i < nbuf; i++) {
* happened.
*/
if (junkit) {
- bcopy(sfep->name, name, namelen);
+ memmove(name, sfep->name, namelen);
name[namelen] = '\0';
if (!no_modify) {
INT_MOD(sfp->hdr.count, ARCH_CONVERT, -1);
num_entries--;
- bzero((void *) ((__psint_t) sfep + tmp_len),
+ memset((void *) ((__psint_t) sfep + tmp_len), 0,
tmp_elen);
/*
* Then walk the leaf blocks left-to-right, calling a parent
* verification routine each time we traverse a block.
*/
- bzero(&da_cursor, sizeof(da_cursor));
+ memset(&da_cursor, 0, sizeof(da_cursor));
da_cursor.ino = ino;
da_cursor.dip = dip;
da_cursor.blkmap = blkmap;
* the partial sb mask bit set, then you depend on the fields
* in it up to and including sb_inoalignmt but the unused part of the
* sector may have trash in it. If the sb has any bits set that are in
- * the good mask, then the entire sb and sector are good (was bzero'ed
+ * the good mask, then the entire sb and sector are good (was zero'ed
* by mkfs). The third mask is for filesystems made by pre-6.5 campus
* alpha mkfs's. Those are rare so we'll check for those under
* a special option.
numblocks);
return;
}
- bzero(ba_bmap[i], size);
+ memset(ba_bmap[i], 0, size);
pthread_mutex_init(&ag_locks[i], NULL);
}
{
int i;
- bzero(cursor, sizeof(bmap_cursor_t));
+ memset(cursor, 0, sizeof(bmap_cursor_t));
cursor->ino = NULLFSINO;
cursor->num_levels = num_levels;
if (!tmp)
do_error(_("couldn't memalign pentries table\n"));
- (void) bcopy(ptbl->pentries, tmp,
- target * sizeof(parent_entry_t));
+ memmove(tmp, ptbl->pentries, target * sizeof(parent_entry_t));
if (cnt > target)
- (void) bcopy(ptbl->pentries + target,
- tmp + target + 1,
+ memmove(tmp + target + 1, ptbl->pentries + target,
(cnt - target) * sizeof(parent_entry_t));
free(ptbl->pentries);
if ((last_rec = malloc(sizeof(ino_tree_node_t *) * agcount)) == NULL)
do_error(_("couldn't malloc uncertain inode cache area\n"));
- bzero(last_rec, sizeof(ino_tree_node_t *) * agcount);
+ memset(last_rec, 0, sizeof(ino_tree_node_t *) * agcount);
full_ino_ex_data = 0;
}
/*
* now reset the bitmap for all ags
*/
- bzero(ba_bmap[i],
+ memset(ba_bmap[i], 0,
roundup((mp->m_sb.sb_agblocks+(NBBY/XR_BB)-1)/(NBBY/XR_BB),
sizeof(__uint64_t)));
for (j = 0; j < ag_hdr_block; j++)
* extents of free blocks. At this point, we know
* that blocks in the bitmap are either set to an
* "in use" state or set to unknown (0) since the
- * bmaps were bzero'ed in phase 4 and only blocks
+ * bmaps were zero'ed in phase 4 and only blocks
* being used by inodes, inode bmaps, ag headers,
* and the files themselves were put into the bitmap.
*
* initialize block header
*/
bt_hdr = XFS_BUF_TO_ALLOC_BLOCK(lptr->buf_p);
- bzero(bt_hdr, mp->m_sb.sb_blocksize);
+ memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, magic);
INT_SET(bt_hdr->bb_level, ARCH_CONVERT, level);
* initialize block header
*/
bt_hdr = XFS_BUF_TO_ALLOC_BLOCK(lptr->buf_p);
- bzero(bt_hdr, mp->m_sb.sb_blocksize);
+ memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, magic);
INT_SET(bt_hdr->bb_level, ARCH_CONVERT, i);
* block initialization, lay in block header
*/
bt_hdr = XFS_BUF_TO_ALLOC_BLOCK(lptr->buf_p);
- bzero(bt_hdr, mp->m_sb.sb_blocksize);
+ memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, magic);
bt_hdr->bb_level = 0;
* initialize block header
*/
bt_hdr = XFS_BUF_TO_INOBT_BLOCK(lptr->buf_p);
- bzero(bt_hdr, mp->m_sb.sb_blocksize);
+ memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC);
INT_SET(bt_hdr->bb_level, ARCH_CONVERT, level);
XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
mp->m_sb.sb_sectsize/BBSIZE);
agi = XFS_BUF_TO_AGI(agi_buf);
- bzero(agi, mp->m_sb.sb_sectsize);
+ memset(agi, 0, mp->m_sb.sb_sectsize);
INT_SET(agi->agi_magicnum, ARCH_CONVERT, XFS_AGI_MAGIC);
INT_SET(agi->agi_versionnum, ARCH_CONVERT, XFS_AGI_VERSION);
* initialize block header
*/
bt_hdr = XFS_BUF_TO_INOBT_BLOCK(lptr->buf_p);
- bzero(bt_hdr, mp->m_sb.sb_blocksize);
+ memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC);
INT_SET(bt_hdr->bb_level, ARCH_CONVERT, i);
* block initialization, lay in block header
*/
bt_hdr = XFS_BUF_TO_INOBT_BLOCK(lptr->buf_p);
- bzero(bt_hdr, mp->m_sb.sb_blocksize);
+ memset(bt_hdr, 0, mp->m_sb.sb_blocksize);
INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC);
bt_hdr->bb_level = 0;
XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
mp->m_sb.sb_sectsize/BBSIZE);
agf = XFS_BUF_TO_AGF(agf_buf);
- bzero(agf, mp->m_sb.sb_sectsize);
+ memset(agf, 0, mp->m_sb.sb_sectsize);
#ifdef XR_BLD_FREE_TRACE
fprintf(stderr, "agf = 0x%x, agf_buf->b_un.b_addr = 0x%x\n",
XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
mp->m_sb.sb_sectsize/BBSIZE);
agfl = XFS_BUF_TO_AGFL(agfl_buf);
- bzero(agfl, mp->m_sb.sb_sectsize);
+ memset(agfl, 0, mp->m_sb.sb_sectsize);
/*
* ok, now grab as many blocks as we can
*/
error);
}
- bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
+ memset(&ip->i_d, 0, sizeof(xfs_dinode_core_t));
ip->i_d.di_magic = XFS_DINODE_MAGIC;
ip->i_d.di_mode = S_IFREG;
return(1);
}
- bcopy(bmp, XFS_BUF_PTR(bp), mp->m_sb.sb_blocksize);
+ memmove(XFS_BUF_PTR(bp), bmp, mp->m_sb.sb_blocksize);
libxfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);
return(1);
}
- bcopy(smp, XFS_BUF_PTR(bp), mp->m_sb.sb_blocksize);
+ memmove(XFS_BUF_PTR(bp), smp, mp->m_sb.sb_blocksize);
libxfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);
error);
}
- bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
+ memset(&ip->i_d, 0, sizeof(xfs_dinode_core_t));
ip->i_d.di_magic = XFS_DINODE_MAGIC;
ip->i_d.di_mode = S_IFREG;
/*
* take care of the core -- initialization from xfs_ialloc()
*/
- bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
+ memset(&ip->i_d, 0, sizeof(xfs_dinode_core_t));
ip->i_d.di_magic = XFS_DINODE_MAGIC;
ip->i_d.di_mode = (__uint16_t) mode|S_IFDIR;
/*
* snag the info we need out of the directory then release all buffers
*/
- bcopy(namest->name, fname, entry->namelen);
+ memmove(fname, namest->name, entry->namelen);
fname[entry->namelen] = '\0';
*hashval = INT_GET(entry->hashval, ARCH_CONVERT);
namelen = entry->namelen;
junkit = 0;
XFS_DIR_SF_GET_DIRINO(&namest->inumber, &lino);
- bcopy(namest->name, fname, entry->namelen);
+ memmove(fname, namest->name, entry->namelen);
fname[entry->namelen] = '\0';
ASSERT(lino != NULLFSINO);
libxfs_trans_ijoin(tp, ip, 0);
libxfs_trans_ihold(tp, ip);
libxfs_da_bjoin(tp, bp);
- bzero(&args, sizeof(args));
+ memset(&args, 0, sizeof(args));
XFS_BMAP_INIT(&flist, &firstblock);
args.dp = ip;
args.trans = tp;
continue;
}
- bcopy(dep->name, fname, dep->namelen);
+ memmove(fname, dep->name, dep->namelen);
fname[dep->namelen] = '\0';
ASSERT(inum != NULLFSINO);
}
}
- bcopy(sf_entry->name, fname, sf_entry->namelen);
+ memmove(fname, sf_entry->name, sf_entry->namelen);
fname[sf_entry->namelen] = '\0';
ASSERT(no_modify || lino != NULLFSINO);
memmove(sf_entry, tmp_sfe, tmp_len);
INT_MOD(sf->hdr.count, ARCH_CONVERT, -1);
- bzero((void *) ((__psint_t) sf_entry + tmp_len),
+ memset((void *) ((__psint_t) sf_entry + tmp_len), 0,
tmp_elen);
/*
XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino);
- bcopy(sf_entry->name, fname, sf_entry->namelen);
+ memmove(fname, sf_entry->name, sf_entry->namelen);
fname[sf_entry->namelen] = '\0';
if (sf_entry->name[0] == '/') {
memmove(sf_entry, tmp_sfe, tmp_len);
INT_MOD(sf->hdr.count, ARCH_CONVERT, -1);
- bzero((void *) ((__psint_t) sf_entry + tmp_len),
+ memset((void *) ((__psint_t) sf_entry + tmp_len), 0,
tmp_elen);
/*
}
}
- bcopy(sfep->name, fname, sfep->namelen);
+ memmove(fname, sfep->name, sfep->namelen);
fname[sfep->namelen] = '\0';
ASSERT(no_modify || (lino != NULLFSINO && lino != 0));
memmove(sfep, tmp_sfep, tmp_len);
INT_MOD(sfp->hdr.count, ARCH_CONVERT, -1);
- bzero((void *) ((__psint_t) sfep + tmp_len),
+ memset((void *) ((__psint_t) sfep + tmp_len), 0,
tmp_elen);
/*
ino_tree_node_t *irec;
int i;
- bzero(&zerocr, sizeof(struct cred));
- bzero(&zerofsx, sizeof(struct fsxattr));
+ memset(&zerocr, 0, sizeof(struct cred));
+ memset(&zerofsx, 0, sizeof(struct fsxattr));
orphanage_ino = 0;
do_log(_("Phase 6 - check inode connectivity...\n"));
continue;
}
bytes = bp->b_un.b_addr;
- bcopy(bytes, (char *)sumfile + sumbno * mp->m_sb.sb_blocksize,
+ memmove((char *)sumfile + sumbno * mp->m_sb.sb_blocksize, bytes,
mp->m_sb.sb_blocksize);
libxfs_putbuf(bp);
}
dest->sb_fdblocks = 0;
dest->sb_frextents = 0;
- bzero(source->sb_fname, 12);
+ memset(source->sb_fname, 0, 12);
}
/*
exit(1);
}
- bzero(&bufsb, sizeof(xfs_sb_t));
+ memset(&bufsb, 0, sizeof(xfs_sb_t));
retval = 0;
dirty = 0;
bsize = 0;
* found one. now verify it by looking
* for other secondaries.
*/
- bcopy(&bufsb, rsb, sizeof(xfs_sb_t));
+ memmove(rsb, &bufsb, sizeof(xfs_sb_t));
rsb->sb_inprogress = 0;
clear_sunit = 1;
void
get_sb_geometry(fs_geometry_t *geo, xfs_sb_t *sbp)
{
- bzero(geo, sizeof(fs_geometry_t));
+ memset(geo, 0, sizeof(fs_geometry_t));
/*
* blindly set fields that we know are always good
* superblock fields located after sb_widthfields get set
* into the geometry structure only if we can determine
* from the features enabled in this superblock whether
- * or not the sector was bzero'd at mkfs time.
+ * or not the sector was zero'd at mkfs time.
*/
if ((!pre_65_beta && (sbp->sb_versionnum & XR_GOOD_SECSB_VNMASK)) ||
(pre_65_beta && (sbp->sb_versionnum & XR_ALPHA_SECSB_VNMASK))) {
iosz = dioattr.d_miniosz;
fbuf = memalign( dioattr.d_mem, iosz);
- bzero (fbuf, iosz);
+ memset(fbuf, 0, iosz);
/*
* read the entire source file
return( -1 );
}
- bzero( fbuf, iosz);
+ memset( fbuf, 0, iosz);
}
close(fromfd);