* 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:
@@ -1,114 +1,84 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Directory.h
|
||||
BDirectory interface declaration.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _DIRECTORY_H
|
||||
#define _DIRECTORY_H
|
||||
|
||||
|
||||
#include <Node.h>
|
||||
#include <EntryList.h>
|
||||
#include <StorageDefs.h>
|
||||
#include <StorageDefs.Private.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BSymLink;
|
||||
|
||||
/*!
|
||||
\class BDirectory
|
||||
\brief A directory in the filesystem
|
||||
|
||||
Provides an interface for manipulating directories and their contents.
|
||||
|
||||
\author <a href='mailto:[email protected]'>Ingo Weinhold</a>
|
||||
\author <a href="mailto:[email protected]">Tyler Dauwalder</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BDirectory : public BNode, public BEntryList {
|
||||
public:
|
||||
BDirectory();
|
||||
BDirectory(const BDirectory &dir);
|
||||
BDirectory(const entry_ref *ref);
|
||||
BDirectory(const node_ref *nref);
|
||||
BDirectory(const BEntry *entry);
|
||||
BDirectory(const char *path);
|
||||
BDirectory(const BDirectory *dir, const char *path);
|
||||
public:
|
||||
BDirectory();
|
||||
BDirectory(const BDirectory &dir);
|
||||
BDirectory(const entry_ref *ref);
|
||||
BDirectory(const node_ref *nref);
|
||||
BDirectory(const BEntry *entry);
|
||||
BDirectory(const char *path);
|
||||
BDirectory(const BDirectory *dir, const char *path);
|
||||
|
||||
virtual ~BDirectory();
|
||||
virtual ~BDirectory();
|
||||
|
||||
status_t SetTo(const entry_ref *ref);
|
||||
status_t SetTo(const node_ref *nref);
|
||||
status_t SetTo(const BEntry *entry);
|
||||
status_t SetTo(const char *path);
|
||||
status_t SetTo(const BDirectory *dir, const char *path);
|
||||
status_t SetTo(const entry_ref *ref);
|
||||
status_t SetTo(const node_ref *nref);
|
||||
status_t SetTo(const BEntry *entry);
|
||||
status_t SetTo(const char *path);
|
||||
status_t SetTo(const BDirectory *dir, const char *path);
|
||||
|
||||
status_t GetEntry(BEntry *entry) const;
|
||||
status_t GetEntry(BEntry *entry) const;
|
||||
|
||||
bool IsRootDirectory() const;
|
||||
bool IsRootDirectory() const;
|
||||
|
||||
status_t FindEntry(const char *path, BEntry *entry,
|
||||
bool traverse = false) const;
|
||||
status_t FindEntry(const char *path, BEntry *entry,
|
||||
bool traverse = false) const;
|
||||
|
||||
bool Contains(const char *path, int32 nodeFlags = B_ANY_NODE) const;
|
||||
bool Contains(const BEntry *entry, int32 nodeFlags = B_ANY_NODE) const;
|
||||
bool Contains(const char *path, int32 nodeFlags = B_ANY_NODE) const;
|
||||
bool Contains(const BEntry *entry, int32 nodeFlags = B_ANY_NODE) const;
|
||||
|
||||
status_t GetStatFor(const char *path, struct stat *st) const;
|
||||
status_t GetStatFor(const char *path, struct stat *st) const;
|
||||
|
||||
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
|
||||
virtual status_t GetNextRef(entry_ref *ref);
|
||||
virtual int32 GetNextDirents(dirent *buf, size_t bufSize,
|
||||
int32 count = INT_MAX);
|
||||
virtual status_t Rewind();
|
||||
virtual int32 CountEntries();
|
||||
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
|
||||
virtual status_t GetNextRef(entry_ref *ref);
|
||||
virtual int32 GetNextDirents(dirent *buf, size_t bufSize,
|
||||
int32 count = INT_MAX);
|
||||
virtual status_t Rewind();
|
||||
virtual int32 CountEntries();
|
||||
|
||||
status_t CreateDirectory(const char *path, BDirectory *dir);
|
||||
status_t CreateFile(const char *path, BFile *file,
|
||||
bool failIfExists = false);
|
||||
status_t CreateSymLink(const char *path, const char *linkToPath,
|
||||
BSymLink *link);
|
||||
status_t CreateDirectory(const char *path, BDirectory *dir);
|
||||
status_t CreateFile(const char *path, BFile *file,
|
||||
bool failIfExists = false);
|
||||
status_t CreateSymLink(const char *path, const char *linkToPath,
|
||||
BSymLink *link);
|
||||
|
||||
BDirectory &operator=(const BDirectory &dir);
|
||||
BDirectory &operator=(const BDirectory &dir);
|
||||
|
||||
private:
|
||||
friend class BNode;
|
||||
private:
|
||||
friend class BNode;
|
||||
friend class BEntry;
|
||||
friend class BFile;
|
||||
|
||||
virtual void _ErectorDirectory1();
|
||||
virtual void _ErectorDirectory2();
|
||||
virtual void _ErectorDirectory3();
|
||||
virtual void _ErectorDirectory4();
|
||||
virtual void _ErectorDirectory5();
|
||||
virtual void _ErectorDirectory6();
|
||||
virtual void _ErectorDirectory1();
|
||||
virtual void _ErectorDirectory2();
|
||||
virtual void _ErectorDirectory3();
|
||||
virtual void _ErectorDirectory4();
|
||||
virtual void _ErectorDirectory5();
|
||||
virtual void _ErectorDirectory6();
|
||||
|
||||
private:
|
||||
virtual void close_fd();
|
||||
int get_fd() const;
|
||||
private:
|
||||
virtual void close_fd();
|
||||
int get_fd() const;
|
||||
|
||||
private:
|
||||
uint32 _reservedData[7];
|
||||
int fDirFd;
|
||||
|
||||
friend class BEntry;
|
||||
friend class BFile;
|
||||
private:
|
||||
uint32 _reservedData[7];
|
||||
int fDirFd;
|
||||
};
|
||||
|
||||
|
||||
// C functions
|
||||
|
||||
status_t create_directory(const char *path, mode_t mode);
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}; // namespace OpenBeOS
|
||||
#endif
|
||||
|
||||
#endif // _DIRECTORY_H
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user