[xfs-masters] [PATCH 3/6] fsx: Replace use of bzero() with memset()

Theodore Ts'o tytso at mit.edu
Tue May 12 11:14:22 CDT 2009


The bzero() function comes from BSD 4.3, and was deprecated in
POSIX.1-2001.  It was removed entirely in POSIX.1-2008.

Signed-off-by: "Theodore Ts'o" <tytso at mit.edu>
---
 ltp/fsx.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index b2b17cd..2574165 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -589,7 +589,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!");
@@ -656,7 +656,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!");
@@ -718,7 +718,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)
@@ -1245,10 +1245,10 @@ main(int argc, char **argv)
 		original_buf[i] = random() % 256;
 	good_buf = (char *) malloc(maxfilelen + writebdy);
 	good_buf = round_up(good_buf, writebdy, 0);
-	bzero(good_buf, maxfilelen);
+	memset(good_buf, '\0', maxfilelen);
 	temp_buf = (char *) malloc(maxoplen + readbdy);
 	temp_buf = round_up(temp_buf, readbdy, 0);
-	bzero(temp_buf, maxoplen);
+	memset(temp_buf, '\0', maxoplen);
 	if (lite) {	/* zero entire existing file */
 		ssize_t written;
 
-- 
1.6.3.rc4.1.g3e14.dirty



More information about the xfs-masters mailing list