#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <sys/vfs.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
" C[num] create with optional stripes\n"
" d mkdir\n"
" D open(O_DIRECTORY)\n"
+" f statfs\n"
" L link\n"
" l symlink\n"
" m mknod\n"
}
#define POP_ARG() (pop_arg(argc, argv))
-#define min(a,b) ((a)>(b)?(b):(a))
int main(int argc, char **argv)
{
char *fname, *commands;
const char *newfile;
struct stat st;
+ struct statfs stfs;
size_t mmap_len = 0, i;
unsigned char *mmap_ptr = NULL, junk = 0;
int rc, len, fd = -1;
exit(save_errno);
}
break;
+ case 'f':
+ if (statfs(fname, &stfs) == -1) {
+ save_errno = errno;
+ perror("statfs()");
+ exit(save_errno);
+ }
+ break;
case 'l':
newfile = POP_ARG();
if (!newfile)
case 'o':
len = get_flags(commands+1, &flags);
commands += len;
- fd = open(fname, flags);
+ if (flags & O_CREAT)
+ fd = open(fname, flags, 0666);
+ else
+ fd = open(fname, flags);
if (fd == -1) {
save_errno = errno;
perror("open");