* BEntry::GetStat() and BNode::GetStat() used sizeof(struct stat) for the kernel
syscall, but they could not know if R5 code called them (in which case the stat size has a different size). We now always only return the R5 stat structure here. This fixes bug #420. We might want to find a different solution to this problem, though. * Be got SYMLINK_MAX wrong - it's not the maximum number of links (that's SYMLOOP_MAX), but the maximum size of a symlink buffer. Added missing SYMLOOP_MAX and SYMLINK_MAX constants to limits.h. * Fixes MAXSYMLINKS to use SYMLOOP_MAX, instead of SYMLINKS_MAX (which doesn't exist in POSIX specs, but we (intentionally) break source compatibility here). * Reenabled the Haiku versions of stat(), fstat(), and lstat() when build for Haiku. * Removed OpenBeOS namespace stuff from the files I touched. * Removed superfluous StorageDefs.Private.h, whyever that ended up in a public header is beyond me. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+42
-68
@@ -1,89 +1,63 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file File.h
|
||||
BFile interface declaration.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FILE_H
|
||||
#define _FILE_H
|
||||
|
||||
|
||||
#include <DataIO.h>
|
||||
#include <Node.h>
|
||||
#include <StorageDefs.Private.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class BFile
|
||||
\brief BFile is a wrapper class for common operations on files providing
|
||||
access to the file's content data and its attributes.
|
||||
|
||||
A BFile represents a file in some file system. It implements the
|
||||
BPositionIO interface and thus the methods to read from and write to the
|
||||
file, and is derived of BNode to provide access to the file's attributes.
|
||||
|
||||
\author <a href='mailto:[email protected]'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BFile : public BNode, public BPositionIO {
|
||||
public:
|
||||
BFile();
|
||||
BFile(const BFile &file);
|
||||
BFile(const entry_ref *ref, uint32 openMode);
|
||||
BFile(const BEntry *entry, uint32 openMode);
|
||||
BFile(const char *path, uint32 openMode);
|
||||
BFile(const BDirectory *dir, const char *path, uint32 openMode);
|
||||
virtual ~BFile();
|
||||
public:
|
||||
BFile();
|
||||
BFile(const BFile &file);
|
||||
BFile(const entry_ref *ref, uint32 openMode);
|
||||
BFile(const BEntry *entry, uint32 openMode);
|
||||
BFile(const char *path, uint32 openMode);
|
||||
BFile(const BDirectory *dir, const char *path, uint32 openMode);
|
||||
virtual ~BFile();
|
||||
|
||||
status_t SetTo(const entry_ref *ref, uint32 openMode);
|
||||
status_t SetTo(const BEntry *entry, uint32 openMode);
|
||||
status_t SetTo(const char *path, uint32 openMode);
|
||||
status_t SetTo(const BDirectory *dir, const char *path, uint32 openMode);
|
||||
status_t SetTo(const entry_ref *ref, uint32 openMode);
|
||||
status_t SetTo(const BEntry *entry, uint32 openMode);
|
||||
status_t SetTo(const char *path, uint32 openMode);
|
||||
status_t SetTo(const BDirectory *dir, const char *path, uint32 openMode);
|
||||
|
||||
bool IsReadable() const;
|
||||
bool IsWritable() const;
|
||||
bool IsReadable() const;
|
||||
bool IsWritable() const;
|
||||
|
||||
virtual ssize_t Read(void *buffer, size_t size);
|
||||
virtual ssize_t ReadAt(off_t location, void *buffer, size_t size);
|
||||
virtual ssize_t Write(const void *buffer, size_t size);
|
||||
virtual ssize_t WriteAt(off_t location, const void *buffer, size_t size);
|
||||
virtual ssize_t Read(void *buffer, size_t size);
|
||||
virtual ssize_t ReadAt(off_t location, void *buffer, size_t size);
|
||||
virtual ssize_t Write(const void *buffer, size_t size);
|
||||
virtual ssize_t WriteAt(off_t location, const void *buffer, size_t size);
|
||||
|
||||
virtual off_t Seek(off_t offset, uint32 seekMode);
|
||||
virtual off_t Position() const;
|
||||
virtual off_t Seek(off_t offset, uint32 seekMode);
|
||||
virtual off_t Position() const;
|
||||
|
||||
virtual status_t SetSize(off_t size);
|
||||
virtual status_t GetSize(off_t* size) const;
|
||||
virtual status_t SetSize(off_t size);
|
||||
virtual status_t GetSize(off_t* size) const;
|
||||
|
||||
BFile &operator=(const BFile &file);
|
||||
BFile &operator=(const BFile &file);
|
||||
|
||||
private:
|
||||
virtual void _PhiloFile1();
|
||||
virtual void _PhiloFile2();
|
||||
virtual void _PhiloFile3();
|
||||
virtual void _PhiloFile4();
|
||||
virtual void _PhiloFile5();
|
||||
virtual void _PhiloFile6();
|
||||
private:
|
||||
virtual void _PhiloFile1();
|
||||
virtual void _PhiloFile2();
|
||||
virtual void _PhiloFile3();
|
||||
virtual void _PhiloFile4();
|
||||
virtual void _PhiloFile5();
|
||||
virtual void _PhiloFile6();
|
||||
|
||||
uint32 _reservedData[8];
|
||||
uint32 _reservedData[8];
|
||||
|
||||
private:
|
||||
int get_fd() const;
|
||||
virtual void close_fd();
|
||||
private:
|
||||
int get_fd() const;
|
||||
virtual void close_fd();
|
||||
|
||||
private:
|
||||
//! The file's open mode.
|
||||
uint32 fMode;
|
||||
private:
|
||||
//! The file's open mode.
|
||||
uint32 fMode;
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _FILE_H
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user