diff --git a/headers/os/storage/Directory.h b/headers/os/storage/Directory.h index 4a89247d7c..e1494cefdc 100644 --- a/headers/os/storage/Directory.h +++ b/headers/os/storage/Directory.h @@ -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 #include #include -#include - -#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 Ingo Weinhold - \author Tyler Dauwalder - - \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 - - diff --git a/headers/os/storage/File.h b/headers/os/storage/File.h index 3512c4098d..8b3351ad76 100644 --- a/headers/os/storage/File.h +++ b/headers/os/storage/File.h @@ -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 #include -#include -#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 Ingo Weinhold - - \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 - - diff --git a/headers/os/storage/Statable.h b/headers/os/storage/Statable.h index d4642239e8..cf4e0c2604 100644 --- a/headers/os/storage/Statable.h +++ b/headers/os/storage/Statable.h @@ -1,85 +1,62 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file Statable.h - BStatable interface declaration. -*/ - +/* + * Copyright 2002-2006, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _STATABLE_H #define _STATABLE_H -#include -#include + #include -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif // USE_OPENBEOS_NAMESPACE - - struct node_ref; - class BVolume; +#include +#include + +struct node_ref; +class BVolume; - //! BStatable - A nice C++ wrapper to stat() - /*! A purly abstract class which provieds an expenive, but convenet - * C++ wrapper to the posix \sa stat() command. - * - * @see MIT - * @author Michael Lloyd Lee - * @author Be Inc - * @version 0 - */ class BStatable { -public: - virtual status_t GetStat(struct stat *st) const = 0; + public: + virtual status_t GetStat(struct stat *st) const = 0; - bool IsFile() const; - bool IsDirectory() const; - bool IsSymLink() const; + bool IsFile() const; + bool IsDirectory() const; + bool IsSymLink() const; - status_t GetNodeRef(node_ref *ref) const; + status_t GetNodeRef(node_ref *ref) const; - status_t GetOwner(uid_t *owner) const; - status_t SetOwner(uid_t owner); + status_t GetOwner(uid_t *owner) const; + status_t SetOwner(uid_t owner); - status_t GetGroup(gid_t *group) const; - status_t SetGroup(gid_t group); + status_t GetGroup(gid_t *group) const; + status_t SetGroup(gid_t group); - status_t GetPermissions(mode_t *perms) const; - status_t SetPermissions(mode_t perms); + status_t GetPermissions(mode_t *perms) const; + status_t SetPermissions(mode_t perms); - status_t GetSize(off_t *size) const; + status_t GetSize(off_t *size) const; - status_t GetModificationTime(time_t *mtime) const; - status_t SetModificationTime(time_t mtime); + status_t GetModificationTime(time_t *mtime) const; + status_t SetModificationTime(time_t mtime); - status_t GetCreationTime(time_t *ctime) const; - status_t SetCreationTime(time_t ctime); + status_t GetCreationTime(time_t *ctime) const; + status_t SetCreationTime(time_t ctime); - status_t GetAccessTime(time_t *atime) const; - status_t SetAccessTime(time_t atime); + status_t GetAccessTime(time_t *atime) const; + status_t SetAccessTime(time_t atime); - status_t GetVolume(BVolume *vol) const; + status_t GetVolume(BVolume *vol) const; - private: + private: + friend class BEntry; + friend class BNode; - friend class BEntry; - friend class BNode; + virtual void _OhSoStatable1(); + virtual void _OhSoStatable2(); + virtual void _OhSoStatable3(); + uint32 _reserved[4]; - virtual void _OhSoStatable1(); //< FBC - virtual void _OhSoStatable2(); //< FBC - virtual void _OhSoStatable3(); //< FBC - uint32 _ohSoData[4]; //< FBC - - virtual status_t set_stat(struct stat &st, uint32 what) = 0; + virtual status_t set_stat(struct stat &st, uint32 what) = 0; }; -#ifdef USE_OPENBEOS_NAMESPACE -} -#endif // USE_OPENBEOS_NAMESPACE - #endif // _STATABLE_H - - diff --git a/headers/os/storage/StorageDefs.Private.h b/headers/os/storage/StorageDefs.Private.h deleted file mode 100644 index 52c8cb240e..0000000000 --- a/headers/os/storage/StorageDefs.Private.h +++ /dev/null @@ -1,21 +0,0 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file StorageDefs.Private.h - Private Storage Kit declarations needed in public headers. -*/ - -#ifndef _DEF_STORAGE_PRIVATE_H -#define _DEF_STORAGE_PRIVATE_H - -namespace BPrivate { - namespace Storage { - typedef int FileDescriptor; - }; -}; - -#endif // _DEF_STORAGE_PRIVATE_H - - diff --git a/headers/os/storage/StorageDefs.h b/headers/os/storage/StorageDefs.h index f13ea794d7..512a10f2cc 100644 --- a/headers/os/storage/StorageDefs.h +++ b/headers/os/storage/StorageDefs.h @@ -1,22 +1,15 @@ -//---------------------------------------------------------------------- -// This software is part of the OpenBeOS distribution and is covered -// by the OpenBeOS license. -//--------------------------------------------------------------------- -/*! - \file StorageDefs.h - Miscellaneous Storage Kit definitions and includes. -*/ - +/* + * Copyright 2002-2006, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _DEF_STORAGE_H #define _DEF_STORAGE_H + #include #include #include -#ifdef USE_OPENBEOS_NAMESPACE -namespace OpenBeOS { -#endif // USE_OPENBEOS_NAMESPACE // Limits #define B_DEV_NAME_LENGTH 128 @@ -24,20 +17,18 @@ namespace OpenBeOS { #define B_PATH_NAME_LENGTH MAXPATHLEN #define B_ATTR_NAME_LENGTH (B_FILE_NAME_LENGTH-1) #define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15) -#define B_MAX_SYMLINKS SYMLINK_MAX - +#define B_MAX_SYMLINKS SYMLOOP_MAX // Open Modes -#define B_READ_ONLY O_RDONLY // read only -#define B_WRITE_ONLY O_WRONLY // write only -#define B_READ_WRITE O_RDWR // read and write +#define B_READ_ONLY O_RDONLY // read only +#define B_WRITE_ONLY O_WRONLY // write only +#define B_READ_WRITE O_RDWR // read and write #define B_FAIL_IF_EXISTS O_EXCL // exclusive create #define B_CREATE_FILE O_CREAT // create the file #define B_ERASE_FILE O_TRUNC // erase the file's data #define B_OPEN_AT_END O_APPEND // point to the end of the data - // Node Flavors enum node_flavor { B_FILE_NODE = 0x01, @@ -46,13 +37,4 @@ enum node_flavor { B_ANY_NODE = 0x07 }; - - -#ifdef USE_OPENBEOS_NAMESPACE -}; // namespace OpenBeOS -#endif // USE_OPENBEOS_NAMESPACE - - #endif // _DEF_STORAGE_H - - diff --git a/headers/posix/limits.h b/headers/posix/limits.h index 57b0fd28bb..509fbe69c5 100644 --- a/headers/posix/limits.h +++ b/headers/posix/limits.h @@ -41,7 +41,8 @@ #define SSIZE_MAX (2147483647L) #define TTY_NAME_MAX (256) #define TZNAME_MAX (32) -#define SYMLINKS_MAX (16) +#define SYMLINK_MAX (1024) +#define SYMLOOP_MAX (16) #define _POSIX_ARG_MAX (32768) #define _POSIX_CHILD_MAX (1024) diff --git a/headers/posix/sys/param.h b/headers/posix/sys/param.h index 5c12d88828..2be22447d2 100644 --- a/headers/posix/sys/param.h +++ b/headers/posix/sys/param.h @@ -7,7 +7,7 @@ #include #define MAXPATHLEN PATH_MAX -#define MAXSYMLINKS SYMLINKS_MAX +#define MAXSYMLINKS SYMLOOP_MAX #define NOFILE OPEN_MAX diff --git a/headers/posix/sys/stat.h b/headers/posix/sys/stat.h index 57902da9a4..478c3d78e3 100644 --- a/headers/posix/sys/stat.h +++ b/headers/posix/sys/stat.h @@ -1,11 +1,13 @@ +/* + * Copyright 2002-2006, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _SYS_STAT_H_ #define _SYS_STAT_H_ + #include -/* - * stat structure - */ struct stat { dev_t st_dev; /* "device" that this file resides on */ @@ -22,8 +24,10 @@ struct stat { time_t st_ctime; /* last change time, not creation time */ time_t st_crtime; /* creation time */ - // OpenBeOS extensions: - // ToDo: we might also define special types for files and TTYs + // Haiku extensions: + // TODO: we might also define special types for files and TTYs + // TODO: we should find another solution for this, as BStatable::GetStat() + // can only retrieve the R5 stat structure unsigned int st_type; /* attribute/index type */ }; @@ -53,13 +57,13 @@ struct stat { #define S_IFCHR 00000020000 /* character special */ #define S_IFIFO 00000010000 /* fifo */ -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISINDEX(m) (((m) & S_INDEX_DIR) == S_INDEX_DIR) +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#define S_ISINDEX(mode) (((mode) & S_INDEX_DIR) == S_INDEX_DIR) #define S_IUMSK 07777 /* user settable bits */ @@ -81,12 +85,10 @@ struct stat { #define S_IWOTH 00002 /* write permission: other */ #define S_IXOTH 00001 /* execute permission: other */ -/** @def ACCESSPERMS 00777 */ #define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) -/** @def ALLPERMS 07777 */ -#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) -/** @def DEFFILEMODE 00666 default file mode, everyone can read/write*/ -#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) +#define ALLPERMS (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO) +#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) + /* default file mode, everyone can read/write */ #ifdef __cplusplus extern "C" { @@ -102,7 +104,7 @@ extern int mkfifo(const char *path, mode_t mode); extern mode_t umask(mode_t cmask); // This achieves backwards compatibility with R5 -#if 0 +#ifdef HAIKU_TARGET_PLATFORM_HAIKU #define stat(fd, st) _stat(fd, st, sizeof(struct stat)) #define fstat(fd, st) _fstat(fd, st, sizeof(struct stat)) #define lstat(fd, st) _lstat(fd, st, sizeof(struct stat)) @@ -117,4 +119,4 @@ extern int lstat(const char *path, struct stat *st); } #endif -#endif /* _SYS_STAT_H_ */ +#endif /* _SYS_STAT_H_ */ diff --git a/headers/private/storage/storage_support.h b/headers/private/storage/storage_support.h index 631ff5467b..66acc83cf5 100644 --- a/headers/private/storage/storage_support.h +++ b/headers/private/storage/storage_support.h @@ -21,6 +21,10 @@ #include +// R5 compatibility +#define R5_STAT_SIZE 60 + + namespace BPrivate { namespace Storage { @@ -149,5 +153,3 @@ private: using BPrivate::Storage::FDCloser; #endif // _STORAGE_SUPPORT_H - - diff --git a/src/kits/storage/Entry.cpp b/src/kits/storage/Entry.cpp index eecf6200b9..3e74d0c19d 100644 --- a/src/kits/storage/Entry.cpp +++ b/src/kits/storage/Entry.cpp @@ -1,18 +1,18 @@ -//---------------------------------------------------------------------- -// This software is part of the Haiku distribution and is covered -// by the MIT license. -//--------------------------------------------------------------------- +/* + * Copyright 2002-2006, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder + * Ingo Weinhold, bonefish@users.sf.net + */ + + /*! \file Entry.cpp BEntry and entry_ref implementations. */ -#include -#include -#include -#include -#include - #include #include #include @@ -21,21 +21,17 @@ #include -#ifdef USE_OPENBEOS_NAMESPACE -using namespace OpenBeOS; -#endif +#include +#include +#include +#include +#include using namespace std; -// SYMLINK_MAX is needed by B_SYMLINK_MAX -// I don't know, why it isn't defined. -#ifndef SYMLINK_MAX -#define SYMLINK_MAX (16) -#endif -//---------------------------------------------------------------------------- -// struct entry_ref -//---------------------------------------------------------------------------- +// #pragma mark - struct entry_ref + /*! \struct entry_ref \brief A filesystem entry represented as a name in a concrete directory. @@ -184,9 +180,8 @@ entry_ref::operator=(const entry_ref &ref) */ -//---------------------------------------------------------------------------- -// BEntry -//---------------------------------------------------------------------------- +// #pragma mark - BEntry + /*! \class BEntry @@ -219,9 +214,10 @@ entry_ref::operator=(const entry_ref &ref) - operator=(const BEntry&) */ BEntry::BEntry() - : fDirFd(-1), - fName(NULL), - fCStatus(B_NO_INIT) + : + fDirFd(-1), + fName(NULL), + fCStatus(B_NO_INIT) { } @@ -322,9 +318,10 @@ BEntry::Exists() const { // just stat the beast struct stat st; - return (GetStat(&st) == B_OK); + return GetStat(&st) == B_OK; } + /*! \brief Fills in a stat structure for the entry. The information is copied into the \c stat structure pointed to by \a result. @@ -341,9 +338,11 @@ BEntry::GetStat(struct stat *result) const { if (fCStatus != B_OK) return B_NO_INIT; - return _kern_read_stat(fDirFd, fName, false, result, sizeof(struct stat)); + + return _kern_read_stat(fDirFd, fName, false, result, R5_STAT_SIZE); } + /*! \brief Reinitializes the BEntry to the path or directory path combination, resolving symlinks if traverse is true diff --git a/src/kits/storage/Node.cpp b/src/kits/storage/Node.cpp index 27e8535fe4..f222f4c914 100644 --- a/src/kits/storage/Node.cpp +++ b/src/kits/storage/Node.cpp @@ -1,34 +1,39 @@ -//---------------------------------------------------------------------- -// This software is part of the Haiku distribution and is covered -// by the MIT license. -//---------------------------------------------------------------------- +/* + * Copyright 2002-2006, Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Tyler Dauwalder + * Ingo Weinhold, bonefish@users.sf.net + */ + + /*! \file Node.cpp BNode implementation. */ -#include -#include -#include // for struct attr_info -#include -#include -#include +#include "storage_support.h" #include #include +#include #include #include #include #include -#include "storage_support.h" +#include +#include +#include +#include +#include + + +// #pragma mark - node_ref -//---------------------------------------------------------------------- -// node_ref -//---------------------------------------------------------------------- -// constructor /*! \brief Creates an uninitialized node_ref object. */ node_ref::node_ref() @@ -84,7 +89,7 @@ node_ref::operator=(const node_ref &ref) } -// #pragma mark - +// #pragma mark - BNode /*! \brief Creates an uninitialized BNode object @@ -196,7 +201,7 @@ BNode::GetStat(struct stat *st) const { return fCStatus != B_OK ? fCStatus - : _kern_read_stat(fFd, NULL, false, st, sizeof(struct stat)); + : _kern_read_stat(fFd, NULL, false, st, R5_STAT_SIZE); } diff --git a/src/system/libroot/posix/sys/stat.c b/src/system/libroot/posix/sys/stat.c index 821ad60452..434d43fda6 100644 --- a/src/system/libroot/posix/sys/stat.c +++ b/src/system/libroot/posix/sys/stat.c @@ -1,11 +1,12 @@ -/* -** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ +/* + * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#include + #include -#include #include @@ -18,7 +19,6 @@ // R5 compatibility - #define R5_STAT_SIZE 60 #undef stat #undef fstat