Module Name: src Committed By: christos Date: Mon Mar 7 15:58:05 UTC 2016
Modified Files: src/usr.sbin/makefs/chfs: chfs_mkfs.c Log Message: PR/50911: David Binderman: Optimize memset To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makefs/chfs/chfs_mkfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makefs/chfs/chfs_mkfs.c diff -u src/usr.sbin/makefs/chfs/chfs_mkfs.c:1.6 src/usr.sbin/makefs/chfs/chfs_mkfs.c:1.7 --- src/usr.sbin/makefs/chfs/chfs_mkfs.c:1.6 Mon Jan 28 16:03:28 2013 +++ src/usr.sbin/makefs/chfs/chfs_mkfs.c Mon Mar 7 10:58:05 2016 @@ -124,7 +124,6 @@ write_eb_header(fsinfo_t *fsopts) if ((uint32_t)opts->pagesize < MINSIZE) errx(EXIT_FAILURE, "pagesize cannot be less than %zu", MINSIZE); buf = emalloc(opts->pagesize); - memset(buf, 0xFF, opts->pagesize); ebhdr.ec_hdr.magic = htole32(CHFS_MAGIC_BITMASK); ebhdr.ec_hdr.erase_cnt = htole32(1); @@ -132,6 +131,8 @@ write_eb_header(fsinfo_t *fsopts) (uint8_t *)&ebhdr.ec_hdr + 8, 4)); memcpy(buf, &ebhdr.ec_hdr, CHFS_EB_EC_HDR_SIZE); + memset(buf + CHFS_EB_EC_HDR_SIZE, 0xFF, + opts->pagesize - CHFS_EB_EC_HDR_SIZE); buf_write(fsopts, buf, opts->pagesize);