Lines Matching refs:file

153 		"Performs some random file actions for file system testing.\n"
158 " -f, --file-count=<count>\tThe maximal number of files to create.\n"
162 " -m, --max-file-size=<size>\tThe maximal file size of the files.\n"
170 " -n, --no-cache\t\tDisables the file cache when doing I/O on\n"
171 "\t\t\t\ta file.\n"
315 // in the append case, we need to check the file size
318 error("stat file failed: %s\n", strerror(errno));
390 check_file(const struct entry& file)
392 int fd = open_file(file.name, O_RDONLY);
394 error("opening file \"%s\" failed: %s", file.name.c_str(),
402 error("stat file \"%s\" failed: %s", file.name.c_str(), strerror(errno));
404 if (file.size != stat.st_size) {
406 file.name.c_str(), file.size, stat.st_size);
413 off_t size = file.size;
425 error("reading \"%s\" failed: %s", file.name.c_str(),
431 generate_block(generatedBlock, file, offset);
436 error("block at %lld differ in \"%s\"!", offset, file.name.c_str());
455 const struct entry& file = *i;
457 check_file(file);
558 std::string name = create_name(parent, "file");
560 action("create file %s (identifier %lu)", name.c_str(), sCount);
564 error("creating file \"%s\" failed: %s", name.c_str(), strerror(errno));
566 struct entry file;
567 file.name = name;
568 file.identifier = sCount;
569 file.size = 0;
570 write_blocks(fd, file);
572 files.push_back(file);
574 fs_write_attr(fd, kIdentifierAttribute, B_UINT32_TYPE, 0, &file.identifier,
594 error("removing file \"%s\" failed: %s", name.c_str(), strerror(errno));
596 action("removed file %s", name.c_str());
610 std::string newName = create_name(parent, "renamed-file");
615 action("rename file \"%s\" to \"%s\"", oldName.c_str(), newName.c_str());
618 error("renaming file \"%s\" to \"%s\" failed: %s", oldName.c_str(),
632 struct entry& file = files[choose_index(files)];
634 action("append to \"%s\"", file.name.c_str());
636 int fd = open_file(file.name, O_WRONLY | O_APPEND);
638 error("appending to file \"%s\" failed: %s", file.name.c_str(),
642 write_blocks(fd, file, true);
653 struct entry& file = files[choose_index(files)];
655 action("replace \"%s\" contents", file.name.c_str());
658 check_file(file);
660 int fd = open_file(file.name, O_CREAT | O_WRONLY | O_TRUNC);
662 error("replacing file \"%s\" failed: %s", file.name.c_str(),
666 file.size = 0;
667 write_blocks(fd, file);
679 struct entry& file = files[choose_index(files)];
681 action("truncate \"%s\"", file.name.c_str());
684 check_file(file);
686 int fd = open_file(file.name, O_WRONLY | O_TRUNC);
688 error("truncating file \"%s\" failed: %s", file.name.c_str(),
692 file.size = 0;
709 {"file-count", required_argument, 0, 'f'},
712 {"max-file-size", required_argument, 0, 'm'},
752 // file count
774 // max file size
828 // create a single file