From: Robert W. <ro...@us...> - 2005-12-12 21:20:35
|
Update of /cvsroot/ltp/ltp/testcases/network/nfs/nfs04 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29992 Modified Files: nfs04 Added Files: nfs04_create_file.c Removed Files: create_file.c Log Message: Renamed create_file.c to nfs04_create_file.c to resolve duplicate name problem with network stress tests. --- NEW FILE: nfs04_create_file.c --- /* * * Copyright (c) International Business Machines Corp., 2003 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * FILE : create_file.c * PURPOSE : Creates a text file of specified size. * HISTORY : * 10/17/2003 Robbie Williamson * -Written */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <string.h> /* set write buffer size to whatever floats your boat. I usually use 1M */ #define BSIZE 1048576L int main(int argc, char *argv[]) { off_t i; long bufnum; char buf[BSIZE]; off_t fd; if (argc != 3 || atoi(argv[1]) < 1) { printf("usage:\n\tcreate_file <# of %ld buffers to write> <name of file to create>\n\t ex. # create_file 10 /tmp/testfile\n",BSIZE); exit(3); } bufnum = strtol(argv[1],NULL,0); printf("Started building a %lu megabyte file\n",bufnum); buf[0]='A'; for (i=1;i<BSIZE;i++) buf[i]=buf[i-1]+1; buf[BSIZE-1]='Z'; if ((fd = creat(argv[2],0755)) == -1) perror("lftest: "); for (i=0;i<bufnum;i++) { if (write(fd,buf,BSIZE) == -1) return -1; else { printf("."); fflush(stdout); } fsync(fd); } close(fd); printf("\nFinished building a %lu megabyte file\n",bufnum); return (0); } --- create_file.c DELETED --- Index: nfs04 =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/nfs/nfs04/nfs04,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nfs04 11 Jul 2005 18:33:28 -0000 1.9 --- nfs04 12 Dec 2005 21:20:27 -0000 1.10 *************** *** 137,141 **** $trace_logic loopcount=0 ! create_file $FILESIZE /tmp/nfs04$PID.testfile >/dev/null if [ $? != 0 ]; then end_testcase "Could not create testfile" --- 137,141 ---- $trace_logic loopcount=0 ! nfs04_create_file $FILESIZE /tmp/nfs04$PID.testfile >/dev/null if [ $? != 0 ]; then end_testcase "Could not create testfile" |