Lines Matching refs:fname

44   PosixSequentialFile(const std::string& fname, FILE* f)
45 : filename_(fname), file_(f) { }
78 PosixRandomAccessFile(const std::string& fname, int fd)
79 : filename_(fname), fd_(fd) { }
154 PosixMmapReadableFile(const std::string& fname, void* base, size_t length,
156 : filename_(fname), mmapped_region_(base), length_(length),
184 PosixWritableFile(const std::string& fname, FILE* f)
185 : filename_(fname), file_(f) { }
284 bool Insert(const std::string& fname) {
286 return locked_files_.insert(fname).second;
288 void Remove(const std::string& fname) {
290 locked_files_.erase(fname);
302 virtual Status NewSequentialFile(const std::string& fname,
304 FILE* f = fopen(fname.c_str(), "r");
307 return IOError(fname, errno);
309 *result = new PosixSequentialFile(fname, f);
314 virtual Status NewRandomAccessFile(const std::string& fname,
318 int fd = open(fname.c_str(), O_RDONLY);
320 s = IOError(fname, errno);
323 s = GetFileSize(fname, &size);
327 *result = new PosixMmapReadableFile(fname, base, size, &mmap_limit_);
329 s = IOError(fname, errno);
337 *result = new PosixRandomAccessFile(fname, fd);
342 virtual Status NewWritableFile(const std::string& fname,
345 FILE* f = fopen(fname.c_str(), "w");
348 s = IOError(fname, errno);
350 *result = new PosixWritableFile(fname, f);
355 virtual bool FileExists(const std::string& fname) {
356 return access(fname.c_str(), F_OK) == 0;
374 virtual Status DeleteFile(const std::string& fname) {
376 if (unlink(fname.c_str()) != 0) {
377 result = IOError(fname, errno);
398 virtual Status GetFileSize(const std::string& fname, uint64_t* size) {
401 if (stat(fname.c_str(), &sbuf) != 0) {
403 s = IOError(fname, errno);
418 virtual Status LockFile(const std::string& fname, FileLock** lock) {
421 int fd = open(fname.c_str(), O_RDWR | O_CREAT, 0644);
423 result = IOError(fname, errno);
424 } else if (!locks_.Insert(fname)) {
426 result = Status::IOError("lock " + fname, "already held by process");
428 result = IOError("lock " + fname, errno);
430 locks_.Remove(fname);
434 my_lock->name_ = fname;
477 virtual Status NewLogger(const std::string& fname, Logger** result) {
478 FILE* f = fopen(fname.c_str(), "w");
481 return IOError(fname, errno);