* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
+#include <libcfs/libcfs.h>
#include <lustre/liblustreapi.h>
#define T1 "write data before unlink\n"
int bufsize = 0;
#define ALIGN 65535
-char usage[] =
+char usage[] =
"Usage: %s filename command-sequence\n"
" command-sequence items:\n"
" c close\n"
" T[num] ftruncate [optional position, default 0]\n"
" u unlink\n"
" U munmap\n"
+" v verbose\n"
" w[num] write optional length\n"
" W write entire mmap-ed region\n"
" y fsync\n"
exit(1);
}
+ memset(&st, 0, sizeof(st));
signal(SIGUSR1, usr1_handler);
fname = argv[1];
}
break;
case 'M':
+ if (st.st_size == 0) {
+ fprintf(stderr, "mmap without preceeding stat, or on"
+ " zero length file.\n");
+ exit(-1);
+ }
mmap_len = st.st_size;
mmap_ptr = mmap(NULL, mmap_len, PROT_WRITE | PROT_READ,
MAP_SHARED, fd, 0);
fprintf(stderr, "short read: %u/%u\n",
rc, len);
len -= rc;
+ if (verbose >= 2)
+ printf("%.*s\n", rc, buf_align);
}
break;
case 'R':
}
break;
case 'v':
- verbose = 1;
+ verbose++;
break;
case 'w':
len = atoi(commands+1);