+ Changed StorageKit namespace to BPrivate::Storage
+ Changed Sniffer namespace to BPrivate::Storage::Sniffer git-svn-id: file:///srv/svn/repos/haiku/trunk/current@714 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -87,11 +87,11 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void close_fd();
|
virtual void close_fd();
|
||||||
StorageKit::FileDescriptor get_fd() const;
|
BPrivate::Storage::FileDescriptor get_fd() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 _reservedData[7];
|
uint32 _reservedData[7];
|
||||||
StorageKit::FileDescriptor fDirFd;
|
BPrivate::Storage::FileDescriptor fDirFd;
|
||||||
|
|
||||||
friend class BEntry;
|
friend class BEntry;
|
||||||
};
|
};
|
||||||
@@ -107,3 +107,5 @@ status_t create_directory(const char *path, mode_t mode);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _DIRECTORY_H
|
#endif // _DIRECTORY_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ private:
|
|||||||
/*! BEntry implementation of BStatable::set_stat() */
|
/*! BEntry implementation of BStatable::set_stat() */
|
||||||
virtual status_t set_stat(struct stat &st, uint32 what);
|
virtual status_t set_stat(struct stat &st, uint32 what);
|
||||||
|
|
||||||
status_t set(StorageKit::FileDescriptor dir, const char *path,
|
status_t set(BPrivate::Storage::FileDescriptor dir, const char *path,
|
||||||
bool traverse);
|
bool traverse);
|
||||||
|
|
||||||
/*! File descriptor for the entry's parent directory. */
|
/*! File descriptor for the entry's parent directory. */
|
||||||
StorageKit::FileDescriptor fDirFd;
|
BPrivate::Storage::FileDescriptor fDirFd;
|
||||||
|
|
||||||
/*! Leaf name of the entry. */
|
/*! Leaf name of the entry. */
|
||||||
char *fName;
|
char *fName;
|
||||||
@@ -118,3 +118,7 @@ bool operator<(const entry_ref &a, const entry_ref &b);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _ENTRY_H
|
#endif // _ENTRY_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,3 +58,5 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _ENTRY_LIST_H
|
#endif // _ENTRY_LIST_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ private:
|
|||||||
uint32 _reservedData[8];
|
uint32 _reservedData[8];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StorageKit::FileDescriptor get_fd() const;
|
BPrivate::Storage::FileDescriptor get_fd() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! The file's open mode.
|
//! The file's open mode.
|
||||||
@@ -83,3 +83,5 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _FILE_H
|
#endif // _FILE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -133,3 +133,5 @@ status_t find_directory(directory_which which, BPath *path,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _FIND_DIRECTORY_H
|
#endif // _FIND_DIRECTORY_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,3 +43,5 @@ enum icon_size {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _MIME_H
|
#endif // _MIME_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -191,3 +191,5 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
#endif // _MIME_TYPE_H
|
#endif // _MIME_TYPE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,14 +115,14 @@ private:
|
|||||||
uint32 rudeData[4];
|
uint32 rudeData[4];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t set_fd(StorageKit::FileDescriptor fd);
|
status_t set_fd(BPrivate::Storage::FileDescriptor fd);
|
||||||
virtual void close_fd();
|
virtual void close_fd();
|
||||||
void set_status(status_t newStatus);
|
void set_status(status_t newStatus);
|
||||||
|
|
||||||
virtual status_t set_stat(struct stat &st, uint32 what);
|
virtual status_t set_stat(struct stat &st, uint32 what);
|
||||||
|
|
||||||
StorageKit::FileDescriptor fFd;
|
BPrivate::Storage::FileDescriptor fFd;
|
||||||
StorageKit::FileDescriptor fAttrFd;
|
BPrivate::Storage::FileDescriptor fAttrFd;
|
||||||
status_t fCStatus;
|
status_t fCStatus;
|
||||||
|
|
||||||
status_t InitAttrDir();
|
status_t InitAttrDir();
|
||||||
@@ -135,3 +135,5 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _NODE_H
|
#endif // _NODE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,3 +87,5 @@ private:
|
|||||||
#endif // USE_OPENBEOS_NAMESPACE
|
#endif // USE_OPENBEOS_NAMESPACE
|
||||||
|
|
||||||
#endif // _NODE_INFO_H
|
#endif // _NODE_INFO_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -98,3 +98,5 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _PATH_H
|
#endif // _PATH_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,12 @@
|
|||||||
class BVolume;
|
class BVolume;
|
||||||
struct entry_ref;
|
struct entry_ref;
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
class QueryNode;
|
namespace Storage {
|
||||||
class QueryStack;
|
class QueryNode;
|
||||||
class QueryTree;
|
class QueryStack;
|
||||||
|
class QueryTree;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -97,7 +99,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool _HasFetched() const;
|
bool _HasFetched() const;
|
||||||
status_t _PushNode(StorageKit::QueryNode *node, bool deleteOnError);
|
status_t _PushNode(BPrivate::Storage::QueryNode *node, bool deleteOnError);
|
||||||
status_t _SetPredicate(const char *expression);
|
status_t _SetPredicate(const char *expression);
|
||||||
status_t _EvaluateStack();
|
status_t _EvaluateStack();
|
||||||
|
|
||||||
@@ -111,13 +113,15 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int32 _reservedData[4]; // FBC
|
int32 _reservedData[4]; // FBC
|
||||||
StorageKit::QueryStack *fStack;
|
BPrivate::Storage::QueryStack *fStack;
|
||||||
char *fPredicate;
|
char *fPredicate;
|
||||||
dev_t fDevice;
|
dev_t fDevice;
|
||||||
bool fLive;
|
bool fLive;
|
||||||
port_id fPort;
|
port_id fPort;
|
||||||
long fToken;
|
long fToken;
|
||||||
StorageKit::FileDescriptor fQueryFd;
|
BPrivate::Storage::FileDescriptor fQueryFd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _QUERY_H
|
#endif // _QUERY_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -88,3 +88,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // _RESOURCE_STRINGS_H
|
#endif // _RESOURCE_STRINGS_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,11 @@
|
|||||||
namespace OpenBeOS {
|
namespace OpenBeOS {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
class ResourcesContainer;
|
namespace Storage {
|
||||||
class ResourceFile;
|
class ResourcesContainer;
|
||||||
|
class ResourceFile;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -99,8 +101,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BFile fFile;
|
BFile fFile;
|
||||||
StorageKit::ResourcesContainer *fContainer;
|
BPrivate::Storage::ResourcesContainer *fContainer;
|
||||||
StorageKit::ResourceFile *fResourceFile;
|
BPrivate::Storage::ResourceFile *fResourceFile;
|
||||||
bool fReadOnly;
|
bool fReadOnly;
|
||||||
bool _pad[3];
|
bool _pad[3];
|
||||||
uint32 _reserved[3]; // FBC
|
uint32 _reserved[3]; // FBC
|
||||||
@@ -112,3 +114,5 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _RESOURCES_H
|
#endif // _RESOURCES_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,3 +81,5 @@ public:
|
|||||||
#endif // USE_OPENBEOS_NAMESPACE
|
#endif // USE_OPENBEOS_NAMESPACE
|
||||||
|
|
||||||
#endif // _STATABLE_H
|
#endif // _STATABLE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,12 @@
|
|||||||
#ifndef _DEF_STORAGE_PRIVATE_H
|
#ifndef _DEF_STORAGE_PRIVATE_H
|
||||||
#define _DEF_STORAGE_PRIVATE_H
|
#define _DEF_STORAGE_PRIVATE_H
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
typedef int FileDescriptor;
|
namespace Storage {
|
||||||
|
typedef int FileDescriptor;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DEF_STORAGE_PRIVATE_H
|
#endif // _DEF_STORAGE_PRIVATE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,3 +54,5 @@ enum node_flavor {
|
|||||||
|
|
||||||
|
|
||||||
#endif // _DEF_STORAGE_H
|
#endif // _DEF_STORAGE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
// SetTo() methods: Part of a work around until someone has an idea how to
|
// SetTo() methods: Part of a work around until someone has an idea how to
|
||||||
// get StorageKit::read_link(FileDescriptor,...) to work.
|
// get BPrivate::Storage::read_link(FileDescriptor,...) to work.
|
||||||
status_t SetTo(const entry_ref *ref);
|
status_t SetTo(const entry_ref *ref);
|
||||||
status_t SetTo(const BEntry *entry);
|
status_t SetTo(const BEntry *entry);
|
||||||
status_t SetTo(const char *path);
|
status_t SetTo(const char *path);
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
// operator=(): Part of a work around until someone has an idea how to
|
// operator=(): Part of a work around until someone has an idea how to
|
||||||
// get StorageKit::read_link(FileDescriptor,...) to work.
|
// get BPrivate::Storage::read_link(FileDescriptor,...) to work.
|
||||||
BSymLink &operator=(const BSymLink &link);
|
BSymLink &operator=(const BSymLink &link);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -70,13 +70,13 @@ private:
|
|||||||
|
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
// fSecretEntry: Part of a work around until someone has an idea how to
|
// fSecretEntry: Part of a work around until someone has an idea how to
|
||||||
// get StorageKit::read_link(FileDescriptor,...) to work.
|
// get BPrivate::Storage::read_link(FileDescriptor,...) to work.
|
||||||
// uint32 _reservedData[4];
|
// uint32 _reservedData[4];
|
||||||
uint32 _reservedData[3];
|
uint32 _reservedData[3];
|
||||||
BEntry *fSecretEntry;
|
BEntry *fSecretEntry;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StorageKit::FileDescriptor get_fd() const;
|
BPrivate::Storage::FileDescriptor get_fd() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_OPENBEOS_NAMESPACE
|
#ifdef USE_OPENBEOS_NAMESPACE
|
||||||
@@ -84,3 +84,5 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _SYM_LINK_H
|
#endif // _SYM_LINK_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,3 +105,5 @@ class BVolume {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _VOLUME_H
|
#endif // _VOLUME_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,3 +62,5 @@ class BVolumeRoster {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _VOLUME_ROSTER_H
|
#endif // _VOLUME_ROSTER_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -103,3 +103,5 @@ typedef struct {
|
|||||||
#define SHT_HIUSER 0xffffffff
|
#define SHT_HIUSER 0xffffffff
|
||||||
|
|
||||||
#endif // _ELF_H
|
#endif // _ELF_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
class Exception {
|
class Exception {
|
||||||
public:
|
public:
|
||||||
@@ -106,6 +107,9 @@ private:
|
|||||||
BString fDescription;
|
BString fDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _EXCEPTION_H
|
#endif // _EXCEPTION_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ extern status_t swap_data_adapter(type_code type, void *data, size_t length,
|
|||||||
extern bool is_type_swapped_adapter(type_code type);
|
extern bool is_type_swapped_adapter(type_code type);
|
||||||
|
|
||||||
#endif // _LIB_BE_ADAPTER_H
|
#endif // _LIB_BE_ADAPTER_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class OffsetFile
|
\class OffsetFile
|
||||||
@@ -58,6 +59,9 @@ private:
|
|||||||
off_t fCurrentPosition;
|
off_t fCurrentPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _OFFSET_FILE_H
|
#endif // _OFFSET_FILE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,3 +44,5 @@ struct PEFSectionHeader {
|
|||||||
const uint32 kPEFSectionHeaderSize = 28;
|
const uint32 kPEFSectionHeaderSize = 28;
|
||||||
|
|
||||||
#endif // _PEF_H
|
#endif // _PEF_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
#include <Query.h>
|
#include <Query.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// QueryNode
|
// QueryNode
|
||||||
class QueryNode {
|
class QueryNode {
|
||||||
@@ -201,6 +202,9 @@ private:
|
|||||||
BList fNodes;
|
BList fNodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _QUERY_PREDICATE_H
|
#endif // _QUERY_PREDICATE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
struct resource_info;
|
struct resource_info;
|
||||||
struct PEFContainerHeader;
|
struct PEFContainerHeader;
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
class Exception;
|
class Exception;
|
||||||
struct MemArea;
|
struct MemArea;
|
||||||
@@ -123,6 +124,9 @@ ResourceFile::_GetUInt32(uint32 value)
|
|||||||
return (fHostEndianess ? value : B_SWAP_INT32(value));
|
return (fHostEndianess ? value : B_SWAP_INT32(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _RESOURCE_FILE_H
|
#endif // _RESOURCE_FILE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ResourceItem
|
\class ResourceItem
|
||||||
@@ -82,6 +83,9 @@ private:
|
|||||||
bool fIsModified;
|
bool fIsModified;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _RESOURCE_ITEM_H
|
#endif // _RESOURCE_ITEM_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
class ResourceItem;
|
class ResourceItem;
|
||||||
|
|
||||||
@@ -70,6 +71,9 @@ private:
|
|||||||
bool fIsModified;
|
bool fIsModified;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _RESOURCES_CONTAINER_H
|
#endif // _RESOURCES_CONTAINER_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -103,3 +103,5 @@ const uint32 kResourceInfoTableEndSize = 8;
|
|||||||
|
|
||||||
|
|
||||||
#endif // _DEF_RESOURCES_H
|
#endif // _DEF_RESOURCES_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ typedef struct entry_ref;
|
|||||||
/*! Encompasses the functions used internally by the Storage Kit to
|
/*! Encompasses the functions used internally by the Storage Kit to
|
||||||
interface with the kernel, as well as various internal support functions,
|
interface with the kernel, as well as various internal support functions,
|
||||||
data types, and type aliases. */
|
data types, and type aliases. */
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// Type aliases
|
// Type aliases
|
||||||
typedef dirent DirEntry;
|
typedef dirent DirEntry;
|
||||||
@@ -63,7 +64,7 @@ status_t stat_dev(dev_t dev, fs_info* info);
|
|||||||
new file descriptor if successful, -1 otherwise. This version
|
new file descriptor if successful, -1 otherwise. This version
|
||||||
fails if the given file does not exist, or if you specify
|
fails if the given file does not exist, or if you specify
|
||||||
O_CREAT as one of the flags (use the four argument version
|
O_CREAT as one of the flags (use the four argument version
|
||||||
of StorageKit::open() if you wish to create the file when
|
of BPrivate::Storage::open() if you wish to create the file when
|
||||||
it doesn't already exist). */
|
it doesn't already exist). */
|
||||||
status_t open(const char *path, OpenFlags flags, FileDescriptor &result);
|
status_t open(const char *path, OpenFlags flags, FileDescriptor &result);
|
||||||
|
|
||||||
@@ -190,13 +191,13 @@ status_t rewind_dir(FileDescriptor dir);
|
|||||||
/*! Iterates through the given directory searching for an entry whose name
|
/*! Iterates through the given directory searching for an entry whose name
|
||||||
matches that given by name. On success, places the DirEntry in result
|
matches that given by name. On success, places the DirEntry in result
|
||||||
and returns B_OK. On failures, returns an error code and sets result to
|
and returns B_OK. On failures, returns an error code and sets result to
|
||||||
StorageKit::NullDir.
|
BPrivate::Storage::NullDir.
|
||||||
|
|
||||||
<b>Note:</b> This call modifies the internal position marker of dir. */
|
<b>Note:</b> This call modifies the internal position marker of dir. */
|
||||||
status_t find_dir(FileDescriptor dir, const char *name, DirEntry *result,
|
status_t find_dir(FileDescriptor dir, const char *name, DirEntry *result,
|
||||||
size_t length);
|
size_t length);
|
||||||
|
|
||||||
/*! Calls the other version of StorageKit::find_dir() and stores the results
|
/*! Calls the other version of BPrivate::Storage::find_dir() and stores the results
|
||||||
in the given entry_ref. */
|
in the given entry_ref. */
|
||||||
status_t find_dir(FileDescriptor dir, const char *name, entry_ref *result);
|
status_t find_dir(FileDescriptor dir, const char *name, entry_ref *result);
|
||||||
|
|
||||||
@@ -328,7 +329,9 @@ status_t rename(const char *oldPath, const char *newPath);
|
|||||||
/*! Removes path from the filesystem. */
|
/*! Removes path from the filesystem. */
|
||||||
status_t remove(const char *path);
|
status_t remove(const char *path);
|
||||||
|
|
||||||
|
}; // namespace Storage
|
||||||
} // namespace StorageKit
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _STORAGE_KIT_KERNEL_INTERFACE_H
|
#endif // _STORAGE_KIT_KERNEL_INTERFACE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
class BPositionIO;
|
class BPositionIO;
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
//! Abstract class defining methods acting on a list of ORed patterns
|
//! Abstract class defining methods acting on a list of ORed patterns
|
||||||
@@ -26,6 +28,10 @@ protected:
|
|||||||
bool fCaseInsensitive;
|
bool fCaseInsensitive;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_DISJ_LIST_H
|
#endif // _SNIFFER_DISJ_LIST_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
//! Exception class used by the MIME Sniffer
|
//! Exception class used by the MIME Sniffer
|
||||||
@@ -47,6 +49,10 @@ private:
|
|||||||
ssize_t fPos;
|
ssize_t fPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_ERR_H
|
#endif // _SNIFFER_ERR_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
class BString;
|
class BString;
|
||||||
|
|
||||||
//! MIME Sniffer related classes
|
//! MIME Sniffer related classes
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class Rule;
|
class Rule;
|
||||||
@@ -323,8 +325,12 @@ private:
|
|||||||
Err *fOutOfMemErr;
|
Err *fOutOfMemErr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Sniffer
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_PARSER_H
|
#endif // _SNIFFER_PARSER_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
class BPositionIO;
|
class BPositionIO;
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class Err;
|
class Err;
|
||||||
@@ -46,6 +48,10 @@ private:
|
|||||||
Err *fErrorMessage;
|
Err *fErrorMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_PATTERN_H
|
#endif // _SNIFFER_PATTERN_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
class BPositionIO;
|
class BPositionIO;
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class Err;
|
class Err;
|
||||||
@@ -38,6 +40,10 @@ private:
|
|||||||
Range fRange;
|
Range fRange;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_PATTERN_LIST_H
|
#endif // _SNIFFER_PATTERN_LIST_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
class BPositionIO;
|
class BPositionIO;
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class Err;
|
class Err;
|
||||||
@@ -33,6 +35,10 @@ private:
|
|||||||
Pattern *fPattern;
|
Pattern *fPattern;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_R_PATTERN_H
|
#endif // _SNIFFER_R_PATTERN_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
class BPositionIO;
|
class BPositionIO;
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class Err;
|
class Err;
|
||||||
@@ -34,6 +36,10 @@ private:
|
|||||||
std::vector<RPattern*> fList;
|
std::vector<RPattern*> fList;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_R_PATTERN_LIST_H
|
#endif // _SNIFFER_R_PATTERN_LIST_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class Err;
|
class Err;
|
||||||
@@ -33,6 +35,10 @@ private:
|
|||||||
status_t fCStatus;
|
status_t fCStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_RANGE_H
|
#endif // _SNIFFER_RANGE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
class BPositionIO;
|
class BPositionIO;
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
namespace Sniffer {
|
namespace Sniffer {
|
||||||
|
|
||||||
class DisjList;
|
class DisjList;
|
||||||
@@ -40,6 +42,10 @@ private:
|
|||||||
std::vector<DisjList*> *fConjList; // A list of DisjLists to be ANDed
|
std::vector<DisjList*> *fConjList; // A list of DisjLists to be ANDed
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}; // namespace Sniffer
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _SNIFFER_RULE_H
|
#endif // _SNIFFER_RULE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
#define _STORAGE_SUPPORT_H
|
#define _STORAGE_SUPPORT_H
|
||||||
|
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
//! Returns whether the supplied path is absolute.
|
//! Returns whether the supplied path is absolute.
|
||||||
bool is_absolute_path(const char *path);
|
bool is_absolute_path(const char *path);
|
||||||
@@ -37,6 +38,9 @@ status_t check_entry_name(const char *entry);
|
|||||||
//! Checks whether a path name is a valid path name.
|
//! Checks whether a path name is a valid path name.
|
||||||
status_t check_path_name(const char *path);
|
status_t check_path_name(const char *path);
|
||||||
|
|
||||||
} // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
#endif // _STORAGE_SUPPORT_H
|
#endif // _STORAGE_SUPPORT_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenBeOS {
|
|||||||
BDirectory::BDirectory()
|
BDirectory::BDirectory()
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ BDirectory::BDirectory()
|
|||||||
BDirectory::BDirectory(const BDirectory &dir)
|
BDirectory::BDirectory(const BDirectory &dir)
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
*this = dir;
|
*this = dir;
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ BDirectory::BDirectory(const BDirectory &dir)
|
|||||||
BDirectory::BDirectory(const entry_ref *ref)
|
BDirectory::BDirectory(const entry_ref *ref)
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
SetTo(ref);
|
SetTo(ref);
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ BDirectory::BDirectory(const entry_ref *ref)
|
|||||||
BDirectory::BDirectory(const node_ref *nref)
|
BDirectory::BDirectory(const node_ref *nref)
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
SetTo(nref);
|
SetTo(nref);
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ BDirectory::BDirectory(const node_ref *nref)
|
|||||||
BDirectory::BDirectory(const BEntry *entry)
|
BDirectory::BDirectory(const BEntry *entry)
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
SetTo(entry);
|
SetTo(entry);
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ BDirectory::BDirectory(const BEntry *entry)
|
|||||||
BDirectory::BDirectory(const char *path)
|
BDirectory::BDirectory(const char *path)
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
SetTo(path);
|
SetTo(path);
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ BDirectory::BDirectory(const char *path)
|
|||||||
BDirectory::BDirectory(const BDirectory *dir, const char *path)
|
BDirectory::BDirectory(const BDirectory *dir, const char *path)
|
||||||
: BNode(),
|
: BNode(),
|
||||||
BEntryList(),
|
BEntryList(),
|
||||||
fDirFd(StorageKit::NullFd)
|
fDirFd(BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
SetTo(dir, path);
|
SetTo(dir, path);
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ BDirectory::~BDirectory()
|
|||||||
- \c B_BUSY: A node was busy.
|
- \c B_BUSY: A node was busy.
|
||||||
- \c B_FILE_ERROR: A general file error.
|
- \c B_FILE_ERROR: A general file error.
|
||||||
- \c B_NO_MORE_FDS: The application has run out of file descriptors.
|
- \c B_NO_MORE_FDS: The application has run out of file descriptors.
|
||||||
\todo Currently implemented using StorageKit::entry_ref_to_path().
|
\todo Currently implemented using BPrivate::Storage::entry_ref_to_path().
|
||||||
Reimplement!
|
Reimplement!
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
@@ -149,7 +149,7 @@ BDirectory::SetTo(const entry_ref *ref)
|
|||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
error = StorageKit::entry_ref_to_path(ref, path,
|
error = BPrivate::Storage::entry_ref_to_path(ref, path,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
}
|
}
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
@@ -241,24 +241,24 @@ BDirectory::SetTo(const char *path)
|
|||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
status_t result = (path ? B_OK : B_BAD_VALUE);
|
status_t result = (path ? B_OK : B_BAD_VALUE);
|
||||||
StorageKit::FileDescriptor newDirFd = StorageKit::NullFd;
|
BPrivate::Storage::FileDescriptor newDirFd = BPrivate::Storage::NullFd;
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::open_dir(path, newDirFd);
|
result = BPrivate::Storage::open_dir(path, newDirFd);
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
// We have to take care that BNode doesn't stick to a symbolic link.
|
// We have to take care that BNode doesn't stick to a symbolic link.
|
||||||
// open_dir() does always traverse those. Therefore we open the FD for
|
// open_dir() does always traverse those. Therefore we open the FD for
|
||||||
// BNode (without the O_NOTRAVERSE flag).
|
// BNode (without the O_NOTRAVERSE flag).
|
||||||
StorageKit::FileDescriptor fd = StorageKit::NullFd;
|
BPrivate::Storage::FileDescriptor fd = BPrivate::Storage::NullFd;
|
||||||
result = StorageKit::open(path, O_RDWR, fd);
|
result = BPrivate::Storage::open(path, O_RDWR, fd);
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
result = set_fd(fd);
|
result = set_fd(fd);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
StorageKit::close(fd);
|
BPrivate::Storage::close(fd);
|
||||||
}
|
}
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
fDirFd = newDirFd;
|
fDirFd = newDirFd;
|
||||||
else
|
else
|
||||||
StorageKit::close_dir(newDirFd);
|
BPrivate::Storage::close_dir(newDirFd);
|
||||||
}
|
}
|
||||||
// finally set the BNode status
|
// finally set the BNode status
|
||||||
set_status(result);
|
set_status(result);
|
||||||
@@ -290,7 +290,7 @@ BDirectory::SetTo(const BDirectory *dir, const char *path)
|
|||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
status_t error = (dir && path ? B_OK : B_BAD_VALUE);
|
status_t error = (dir && path ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK && StorageKit::is_absolute_path(path))
|
if (error == B_OK && BPrivate::Storage::is_absolute_path(path))
|
||||||
error = B_BAD_VALUE;
|
error = B_BAD_VALUE;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
@@ -316,7 +316,7 @@ BDirectory::SetTo(const BDirectory *dir, const char *path)
|
|||||||
- \c B_BUSY: A node was busy.
|
- \c B_BUSY: A node was busy.
|
||||||
- \c B_FILE_ERROR: A general file error.
|
- \c B_FILE_ERROR: A general file error.
|
||||||
- \c B_NO_MORE_FDS: The application has run out of file descriptors.
|
- \c B_NO_MORE_FDS: The application has run out of file descriptors.
|
||||||
\todo Implemented using StorageKit::dir_to_self_entry_ref(). Check, if
|
\todo Implemented using BPrivate::Storage::dir_to_self_entry_ref(). Check, if
|
||||||
there is a better alternative.
|
there is a better alternative.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
@@ -329,7 +329,7 @@ BDirectory::GetEntry(BEntry *entry) const
|
|||||||
error = B_NO_INIT;
|
error = B_NO_INIT;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::dir_to_self_entry_ref(fDirFd, &ref);
|
error = BPrivate::Storage::dir_to_self_entry_ref(fDirFd, &ref);
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = entry->SetTo(&ref);
|
error = entry->SetTo(&ref);
|
||||||
return error;
|
return error;
|
||||||
@@ -431,7 +431,7 @@ BDirectory::Contains(const char *path, int32 nodeFlags) const
|
|||||||
bool result = true;
|
bool result = true;
|
||||||
if (path) {
|
if (path) {
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
if (InitCheck() == B_OK && !StorageKit::is_absolute_path(path))
|
if (InitCheck() == B_OK && !BPrivate::Storage::is_absolute_path(path))
|
||||||
entry.SetTo(this, path);
|
entry.SetTo(this, path);
|
||||||
else
|
else
|
||||||
entry.SetTo(path);
|
entry.SetTo(path);
|
||||||
@@ -490,13 +490,13 @@ BDirectory::Contains(const BEntry *entry, int32 nodeFlags) const
|
|||||||
if (result && InitCheck() == B_OK) {
|
if (result && InitCheck() == B_OK) {
|
||||||
char dirPath[B_PATH_NAME_LENGTH + 1];
|
char dirPath[B_PATH_NAME_LENGTH + 1];
|
||||||
char entryPath[B_PATH_NAME_LENGTH + 1];
|
char entryPath[B_PATH_NAME_LENGTH + 1];
|
||||||
result = (StorageKit::dir_to_path(fDirFd, dirPath,
|
result = (BPrivate::Storage::dir_to_path(fDirFd, dirPath,
|
||||||
B_PATH_NAME_LENGTH + 1) == B_OK);
|
B_PATH_NAME_LENGTH + 1) == B_OK);
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (result)
|
if (result)
|
||||||
result = (entry->GetRef(&ref) == B_OK);
|
result = (entry->GetRef(&ref) == B_OK);
|
||||||
if (result) {
|
if (result) {
|
||||||
result = (StorageKit::entry_ref_to_path(&ref, entryPath,
|
result = (BPrivate::Storage::entry_ref_to_path(&ref, entryPath,
|
||||||
B_PATH_NAME_LENGTH + 1)
|
B_PATH_NAME_LENGTH + 1)
|
||||||
== B_OK);
|
== B_OK);
|
||||||
}
|
}
|
||||||
@@ -606,10 +606,10 @@ BDirectory::GetNextRef(entry_ref *ref)
|
|||||||
if (error == B_OK && InitCheck() != B_OK)
|
if (error == B_OK && InitCheck() != B_OK)
|
||||||
error = B_FILE_ERROR;
|
error = B_FILE_ERROR;
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
StorageKit::LongDirEntry entry;
|
BPrivate::Storage::LongDirEntry entry;
|
||||||
bool next = true;
|
bool next = true;
|
||||||
while (error == B_OK && next) {
|
while (error == B_OK && next) {
|
||||||
if (StorageKit::read_dir(fDirFd, &entry, sizeof(entry), 1) != 1)
|
if (BPrivate::Storage::read_dir(fDirFd, &entry, sizeof(entry), 1) != 1)
|
||||||
error = B_ENTRY_NOT_FOUND;
|
error = B_ENTRY_NOT_FOUND;
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
next = (!strcmp(entry.d_name, ".")
|
next = (!strcmp(entry.d_name, ".")
|
||||||
@@ -650,7 +650,7 @@ BDirectory::GetNextDirents(dirent *buf, size_t bufSize, int32 count)
|
|||||||
if (result == B_OK && InitCheck() != B_OK)
|
if (result == B_OK && InitCheck() != B_OK)
|
||||||
result = B_FILE_ERROR;
|
result = B_FILE_ERROR;
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::read_dir(fDirFd, buf, bufSize, count);
|
result = BPrivate::Storage::read_dir(fDirFd, buf, bufSize, count);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,7 +673,7 @@ BDirectory::Rewind()
|
|||||||
if (error == B_OK && InitCheck() != B_OK)
|
if (error == B_OK && InitCheck() != B_OK)
|
||||||
error = B_FILE_ERROR;
|
error = B_FILE_ERROR;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::rewind_dir(fDirFd);
|
error = BPrivate::Storage::rewind_dir(fDirFd);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,9 +698,9 @@ BDirectory::CountEntries()
|
|||||||
status_t error = Rewind();
|
status_t error = Rewind();
|
||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
StorageKit::LongDirEntry entry;
|
BPrivate::Storage::LongDirEntry entry;
|
||||||
while (error == B_OK) {
|
while (error == B_OK) {
|
||||||
if (StorageKit::read_dir(fDirFd, &entry, sizeof(entry), 1) != 1)
|
if (BPrivate::Storage::read_dir(fDirFd, &entry, sizeof(entry), 1) != 1)
|
||||||
error = B_ENTRY_NOT_FOUND;
|
error = B_ENTRY_NOT_FOUND;
|
||||||
if (error == B_OK
|
if (error == B_OK
|
||||||
&& strcmp(entry.d_name, ".") && strcmp(entry.d_name, "..")) {
|
&& strcmp(entry.d_name, ".") && strcmp(entry.d_name, "..")) {
|
||||||
@@ -740,7 +740,7 @@ BDirectory::CreateDirectory(const char *path, BDirectory *dir)
|
|||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// get the actual (absolute) path using BEntry's help
|
// get the actual (absolute) path using BEntry's help
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
if (InitCheck() == B_OK && !StorageKit::is_absolute_path(path))
|
if (InitCheck() == B_OK && !BPrivate::Storage::is_absolute_path(path))
|
||||||
entry.SetTo(this, path);
|
entry.SetTo(this, path);
|
||||||
else
|
else
|
||||||
entry.SetTo(path);
|
entry.SetTo(path);
|
||||||
@@ -749,7 +749,7 @@ BDirectory::CreateDirectory(const char *path, BDirectory *dir)
|
|||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = entry.GetPath(&realPath);
|
error = entry.GetPath(&realPath);
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::create_dir(realPath.Path());
|
error = BPrivate::Storage::create_dir(realPath.Path());
|
||||||
if (error == B_OK && dir)
|
if (error == B_OK && dir)
|
||||||
error = dir->SetTo(realPath.Path());
|
error = dir->SetTo(realPath.Path());
|
||||||
}
|
}
|
||||||
@@ -793,7 +793,7 @@ BDirectory::CreateFile(const char *path, BFile *file, bool failIfExists)
|
|||||||
| (failIfExists ? B_FAIL_IF_EXISTS : 0);
|
| (failIfExists ? B_FAIL_IF_EXISTS : 0);
|
||||||
BFile tmpFile;
|
BFile tmpFile;
|
||||||
BFile *realFile = (file ? file : &tmpFile);
|
BFile *realFile = (file ? file : &tmpFile);
|
||||||
if (InitCheck() == B_OK && !StorageKit::is_absolute_path(path))
|
if (InitCheck() == B_OK && !BPrivate::Storage::is_absolute_path(path))
|
||||||
error = realFile->SetTo(this, path, openMode);
|
error = realFile->SetTo(this, path, openMode);
|
||||||
else
|
else
|
||||||
error = realFile->SetTo(path, openMode);
|
error = realFile->SetTo(path, openMode);
|
||||||
@@ -831,7 +831,7 @@ BDirectory::CreateSymLink(const char *path, const char *linkToPath,
|
|||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// get the actual (absolute) path using BEntry's help
|
// get the actual (absolute) path using BEntry's help
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
if (InitCheck() == B_OK && !StorageKit::is_absolute_path(path))
|
if (InitCheck() == B_OK && !BPrivate::Storage::is_absolute_path(path))
|
||||||
entry.SetTo(this, path);
|
entry.SetTo(this, path);
|
||||||
else
|
else
|
||||||
entry.SetTo(path);
|
entry.SetTo(path);
|
||||||
@@ -840,7 +840,7 @@ BDirectory::CreateSymLink(const char *path, const char *linkToPath,
|
|||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = entry.GetPath(&realPath);
|
error = entry.GetPath(&realPath);
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::create_link(realPath.Path(), linkToPath);
|
error = BPrivate::Storage::create_link(realPath.Path(), linkToPath);
|
||||||
if (error == B_OK && link)
|
if (error == B_OK && link)
|
||||||
error = link->SetTo(realPath.Path());
|
error = link->SetTo(realPath.Path());
|
||||||
}
|
}
|
||||||
@@ -863,7 +863,7 @@ BDirectory::operator=(const BDirectory &dir)
|
|||||||
*((BNode*)this) = dir;
|
*((BNode*)this) = dir;
|
||||||
if (InitCheck() == B_OK) {
|
if (InitCheck() == B_OK) {
|
||||||
// duplicate the file descriptor
|
// duplicate the file descriptor
|
||||||
status_t status = StorageKit::dup_dir(dir.fDirFd, fDirFd);
|
status_t status = BPrivate::Storage::dup_dir(dir.fDirFd, fDirFd);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
Unset();
|
Unset();
|
||||||
set_status(status);
|
set_status(status);
|
||||||
@@ -887,9 +887,9 @@ void BDirectory::_ReservedDirectory6() {}
|
|||||||
void
|
void
|
||||||
BDirectory::close_fd()
|
BDirectory::close_fd()
|
||||||
{
|
{
|
||||||
if (fDirFd != StorageKit::NullFd) {
|
if (fDirFd != BPrivate::Storage::NullFd) {
|
||||||
StorageKit::close_dir(fDirFd);
|
BPrivate::Storage::close_dir(fDirFd);
|
||||||
fDirFd = StorageKit::NullFd;
|
fDirFd = BPrivate::Storage::NullFd;
|
||||||
}
|
}
|
||||||
BNode::close_fd();
|
BNode::close_fd();
|
||||||
}
|
}
|
||||||
@@ -899,7 +899,7 @@ BDirectory::close_fd()
|
|||||||
directly.
|
directly.
|
||||||
\return the file descriptor, or -1, if not properly initialized.
|
\return the file descriptor, or -1, if not properly initialized.
|
||||||
*/
|
*/
|
||||||
StorageKit::FileDescriptor
|
BPrivate::Storage::FileDescriptor
|
||||||
BDirectory::get_fd() const
|
BDirectory::get_fd() const
|
||||||
{
|
{
|
||||||
return fDirFd;
|
return fDirFd;
|
||||||
@@ -943,7 +943,7 @@ create_directory(const char *path, mode_t mode)
|
|||||||
int32 nextComponent;
|
int32 nextComponent;
|
||||||
do {
|
do {
|
||||||
// get the next path component
|
// get the next path component
|
||||||
error = StorageKit::parse_first_path_component(path, component,
|
error = BPrivate::Storage::parse_first_path_component(path, component,
|
||||||
nextComponent);
|
nextComponent);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// append it to the BPath
|
// append it to the BPath
|
||||||
@@ -964,7 +964,7 @@ create_directory(const char *path, mode_t mode)
|
|||||||
if (!entry.IsDirectory()) // but is no directory
|
if (!entry.IsDirectory()) // but is no directory
|
||||||
error = B_NOT_A_DIRECTORY;
|
error = B_NOT_A_DIRECTORY;
|
||||||
} else // it doesn't exists -- create it
|
} else // it doesn't exists -- create it
|
||||||
error = StorageKit::create_dir(dirPath.Path(), mode);
|
error = BPrivate::Storage::create_dir(dirPath.Path(), mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (error == B_OK && nextComponent != 0);
|
} while (error == B_OK && nextComponent != 0);
|
||||||
@@ -976,3 +976,6 @@ create_directory(const char *path, mode_t mode)
|
|||||||
#ifdef USE_OPENBEOS_NAMESPACE
|
#ifdef USE_OPENBEOS_NAMESPACE
|
||||||
}; // namespace OpenBeOS
|
}; // namespace OpenBeOS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+48
-45
@@ -218,7 +218,7 @@ entry_ref::operator=(const entry_ref &ref)
|
|||||||
- operator=(const BEntry&)
|
- operator=(const BEntry&)
|
||||||
*/
|
*/
|
||||||
BEntry::BEntry()
|
BEntry::BEntry()
|
||||||
: fDirFd(StorageKit::NullFd),
|
: fDirFd(BPrivate::Storage::NullFd),
|
||||||
fName(NULL),
|
fName(NULL),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
@@ -235,7 +235,7 @@ BEntry::BEntry()
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
BEntry::BEntry(const BDirectory *dir, const char *path, bool traverse)
|
BEntry::BEntry(const BDirectory *dir, const char *path, bool traverse)
|
||||||
: fDirFd(StorageKit::NullFd),
|
: fDirFd(BPrivate::Storage::NullFd),
|
||||||
fName(NULL),
|
fName(NULL),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
@@ -253,7 +253,7 @@ BEntry::BEntry(const BDirectory *dir, const char *path, bool traverse)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BEntry::BEntry(const entry_ref *ref, bool traverse)
|
BEntry::BEntry(const entry_ref *ref, bool traverse)
|
||||||
: fDirFd(StorageKit::NullFd),
|
: fDirFd(BPrivate::Storage::NullFd),
|
||||||
fName(NULL),
|
fName(NULL),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
@@ -272,7 +272,7 @@ BEntry::BEntry(const entry_ref *ref, bool traverse)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
BEntry::BEntry(const char *path, bool traverse)
|
BEntry::BEntry(const char *path, bool traverse)
|
||||||
: fDirFd(StorageKit::NullFd),
|
: fDirFd(BPrivate::Storage::NullFd),
|
||||||
fName(NULL),
|
fName(NULL),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
@@ -284,7 +284,7 @@ BEntry::BEntry(const char *path, bool traverse)
|
|||||||
\see operator=(const BEntry&)
|
\see operator=(const BEntry&)
|
||||||
*/
|
*/
|
||||||
BEntry::BEntry(const BEntry &entry)
|
BEntry::BEntry(const BEntry &entry)
|
||||||
: fDirFd(StorageKit::NullFd),
|
: fDirFd(BPrivate::Storage::NullFd),
|
||||||
fName(NULL),
|
fName(NULL),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
@@ -323,8 +323,8 @@ BEntry::Exists() const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Attempt to find the entry in our current directory
|
// Attempt to find the entry in our current directory
|
||||||
StorageKit::LongDirEntry entry;
|
BPrivate::Storage::LongDirEntry entry;
|
||||||
return StorageKit::find_dir(fDirFd, fName, &entry, sizeof(entry)) == B_OK;
|
return BPrivate::Storage::find_dir(fDirFd, fName, &entry, sizeof(entry)) == B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Fills in a stat structure for the entry. The information is copied into
|
/*! \brief Fills in a stat structure for the entry. The information is copied into
|
||||||
@@ -349,7 +349,7 @@ BEntry::GetStat(struct stat *result) const
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
return StorageKit::get_stat(ref, result);
|
return BPrivate::Storage::get_stat(ref, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Reinitializes the BEntry to the path or directory path combination,
|
/*! \brief Reinitializes the BEntry to the path or directory path combination,
|
||||||
@@ -371,7 +371,7 @@ BEntry::SetTo(const BDirectory *dir, const char *path, bool traverse)
|
|||||||
return (fCStatus = B_BAD_VALUE);
|
return (fCStatus = B_BAD_VALUE);
|
||||||
|
|
||||||
fCStatus = B_OK;
|
fCStatus = B_OK;
|
||||||
if (StorageKit::is_absolute_path(path)) {
|
if (BPrivate::Storage::is_absolute_path(path)) {
|
||||||
SetTo(path, traverse);
|
SetTo(path, traverse);
|
||||||
} else {
|
} else {
|
||||||
if (dir->InitCheck() != B_OK)
|
if (dir->InitCheck() != B_OK)
|
||||||
@@ -379,7 +379,7 @@ BEntry::SetTo(const BDirectory *dir, const char *path, bool traverse)
|
|||||||
// get the dir's path
|
// get the dir's path
|
||||||
char rootPath[B_PATH_NAME_LENGTH + 1];
|
char rootPath[B_PATH_NAME_LENGTH + 1];
|
||||||
if (fCStatus == B_OK) {
|
if (fCStatus == B_OK) {
|
||||||
fCStatus = StorageKit::dir_to_path(dir->get_fd(), rootPath,
|
fCStatus = BPrivate::Storage::dir_to_path(dir->get_fd(), rootPath,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
}
|
}
|
||||||
// Concatenate our two path strings together
|
// Concatenate our two path strings together
|
||||||
@@ -418,7 +418,7 @@ BEntry::SetTo(const entry_ref *ref, bool traverse)
|
|||||||
|
|
||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
|
|
||||||
fCStatus = StorageKit::entry_ref_to_path(ref, path,
|
fCStatus = BPrivate::Storage::entry_ref_to_path(ref, path,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
return (fCStatus == B_OK) ? SetTo(path, traverse) : fCStatus ;
|
return (fCStatus == B_OK) ? SetTo(path, traverse) : fCStatus ;
|
||||||
}
|
}
|
||||||
@@ -438,20 +438,20 @@ BEntry::SetTo(const char *path, bool traverse)
|
|||||||
// check the argument
|
// check the argument
|
||||||
fCStatus = (path ? B_OK : B_BAD_VALUE);
|
fCStatus = (path ? B_OK : B_BAD_VALUE);
|
||||||
if (fCStatus == B_OK)
|
if (fCStatus == B_OK)
|
||||||
fCStatus = StorageKit::check_path_name(path);
|
fCStatus = BPrivate::Storage::check_path_name(path);
|
||||||
if (fCStatus == B_OK) {
|
if (fCStatus == B_OK) {
|
||||||
// Get the path and leaf portions of the given path
|
// Get the path and leaf portions of the given path
|
||||||
char *pathStr, *leafStr;
|
char *pathStr, *leafStr;
|
||||||
pathStr = leafStr = NULL;
|
pathStr = leafStr = NULL;
|
||||||
fCStatus = StorageKit::split_path(path, pathStr, leafStr);
|
fCStatus = BPrivate::Storage::split_path(path, pathStr, leafStr);
|
||||||
if (fCStatus == B_OK) {
|
if (fCStatus == B_OK) {
|
||||||
// Open the directory
|
// Open the directory
|
||||||
StorageKit::FileDescriptor dirFd;
|
BPrivate::Storage::FileDescriptor dirFd;
|
||||||
fCStatus = StorageKit::open_dir(pathStr, dirFd);
|
fCStatus = BPrivate::Storage::open_dir(pathStr, dirFd);
|
||||||
if (fCStatus == B_OK) {
|
if (fCStatus == B_OK) {
|
||||||
fCStatus = set(dirFd, leafStr, traverse);
|
fCStatus = set(dirFd, leafStr, traverse);
|
||||||
if (fCStatus != B_OK)
|
if (fCStatus != B_OK)
|
||||||
StorageKit::close_dir(dirFd);
|
BPrivate::Storage::close_dir(dirFd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete [] pathStr;
|
delete [] pathStr;
|
||||||
@@ -465,8 +465,8 @@ void
|
|||||||
BEntry::Unset()
|
BEntry::Unset()
|
||||||
{
|
{
|
||||||
// Close the directory
|
// Close the directory
|
||||||
if (fDirFd != StorageKit::NullFd) {
|
if (fDirFd != BPrivate::Storage::NullFd) {
|
||||||
StorageKit::close_dir(fDirFd);
|
BPrivate::Storage::close_dir(fDirFd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free our leaf name
|
// Free our leaf name
|
||||||
@@ -474,7 +474,7 @@ BEntry::Unset()
|
|||||||
delete [] fName;
|
delete [] fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
fDirFd = StorageKit::NullFd;
|
fDirFd = BPrivate::Storage::NullFd;
|
||||||
fName = NULL;
|
fName = NULL;
|
||||||
fCStatus = B_NO_INIT;
|
fCStatus = B_NO_INIT;
|
||||||
}
|
}
|
||||||
@@ -497,7 +497,7 @@ BEntry::GetRef(entry_ref *ref) const
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
status_t error = StorageKit::get_stat(fDirFd, &st);
|
status_t error = BPrivate::Storage::get_stat(fDirFd, &st);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
ref->device = st.st_dev;
|
ref->device = st.st_dev;
|
||||||
ref->directory = st.st_ino;
|
ref->directory = st.st_ino;
|
||||||
@@ -588,7 +588,7 @@ status_t BEntry::GetParent(BEntry *entry) const
|
|||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
|
|
||||||
// Verify we aren't an entry representing "/"
|
// Verify we aren't an entry representing "/"
|
||||||
status = StorageKit::entry_ref_is_root_dir(ref) ? B_ENTRY_NOT_FOUND
|
status = BPrivate::Storage::entry_ref_is_root_dir(ref) ? B_ENTRY_NOT_FOUND
|
||||||
: B_OK ;
|
: B_OK ;
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
|
|
||||||
@@ -635,7 +635,7 @@ BEntry::GetParent(BDirectory *dir) const
|
|||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
|
|
||||||
// Verify we aren't an entry representing "/"
|
// Verify we aren't an entry representing "/"
|
||||||
status = StorageKit::entry_ref_is_root_dir(ref) ? B_ENTRY_NOT_FOUND : B_OK ;
|
status = BPrivate::Storage::entry_ref_is_root_dir(ref) ? B_ENTRY_NOT_FOUND : B_OK ;
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
|
|
||||||
// Now point the entry_ref to the parent directory (instead of ourselves)
|
// Now point the entry_ref to the parent directory (instead of ourselves)
|
||||||
@@ -709,9 +709,9 @@ BEntry::Rename(const char *path, bool clobber)
|
|||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
// Convert the given path to an absolute path, if it isn't already.
|
// Convert the given path to an absolute path, if it isn't already.
|
||||||
char fullPath[B_PATH_NAME_LENGTH + 1];
|
char fullPath[B_PATH_NAME_LENGTH + 1];
|
||||||
if (!StorageKit::is_absolute_path(path)) {
|
if (!BPrivate::Storage::is_absolute_path(path)) {
|
||||||
// Convert our directory to an absolute pathname
|
// Convert our directory to an absolute pathname
|
||||||
status = StorageKit::dir_to_path(fDirFd, fullPath,
|
status = BPrivate::Storage::dir_to_path(fDirFd, fullPath,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
// Concatenate our pathname to it
|
// Concatenate our pathname to it
|
||||||
@@ -724,8 +724,8 @@ BEntry::Rename(const char *path, bool clobber)
|
|||||||
if (status == B_OK && !clobber) {
|
if (status == B_OK && !clobber) {
|
||||||
// We're not supposed to kill an already-existing file,
|
// We're not supposed to kill an already-existing file,
|
||||||
// so we'll try to figure out if it exists by stat()ing it.
|
// so we'll try to figure out if it exists by stat()ing it.
|
||||||
StorageKit::Stat s;
|
BPrivate::Storage::Stat s;
|
||||||
status = StorageKit::get_stat(path, &s);
|
status = BPrivate::Storage::get_stat(path, &s);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
status = B_FILE_EXISTS;
|
status = B_FILE_EXISTS;
|
||||||
else if (status == B_ENTRY_NOT_FOUND)
|
else if (status == B_ENTRY_NOT_FOUND)
|
||||||
@@ -736,7 +736,7 @@ BEntry::Rename(const char *path, bool clobber)
|
|||||||
BPath oldPath;
|
BPath oldPath;
|
||||||
status = GetPath(&oldPath);
|
status = GetPath(&oldPath);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
status = StorageKit::rename(oldPath.Path(), path);
|
status = BPrivate::Storage::rename(oldPath.Path(), path);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
status = SetTo(path, false);
|
status = SetTo(path, false);
|
||||||
}
|
}
|
||||||
@@ -779,10 +779,10 @@ BEntry::MoveTo(BDirectory *dir, const char *path = NULL, bool clobber)
|
|||||||
|
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
// Determine the absolute path of the target entry.
|
// Determine the absolute path of the target entry.
|
||||||
if (!StorageKit::is_absolute_path(path)) {
|
if (!BPrivate::Storage::is_absolute_path(path)) {
|
||||||
// Convert our directory to an absolute pathname
|
// Convert our directory to an absolute pathname
|
||||||
char fullPath[B_PATH_NAME_LENGTH + 1];
|
char fullPath[B_PATH_NAME_LENGTH + 1];
|
||||||
status = StorageKit::dir_to_path(dir->get_fd(), fullPath,
|
status = BPrivate::Storage::dir_to_path(dir->get_fd(), fullPath,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
// Concatenate our pathname to it
|
// Concatenate our pathname to it
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
@@ -822,7 +822,7 @@ BEntry::Remove()
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
return StorageKit::remove(path.Path());
|
return BPrivate::Storage::remove(path.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -885,7 +885,7 @@ BEntry::operator=(const BEntry &item)
|
|||||||
|
|
||||||
Unset();
|
Unset();
|
||||||
if (item.fCStatus == B_OK) {
|
if (item.fCStatus == B_OK) {
|
||||||
fCStatus = StorageKit::dup_dir(item.fDirFd, fDirFd);
|
fCStatus = BPrivate::Storage::dup_dir(item.fDirFd, fDirFd);
|
||||||
if (fCStatus == B_OK) {
|
if (fCStatus == B_OK) {
|
||||||
fCStatus = set_name(item.fName);
|
fCStatus = set_name(item.fName);
|
||||||
}
|
}
|
||||||
@@ -922,7 +922,7 @@ BEntry::set_stat(struct stat &st, uint32 what)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
return StorageKit::set_stat(path.Path(), st, what);
|
return BPrivate::Storage::set_stat(path.Path(), st, what);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Sets the Entry to point to the entry named by \c leaf in the given directory. If \c traverse
|
/*! Sets the Entry to point to the entry named by \c leaf in the given directory. If \c traverse
|
||||||
@@ -932,7 +932,7 @@ BEntry::set_stat(struct stat &st, uint32 what)
|
|||||||
\c leaf <b>must</b> be a leaf-name only (i.e. it must contain no '/' characters),
|
\c leaf <b>must</b> be a leaf-name only (i.e. it must contain no '/' characters),
|
||||||
otherwise this function will return \c B_BAD_VALUE. If \c B_OK is returned,
|
otherwise this function will return \c B_BAD_VALUE. If \c B_OK is returned,
|
||||||
the caller is no longer responsible for closing the directory file descriptor
|
the caller is no longer responsible for closing the directory file descriptor
|
||||||
with a call to StorageKit::close_dir.
|
with a call to BPrivate::Storage::close_dir.
|
||||||
|
|
||||||
\param dirFd File descriptor of the directory in which the entry resides
|
\param dirFd File descriptor of the directory in which the entry resides
|
||||||
\param leaf Pointer to a string containing the entry's leaf name
|
\param leaf Pointer to a string containing the entry's leaf name
|
||||||
@@ -944,16 +944,16 @@ BEntry::set_stat(struct stat &st, uint32 what)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
BEntry::set(StorageKit::FileDescriptor dirFd, const char *leaf, bool traverse)
|
BEntry::set(BPrivate::Storage::FileDescriptor dirFd, const char *leaf, bool traverse)
|
||||||
{
|
{
|
||||||
// Verify that path is valid
|
// Verify that path is valid
|
||||||
status_t error = StorageKit::check_entry_name(leaf);
|
status_t error = BPrivate::Storage::check_entry_name(leaf);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
// Check whether the entry is abstract or concrete.
|
// Check whether the entry is abstract or concrete.
|
||||||
// We try traversing concrete entries only.
|
// We try traversing concrete entries only.
|
||||||
StorageKit::LongDirEntry dirEntry;
|
BPrivate::Storage::LongDirEntry dirEntry;
|
||||||
bool isConcrete = (StorageKit::find_dir(dirFd, leaf, &dirEntry,
|
bool isConcrete = (BPrivate::Storage::find_dir(dirFd, leaf, &dirEntry,
|
||||||
sizeof(dirEntry)) == B_OK);
|
sizeof(dirEntry)) == B_OK);
|
||||||
if (traverse && isConcrete) {
|
if (traverse && isConcrete) {
|
||||||
// Though the link traversing strategy is iterative, we introduce
|
// Though the link traversing strategy is iterative, we introduce
|
||||||
@@ -964,10 +964,10 @@ BEntry::set(StorageKit::FileDescriptor dirFd, const char *leaf, bool traverse)
|
|||||||
|
|
||||||
// convert the dir FD into a BPath
|
// convert the dir FD into a BPath
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
error = StorageKit::dir_to_self_entry_ref(dirFd, &ref);
|
error = BPrivate::Storage::dir_to_self_entry_ref(dirFd, &ref);
|
||||||
char dirPathname[B_PATH_NAME_LENGTH + 1];
|
char dirPathname[B_PATH_NAME_LENGTH + 1];
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
error = StorageKit::entry_ref_to_path(&ref, dirPathname,
|
error = BPrivate::Storage::entry_ref_to_path(&ref, dirPathname,
|
||||||
sizeof(dirPathname));
|
sizeof(dirPathname));
|
||||||
}
|
}
|
||||||
BPath dirPath(dirPathname);
|
BPath dirPath(dirPathname);
|
||||||
@@ -1006,13 +1006,13 @@ BEntry::set(StorageKit::FileDescriptor dirFd, const char *leaf, bool traverse)
|
|||||||
if (isLink)
|
if (isLink)
|
||||||
error = B_LINK_LIMIT;
|
error = B_LINK_LIMIT;
|
||||||
else {
|
else {
|
||||||
StorageKit::FileDescriptor newDirFd = StorageKit::NullFd;
|
BPrivate::Storage::FileDescriptor newDirFd = BPrivate::Storage::NullFd;
|
||||||
error = StorageKit::open_dir(dirPath.Path(), newDirFd);
|
error = BPrivate::Storage::open_dir(dirPath.Path(), newDirFd);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// If we are successful, we are responsible for the
|
// If we are successful, we are responsible for the
|
||||||
// supplied FD. Thus we close it.
|
// supplied FD. Thus we close it.
|
||||||
StorageKit::close_dir(dirFd);
|
BPrivate::Storage::close_dir(dirFd);
|
||||||
dirFd = StorageKit::NullFd;
|
dirFd = BPrivate::Storage::NullFd;
|
||||||
fDirFd = newDirFd;
|
fDirFd = newDirFd;
|
||||||
// handle "/", which has a "" Leaf()
|
// handle "/", which has a "" Leaf()
|
||||||
if (linkPath == "/")
|
if (linkPath == "/")
|
||||||
@@ -1076,9 +1076,9 @@ BEntry::Dump(const char *name)
|
|||||||
|
|
||||||
printf("fCStatus == %ld\n", fCStatus);
|
printf("fCStatus == %ld\n", fCStatus);
|
||||||
|
|
||||||
StorageKit::LongDirEntry entry;
|
BPrivate::Storage::LongDirEntry entry;
|
||||||
if (fDirFd != -1
|
if (fDirFd != -1
|
||||||
&& StorageKit::find_dir(fDirFd, ".", &entry, sizeof(entry)) == B_OK) {
|
&& BPrivate::Storage::find_dir(fDirFd, ".", &entry, sizeof(entry)) == B_OK) {
|
||||||
printf("dir.device == %ld\n", entry.d_pdev);
|
printf("dir.device == %ld\n", entry.d_pdev);
|
||||||
printf("dir.inode == %lld\n", entry.d_pino);
|
printf("dir.inode == %lld\n", entry.d_pino);
|
||||||
} else {
|
} else {
|
||||||
@@ -1134,3 +1134,6 @@ operator<(const entry_ref & a, const entry_ref & b)
|
|||||||
&& strcmp(a.name, b.name) < 0))))));
|
&& strcmp(a.name, b.name) < 0))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,3 +105,6 @@ void BEntryList::_ReservedEntryList6() {}
|
|||||||
void BEntryList::_ReservedEntryList7() {}
|
void BEntryList::_ReservedEntryList7() {}
|
||||||
void BEntryList::_ReservedEntryList8() {}
|
void BEntryList::_ReservedEntryList8() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+20
-17
@@ -143,7 +143,7 @@ BFile::~BFile()
|
|||||||
- \c B_BUSY: A node was busy.
|
- \c B_BUSY: A node was busy.
|
||||||
- \c B_FILE_ERROR: A general file error.
|
- \c B_FILE_ERROR: A general file error.
|
||||||
- \c B_NO_MORE_FDS: The application has run out of file descriptors.
|
- \c B_NO_MORE_FDS: The application has run out of file descriptors.
|
||||||
\todo Currently implemented using StorageKit::entry_ref_to_path().
|
\todo Currently implemented using BPrivate::Storage::entry_ref_to_path().
|
||||||
Reimplement!
|
Reimplement!
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
@@ -153,7 +153,7 @@ BFile::SetTo(const entry_ref *ref, uint32 openMode)
|
|||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
error = StorageKit::entry_ref_to_path(ref, path,
|
error = BPrivate::Storage::entry_ref_to_path(ref, path,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
}
|
}
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
@@ -217,12 +217,12 @@ BFile::SetTo(const char *path, uint32 openMode)
|
|||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
status_t result = B_OK;
|
status_t result = B_OK;
|
||||||
StorageKit::FileDescriptor newFd = StorageKit::NullFd;
|
BPrivate::Storage::FileDescriptor newFd = BPrivate::Storage::NullFd;
|
||||||
if (path) {
|
if (path) {
|
||||||
// analyze openMode
|
// analyze openMode
|
||||||
// Well, it's a bit schizophrenic to convert the B_* style openMode
|
// Well, it's a bit schizophrenic to convert the B_* style openMode
|
||||||
// to POSIX style openFlags, but to use O_RWMASK to filter openMode.
|
// to POSIX style openFlags, but to use O_RWMASK to filter openMode.
|
||||||
StorageKit::OpenFlags openFlags;
|
BPrivate::Storage::OpenFlags openFlags;
|
||||||
switch (openMode & O_RWMASK) {
|
switch (openMode & O_RWMASK) {
|
||||||
case B_READ_ONLY:
|
case B_READ_ONLY:
|
||||||
openFlags = O_RDONLY;
|
openFlags = O_RDONLY;
|
||||||
@@ -246,10 +246,10 @@ BFile::SetTo(const char *path, uint32 openMode)
|
|||||||
openFlags |= O_CREAT;
|
openFlags |= O_CREAT;
|
||||||
if (openMode & B_FAIL_IF_EXISTS)
|
if (openMode & B_FAIL_IF_EXISTS)
|
||||||
openFlags |= O_EXCL;
|
openFlags |= O_EXCL;
|
||||||
result = StorageKit::open(path, openFlags, S_IREAD | S_IWRITE,
|
result = BPrivate::Storage::open(path, openFlags, S_IREAD | S_IWRITE,
|
||||||
newFd);
|
newFd);
|
||||||
} else
|
} else
|
||||||
result = StorageKit::open(path, openFlags, newFd);
|
result = BPrivate::Storage::open(path, openFlags, newFd);
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
fMode = openFlags;
|
fMode = openFlags;
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ BFile::SetTo(const char *path, uint32 openMode)
|
|||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
result = set_fd(newFd);
|
result = set_fd(newFd);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
StorageKit::close(newFd);
|
BPrivate::Storage::close(newFd);
|
||||||
}
|
}
|
||||||
// finally set the BNode status
|
// finally set the BNode status
|
||||||
set_status(result);
|
set_status(result);
|
||||||
@@ -342,7 +342,7 @@ BFile::Read(void *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
ssize_t result = InitCheck();
|
ssize_t result = InitCheck();
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::read(get_fd(), buffer, size);
|
result = BPrivate::Storage::read(get_fd(), buffer, size);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ BFile::ReadAt(off_t location, void *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
ssize_t result = InitCheck();
|
ssize_t result = InitCheck();
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::read(get_fd(), buffer, location, size);
|
result = BPrivate::Storage::read(get_fd(), buffer, location, size);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ BFile::Write(const void *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
ssize_t result = InitCheck();
|
ssize_t result = InitCheck();
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::write(get_fd(), buffer, size);
|
result = BPrivate::Storage::write(get_fd(), buffer, size);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ BFile::WriteAt(off_t location, const void *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
ssize_t result = InitCheck();
|
ssize_t result = InitCheck();
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::write(get_fd(), buffer, location, size);
|
result = BPrivate::Storage::write(get_fd(), buffer, location, size);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ BFile::Seek(off_t offset, uint32 seekMode)
|
|||||||
{
|
{
|
||||||
off_t result = (InitCheck() == B_OK ? B_OK : B_FILE_ERROR);
|
off_t result = (InitCheck() == B_OK ? B_OK : B_FILE_ERROR);
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::seek(get_fd(), offset, seekMode);
|
result = BPrivate::Storage::seek(get_fd(), offset, seekMode);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ BFile::Position() const
|
|||||||
{
|
{
|
||||||
off_t result = (InitCheck() == B_OK ? B_OK : B_FILE_ERROR);
|
off_t result = (InitCheck() == B_OK ? B_OK : B_FILE_ERROR);
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
result = StorageKit::get_position(get_fd());
|
result = BPrivate::Storage::get_position(get_fd());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,15 +481,15 @@ BFile::operator=(const BFile &file)
|
|||||||
Unset();
|
Unset();
|
||||||
if (file.InitCheck() == B_OK) {
|
if (file.InitCheck() == B_OK) {
|
||||||
// duplicate the file descriptor
|
// duplicate the file descriptor
|
||||||
StorageKit::FileDescriptor fd = -1;
|
BPrivate::Storage::FileDescriptor fd = -1;
|
||||||
status_t status = StorageKit::dup(file.get_fd(), fd);
|
status_t status = BPrivate::Storage::dup(file.get_fd(), fd);
|
||||||
// set it
|
// set it
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
status = set_fd(fd);
|
status = set_fd(fd);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
fMode = file.fMode;
|
fMode = file.fMode;
|
||||||
else
|
else
|
||||||
StorageKit::close(fd);
|
BPrivate::Storage::close(fd);
|
||||||
}
|
}
|
||||||
set_status(status);
|
set_status(status);
|
||||||
}
|
}
|
||||||
@@ -512,7 +512,7 @@ void BFile::_ReservedFile6() {}
|
|||||||
To be used instead of accessing the BNode's private \c fFd member directly.
|
To be used instead of accessing the BNode's private \c fFd member directly.
|
||||||
\return the file descriptor, or -1, if not properly initialized.
|
\return the file descriptor, or -1, if not properly initialized.
|
||||||
*/
|
*/
|
||||||
StorageKit::FileDescriptor
|
BPrivate::Storage::FileDescriptor
|
||||||
BFile::get_fd() const
|
BFile::get_fd() const
|
||||||
{
|
{
|
||||||
return fFd;
|
return fFd;
|
||||||
@@ -523,3 +523,6 @@ BFile::get_fd() const
|
|||||||
}; // namespace OpenBeOS
|
}; // namespace OpenBeOS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -306,3 +306,6 @@ find_directory(directory_which which, BPath *path, bool createIt,
|
|||||||
}; // namespace OpenBeOS
|
}; // namespace OpenBeOS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,3 +42,6 @@ is_type_swapped_adapter(type_code type)
|
|||||||
return is_type_swapped(type);
|
return is_type_swapped(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,3 +76,6 @@ get_device_icon(const char *dev, void *icon, int32 size)
|
|||||||
return NOT_IMPLEMENTED;
|
return NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1114,8 +1114,8 @@ BMimeType::SetSnifferRule(const char *rule)
|
|||||||
status_t
|
status_t
|
||||||
BMimeType::CheckSnifferRule(const char *rule, BString *parseError)
|
BMimeType::CheckSnifferRule(const char *rule, BString *parseError)
|
||||||
{
|
{
|
||||||
Sniffer::Rule snifferRule;
|
BPrivate::Storage::Sniffer::Rule snifferRule;
|
||||||
return Sniffer::parse(rule, &snifferRule, parseError);
|
return BPrivate::Storage::Sniffer::parse(rule, &snifferRule, parseError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GuessMimeType
|
// GuessMimeType
|
||||||
@@ -1249,3 +1249,6 @@ toLower(const char *str, char *result) {
|
|||||||
result[i] = 0;
|
result[i] = 0;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+46
-43
@@ -83,8 +83,8 @@ node_ref::operator=(const node_ref &ref)
|
|||||||
/*! \brief Creates an uninitialized BNode object
|
/*! \brief Creates an uninitialized BNode object
|
||||||
*/
|
*/
|
||||||
BNode::BNode()
|
BNode::BNode()
|
||||||
: fFd(StorageKit::NullFd),
|
: fFd(BPrivate::Storage::NullFd),
|
||||||
fAttrFd(StorageKit::NullFd),
|
fAttrFd(BPrivate::Storage::NullFd),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -94,8 +94,8 @@ BNode::BNode()
|
|||||||
\param ref the entry_ref referring to the entry
|
\param ref the entry_ref referring to the entry
|
||||||
*/
|
*/
|
||||||
BNode::BNode(const entry_ref *ref)
|
BNode::BNode(const entry_ref *ref)
|
||||||
: fFd(StorageKit::NullFd),
|
: fFd(BPrivate::Storage::NullFd),
|
||||||
fAttrFd(StorageKit::NullFd),
|
fAttrFd(BPrivate::Storage::NullFd),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(ref);
|
SetTo(ref);
|
||||||
@@ -106,8 +106,8 @@ BNode::BNode(const entry_ref *ref)
|
|||||||
\param entry the BEntry representing the entry
|
\param entry the BEntry representing the entry
|
||||||
*/
|
*/
|
||||||
BNode::BNode(const BEntry *entry)
|
BNode::BNode(const BEntry *entry)
|
||||||
: fFd(StorageKit::NullFd),
|
: fFd(BPrivate::Storage::NullFd),
|
||||||
fAttrFd(StorageKit::NullFd),
|
fAttrFd(BPrivate::Storage::NullFd),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(entry);
|
SetTo(entry);
|
||||||
@@ -118,8 +118,8 @@ BNode::BNode(const BEntry *entry)
|
|||||||
\param path the path referring to the entry
|
\param path the path referring to the entry
|
||||||
*/
|
*/
|
||||||
BNode::BNode(const char *path)
|
BNode::BNode(const char *path)
|
||||||
: fFd(StorageKit::NullFd),
|
: fFd(BPrivate::Storage::NullFd),
|
||||||
fAttrFd(StorageKit::NullFd),
|
fAttrFd(BPrivate::Storage::NullFd),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(path);
|
SetTo(path);
|
||||||
@@ -132,8 +132,8 @@ BNode::BNode(const char *path)
|
|||||||
\param path the entry's path name relative to \a dir
|
\param path the entry's path name relative to \a dir
|
||||||
*/
|
*/
|
||||||
BNode::BNode(const BDirectory *dir, const char *path)
|
BNode::BNode(const BDirectory *dir, const char *path)
|
||||||
: fFd(StorageKit::NullFd),
|
: fFd(BPrivate::Storage::NullFd),
|
||||||
fAttrFd(StorageKit::NullFd),
|
fAttrFd(BPrivate::Storage::NullFd),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(dir, path);
|
SetTo(dir, path);
|
||||||
@@ -143,8 +143,8 @@ BNode::BNode(const BDirectory *dir, const char *path)
|
|||||||
\param node the BNode to be copied
|
\param node the BNode to be copied
|
||||||
*/
|
*/
|
||||||
BNode::BNode(const BNode &node)
|
BNode::BNode(const BNode &node)
|
||||||
: fFd(StorageKit::NullFd),
|
: fFd(BPrivate::Storage::NullFd),
|
||||||
fAttrFd(StorageKit::NullFd),
|
fAttrFd(BPrivate::Storage::NullFd),
|
||||||
fCStatus(B_NO_INIT)
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
*this = node;
|
*this = node;
|
||||||
@@ -179,7 +179,7 @@ BNode::InitCheck() const
|
|||||||
status_t
|
status_t
|
||||||
BNode::GetStat(struct stat *st) const
|
BNode::GetStat(struct stat *st) const
|
||||||
{
|
{
|
||||||
return (fCStatus != B_OK) ? fCStatus : StorageKit::get_stat(fFd, st) ;
|
return (fCStatus != B_OK) ? fCStatus : BPrivate::Storage::get_stat(fFd, st) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Reinitializes the object to the specified entry_ref.
|
/*! \brief Reinitializes the object to the specified entry_ref.
|
||||||
@@ -189,7 +189,7 @@ BNode::GetStat(struct stat *st) const
|
|||||||
- \c B_BAD_VALUE: \c NULL \a ref.
|
- \c B_BAD_VALUE: \c NULL \a ref.
|
||||||
- \c B_ENTRY_NOT_FOUND: The entry could not be found.
|
- \c B_ENTRY_NOT_FOUND: The entry could not be found.
|
||||||
- \c B_BUSY: The entry is locked.
|
- \c B_BUSY: The entry is locked.
|
||||||
\todo Currently implemented using StorageKit::entry_ref_to_path().
|
\todo Currently implemented using BPrivate::Storage::entry_ref_to_path().
|
||||||
Reimplement!
|
Reimplement!
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
@@ -199,7 +199,7 @@ BNode::SetTo(const entry_ref *ref)
|
|||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
error = StorageKit::entry_ref_to_path(ref, path,
|
error = BPrivate::Storage::entry_ref_to_path(ref, path,
|
||||||
B_PATH_NAME_LENGTH + 1);
|
B_PATH_NAME_LENGTH + 1);
|
||||||
}
|
}
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
@@ -248,7 +248,7 @@ BNode::SetTo(const char *path)
|
|||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
fCStatus = StorageKit::open(path, O_RDWR | O_NOTRAVERSE, fFd);
|
fCStatus = BPrivate::Storage::open(path, O_RDWR | O_NOTRAVERSE, fFd);
|
||||||
return fCStatus;
|
return fCStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ BNode::SetTo(const BDirectory *dir, const char *path)
|
|||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
status_t error = (dir && path ? B_OK : B_BAD_VALUE);
|
status_t error = (dir && path ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK && StorageKit::is_absolute_path(path))
|
if (error == B_OK && BPrivate::Storage::is_absolute_path(path))
|
||||||
error = B_BAD_VALUE;
|
error = B_BAD_VALUE;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
@@ -308,8 +308,8 @@ BNode::Lock()
|
|||||||
|
|
||||||
// We'll need to keep lock around if the kernel function
|
// We'll need to keep lock around if the kernel function
|
||||||
// doesn't just work on file descriptors
|
// doesn't just work on file descriptors
|
||||||
// StorageKit::FileLock lock;
|
// BPrivate::Storage::FileLock lock;
|
||||||
// return StorageKit::lock(fFd, StorageKit::READ_WRITE, &lock);
|
// return BPrivate::Storage::lock(fFd, BPrivate::Storage::READ_WRITE, &lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Unlocks the node.
|
/*! \brief Unlocks the node.
|
||||||
@@ -336,7 +336,7 @@ BNode::Unlock()
|
|||||||
status_t
|
status_t
|
||||||
BNode::Sync()
|
BNode::Sync()
|
||||||
{
|
{
|
||||||
return (fCStatus != B_OK) ? B_FILE_ERROR : StorageKit::sync(fFd) ;
|
return (fCStatus != B_OK) ? B_FILE_ERROR : BPrivate::Storage::sync(fFd) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Writes data from a buffer to an attribute.
|
/*! \brief Writes data from a buffer to an attribute.
|
||||||
@@ -366,7 +366,7 @@ BNode::WriteAttr(const char *attr, type_code type, off_t offset,
|
|||||||
if (fCStatus != B_OK)
|
if (fCStatus != B_OK)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
else {
|
else {
|
||||||
ssize_t result = StorageKit::write_attr(fFd, attr, type, offset,
|
ssize_t result = BPrivate::Storage::write_attr(fFd, attr, type, offset,
|
||||||
buffer, len);
|
buffer, len);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ BNode::ReadAttr(const char *attr, type_code type, off_t offset,
|
|||||||
if (fCStatus != B_OK)
|
if (fCStatus != B_OK)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
else {
|
else {
|
||||||
ssize_t result = StorageKit::read_attr(fFd, attr, type, offset, buffer,
|
ssize_t result = BPrivate::Storage::read_attr(fFd, attr, type, offset, buffer,
|
||||||
len);
|
len);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ status_t
|
|||||||
BNode::RemoveAttr(const char *name)
|
BNode::RemoveAttr(const char *name)
|
||||||
{
|
{
|
||||||
return (fCStatus != B_OK) ? B_FILE_ERROR
|
return (fCStatus != B_OK) ? B_FILE_ERROR
|
||||||
: StorageKit::remove_attr(fFd, name);
|
: BPrivate::Storage::remove_attr(fFd, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Moves the attribute given by \a oldname to \a newname.
|
/*! \brief Moves the attribute given by \a oldname to \a newname.
|
||||||
@@ -433,7 +433,7 @@ BNode::RenameAttr(const char *oldname, const char *newname)
|
|||||||
{
|
{
|
||||||
if (fCStatus != B_OK)
|
if (fCStatus != B_OK)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
return StorageKit::rename_attr(fFd, oldname, newname);
|
return BPrivate::Storage::rename_attr(fFd, oldname, newname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ status_t
|
|||||||
BNode::GetAttrInfo(const char *name, struct attr_info *info) const
|
BNode::GetAttrInfo(const char *name, struct attr_info *info) const
|
||||||
{
|
{
|
||||||
return (fCStatus != B_OK) ? B_FILE_ERROR
|
return (fCStatus != B_OK) ? B_FILE_ERROR
|
||||||
: StorageKit::stat_attr(fFd, name, info);
|
: BPrivate::Storage::stat_attr(fFd, name, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Returns the next attribute in the node's list of attributes.
|
/*! \brief Returns the next attribute in the node's list of attributes.
|
||||||
@@ -482,8 +482,8 @@ BNode::GetNextAttrName(char *buffer)
|
|||||||
if (InitAttrDir() != B_OK)
|
if (InitAttrDir() != B_OK)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
|
|
||||||
StorageKit::LongDirEntry entry;
|
BPrivate::Storage::LongDirEntry entry;
|
||||||
status_t error = StorageKit::read_attr_dir(fAttrFd, entry);
|
status_t error = BPrivate::Storage::read_attr_dir(fAttrFd, entry);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
strncpy(buffer, entry.d_name, B_ATTR_NAME_LENGTH);
|
strncpy(buffer, entry.d_name, B_ATTR_NAME_LENGTH);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -502,7 +502,7 @@ BNode::RewindAttrs()
|
|||||||
{
|
{
|
||||||
if (InitAttrDir() != B_OK)
|
if (InitAttrDir() != B_OK)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
StorageKit::rewind_attr_dir(fAttrFd);
|
BPrivate::Storage::rewind_attr_dir(fAttrFd);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,8 +587,8 @@ BNode::operator=(const BNode &node)
|
|||||||
Unset();
|
Unset();
|
||||||
// We have to manually dup the node, because R5::BNode::Dup()
|
// We have to manually dup the node, because R5::BNode::Dup()
|
||||||
// is not declared to be const (which IMO is retarded).
|
// is not declared to be const (which IMO is retarded).
|
||||||
fFd = StorageKit::dup(node.fFd);
|
fFd = BPrivate::Storage::dup(node.fFd);
|
||||||
fCStatus = (fFd == StorageKit::NullFd) ? B_NO_INIT : B_OK ;
|
fCStatus = (fFd == BPrivate::Storage::NullFd) ? B_NO_INIT : B_OK ;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ BNode::operator==(const BNode &node) const
|
|||||||
return true;
|
return true;
|
||||||
if (fCStatus == B_OK && node.InitCheck() == B_OK) {
|
if (fCStatus == B_OK && node.InitCheck() == B_OK) {
|
||||||
// Check if they're identical
|
// Check if they're identical
|
||||||
StorageKit::Stat s1, s2;
|
BPrivate::Storage::Stat s1, s2;
|
||||||
if (GetStat(&s1) != B_OK)
|
if (GetStat(&s1) != B_OK)
|
||||||
return false;
|
return false;
|
||||||
if (node.GetStat(&s2) != B_OK)
|
if (node.GetStat(&s2) != B_OK)
|
||||||
@@ -635,7 +635,7 @@ BNode::operator!=(const BNode &node) const
|
|||||||
int
|
int
|
||||||
BNode::Dup()
|
BNode::Dup()
|
||||||
{
|
{
|
||||||
return StorageKit::dup(fFd);
|
return BPrivate::Storage::dup(fFd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ void BNode::_ReservedNode6() { }
|
|||||||
thereafter.
|
thereafter.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
BNode::set_fd(StorageKit::FileDescriptor fd)
|
BNode::set_fd(BPrivate::Storage::FileDescriptor fd)
|
||||||
{
|
{
|
||||||
if (fFd != -1)
|
if (fFd != -1)
|
||||||
close_fd();
|
close_fd();
|
||||||
@@ -670,20 +670,20 @@ BNode::set_fd(StorageKit::FileDescriptor fd)
|
|||||||
/*! \brief Closes the node's file descriptor(s).
|
/*! \brief Closes the node's file descriptor(s).
|
||||||
To be implemented by subclasses to close the file descriptor using the
|
To be implemented by subclasses to close the file descriptor using the
|
||||||
proper system call for the given file-type. This implementation calls
|
proper system call for the given file-type. This implementation calls
|
||||||
StorageKit::close(fFd) and also StorageKit::close_attr_dir(fAttrDir)
|
BPrivate::Storage::close(fFd) and also BPrivate::Storage::close_attr_dir(fAttrDir)
|
||||||
if necessary.
|
if necessary.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
BNode::close_fd()
|
BNode::close_fd()
|
||||||
{
|
{
|
||||||
if (fAttrFd != StorageKit::NullFd)
|
if (fAttrFd != BPrivate::Storage::NullFd)
|
||||||
{
|
{
|
||||||
StorageKit::close_attr_dir(fAttrFd);
|
BPrivate::Storage::close_attr_dir(fAttrFd);
|
||||||
fAttrFd = StorageKit::NullFd;
|
fAttrFd = BPrivate::Storage::NullFd;
|
||||||
}
|
}
|
||||||
if (fFd != StorageKit::NullFd) {
|
if (fFd != BPrivate::Storage::NullFd) {
|
||||||
close(fFd);
|
close(fFd);
|
||||||
fFd = StorageKit::NullFd;
|
fFd = BPrivate::Storage::NullFd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +711,7 @@ BNode::set_stat(struct stat &st, uint32 what)
|
|||||||
{
|
{
|
||||||
if (fCStatus != B_OK)
|
if (fCStatus != B_OK)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
return StorageKit::set_stat(fFd, st, what);
|
return BPrivate::Storage::set_stat(fFd, st, what);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Verifies that the BNode has been properly initialized, and then
|
/*! \brief Verifies that the BNode has been properly initialized, and then
|
||||||
@@ -722,8 +722,8 @@ BNode::set_stat(struct stat &st, uint32 what)
|
|||||||
status_t
|
status_t
|
||||||
BNode::InitAttrDir()
|
BNode::InitAttrDir()
|
||||||
{
|
{
|
||||||
if (fCStatus == B_OK && fAttrFd == StorageKit::NullFd)
|
if (fCStatus == B_OK && fAttrFd == BPrivate::Storage::NullFd)
|
||||||
return StorageKit::open_attr_dir(fFd, fAttrFd);
|
return BPrivate::Storage::open_attr_dir(fFd, fAttrFd);
|
||||||
return fCStatus;
|
return fCStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,7 +733,7 @@ BNode::InitAttrDir()
|
|||||||
|
|
||||||
/*! \var BNode::fAttrFd
|
/*! \var BNode::fAttrFd
|
||||||
This appears to be passed to the attribute directory functions
|
This appears to be passed to the attribute directory functions
|
||||||
like a StorageKit::Dir would be, but it's actually a file descriptor.
|
like a BPrivate::Storage::Dir would be, but it's actually a file descriptor.
|
||||||
Best I can figure, the R5 syscall for reading attributes must've
|
Best I can figure, the R5 syscall for reading attributes must've
|
||||||
just taken a file descriptor. Depending on what our kernel ends up
|
just taken a file descriptor. Depending on what our kernel ends up
|
||||||
providing, this may or may not be replaced with an Dir*
|
providing, this may or may not be replaced with an Dir*
|
||||||
@@ -742,3 +742,6 @@ BNode::InitAttrDir()
|
|||||||
/*! \var BNode::fCStatus
|
/*! \var BNode::fCStatus
|
||||||
The object's initialization status.
|
The object's initialization status.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -505,3 +505,6 @@ BNodeInfo::BNodeInfo(const BNodeInfo &)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
#include "OffsetFile.h"
|
#include "OffsetFile.h"
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
OffsetFile::OffsetFile()
|
OffsetFile::OffsetFile()
|
||||||
@@ -166,6 +167,9 @@ OffsetFile::Offset() const
|
|||||||
return fOffset;
|
return fOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}; // namespace StorageKit
|
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ BPath::SetTo(const entry_ref *ref)
|
|||||||
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
status_t error = (ref ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
error = StorageKit::entry_ref_to_path(ref, path, sizeof(path));
|
error = BPrivate::Storage::entry_ref_to_path(ref, path, sizeof(path));
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = set_path(path); // the path is already normalized
|
error = set_path(path); // the path is already normalized
|
||||||
}
|
}
|
||||||
@@ -173,12 +173,12 @@ status_t
|
|||||||
BPath::SetTo(const char *path, const char *leaf, bool normalize)
|
BPath::SetTo(const char *path, const char *leaf, bool normalize)
|
||||||
{
|
{
|
||||||
status_t error = (path ? B_OK : B_BAD_VALUE);
|
status_t error = (path ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK && leaf && StorageKit::is_absolute_path(leaf))
|
if (error == B_OK && leaf && BPrivate::Storage::is_absolute_path(leaf))
|
||||||
error = B_BAD_VALUE;
|
error = B_BAD_VALUE;
|
||||||
char newPath[B_PATH_NAME_LENGTH + 1];
|
char newPath[B_PATH_NAME_LENGTH + 1];
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
// we always normalize relative paths
|
// we always normalize relative paths
|
||||||
normalize |= !StorageKit::is_absolute_path(path);
|
normalize |= !BPrivate::Storage::is_absolute_path(path);
|
||||||
// build a new path from path and leaf
|
// build a new path from path and leaf
|
||||||
// copy path first
|
// copy path first
|
||||||
uint32 pathLen = strlen(path);
|
uint32 pathLen = strlen(path);
|
||||||
@@ -213,7 +213,7 @@ BPath::SetTo(const char *path, const char *leaf, bool normalize)
|
|||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
if (normalize) {
|
if (normalize) {
|
||||||
char normalizedPath[B_PATH_NAME_LENGTH + 1];
|
char normalizedPath[B_PATH_NAME_LENGTH + 1];
|
||||||
error = StorageKit::get_canonical_path(newPath, normalizedPath,
|
error = BPrivate::Storage::get_canonical_path(newPath, normalizedPath,
|
||||||
sizeof(normalizedPath));
|
sizeof(normalizedPath));
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = set_path(normalizedPath);
|
error = set_path(normalizedPath);
|
||||||
@@ -714,3 +714,6 @@ BPath::MustNormalize(const char *path)
|
|||||||
\var status_t BPath::fCStatus
|
\var status_t BPath::fCStatus
|
||||||
\brief The object's initialization status.
|
\brief The object's initialization status.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
#include "kernel_interface.h"
|
#include "kernel_interface.h"
|
||||||
#include "QueryPredicate.h"
|
#include "QueryPredicate.h"
|
||||||
|
|
||||||
using namespace StorageKit;
|
using namespace BPrivate::Storage;
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NOT_IMPLEMENTED = B_ERROR,
|
NOT_IMPLEMENTED = B_ERROR,
|
||||||
@@ -598,8 +599,8 @@ BQuery::GetNextRef(entry_ref *ref)
|
|||||||
if (error == B_OK && !_HasFetched())
|
if (error == B_OK && !_HasFetched())
|
||||||
error = B_FILE_ERROR;
|
error = B_FILE_ERROR;
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
StorageKit::LongDirEntry entry;
|
BPrivate::Storage::LongDirEntry entry;
|
||||||
if (StorageKit::read_query(fQueryFd, &entry, sizeof(entry), 1) != 1)
|
if (BPrivate::Storage::read_query(fQueryFd, &entry, sizeof(entry), 1) != 1)
|
||||||
error = B_ENTRY_NOT_FOUND;
|
error = B_ENTRY_NOT_FOUND;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
*ref = entry_ref(entry.d_pdev, entry.d_pino, entry.d_name);
|
*ref = entry_ref(entry.d_pdev, entry.d_pino, entry.d_name);
|
||||||
@@ -770,3 +771,6 @@ void BQuery::_ReservedQuery3() {}
|
|||||||
void BQuery::_ReservedQuery4() {}
|
void BQuery::_ReservedQuery4() {}
|
||||||
void BQuery::_ReservedQuery5() {}
|
void BQuery::_ReservedQuery5() {}
|
||||||
void BQuery::_ReservedQuery6() {}
|
void BQuery::_ReservedQuery6() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// QueryNode
|
// QueryNode
|
||||||
|
|
||||||
@@ -482,4 +483,8 @@ QueryStack::_GetSubTree(QueryNode *&rootNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
#include "ResourcesDefs.h"
|
#include "ResourcesDefs.h"
|
||||||
//#include "Warnings.h"
|
//#include "Warnings.h"
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// ELF defs
|
// ELF defs
|
||||||
static const uint32 kMaxELFHeaderSize = sizeof(Elf32_Ehdr) + 32;
|
static const uint32 kMaxELFHeaderSize = sizeof(Elf32_Ehdr) + 32;
|
||||||
@@ -1232,5 +1233,9 @@ ResourceFile::_MakeEmptyResourceFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ResourceItem::ResourceItem()
|
ResourceItem::ResourceItem()
|
||||||
@@ -187,5 +188,9 @@ ResourceItem::IsModified() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ BResourceStrings::SetStringFile(const entry_ref *ref)
|
|||||||
fFileRef = *ref;
|
fFileRef = *ref;
|
||||||
} else {
|
} else {
|
||||||
char appPath[B_PATH_NAME_LENGTH + 1];
|
char appPath[B_PATH_NAME_LENGTH + 1];
|
||||||
error = StorageKit::get_app_path(appPath);
|
error = BPrivate::Storage::get_app_path(appPath);
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = get_ref_for_path(appPath, &fileRef);
|
error = get_ref_for_path(appPath, &fileRef);
|
||||||
}
|
}
|
||||||
@@ -400,3 +400,6 @@ BResourceStrings::_string_id_hash::assign_string(const char *str,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "ResourceItem.h"
|
#include "ResourceItem.h"
|
||||||
#include "ResourcesContainer.h"
|
#include "ResourcesContainer.h"
|
||||||
|
|
||||||
using namespace StorageKit;
|
using namespace BPrivate::Storage;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NOT_IMPLEMENTED = B_ERROR,
|
NOT_IMPLEMENTED = B_ERROR,
|
||||||
@@ -846,3 +846,6 @@ void BResources::_ReservedResources6() {}
|
|||||||
void BResources::_ReservedResources7() {}
|
void BResources::_ReservedResources7() {}
|
||||||
void BResources::_ReservedResources8() {}
|
void BResources::_ReservedResources8() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#include "ResourceItem.h"
|
#include "ResourceItem.h"
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ResourcesContainer::ResourcesContainer()
|
ResourcesContainer::ResourcesContainer()
|
||||||
@@ -207,5 +208,9 @@ ResourcesContainer::IsModified() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -322,3 +322,6 @@ BStatable::GetVolume(BVolume *vol) const
|
|||||||
void BStatable::_OhSoStatable1() {}
|
void BStatable::_OhSoStatable1() {}
|
||||||
void BStatable::_OhSoStatable2() {}
|
void BStatable::_OhSoStatable2() {}
|
||||||
void BStatable::_OhSoStatable3() {}
|
void BStatable::_OhSoStatable3() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ BSymLink::ReadLink(char *buf, size_t size)
|
|||||||
if (error == B_OK && InitCheck() != B_OK)
|
if (error == B_OK && InitCheck() != B_OK)
|
||||||
error = B_FILE_ERROR;
|
error = B_FILE_ERROR;
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::read_link(get_fd(), buf, size);
|
error = BPrivate::Storage::read_link(get_fd(), buf, size);
|
||||||
return error;
|
return error;
|
||||||
*/
|
*/
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
@@ -207,9 +207,9 @@ BSymLink::ReadLink(char *buf, size_t size)
|
|||||||
error = fSecretEntry->GetRef(&ref);
|
error = fSecretEntry->GetRef(&ref);
|
||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::entry_ref_to_path(&ref, path, sizeof(path));
|
error = BPrivate::Storage::entry_ref_to_path(&ref, path, sizeof(path));
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = StorageKit::read_link(path, buf, size);
|
error = BPrivate::Storage::read_link(path, buf, size);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ BSymLink::MakeLinkedPath(const BDirectory *dir, BPath *path)
|
|||||||
if (result == 0)
|
if (result == 0)
|
||||||
result = ReadLink(contents, sizeof(contents));
|
result = ReadLink(contents, sizeof(contents));
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
if (StorageKit::is_absolute_path(contents))
|
if (BPrivate::Storage::is_absolute_path(contents))
|
||||||
result = path->SetTo(contents);
|
result = path->SetTo(contents);
|
||||||
else
|
else
|
||||||
result = path->SetTo(dir, contents);
|
result = path->SetTo(dir, contents);
|
||||||
@@ -286,7 +286,7 @@ BSymLink::IsAbsolute()
|
|||||||
char contents[B_PATH_NAME_LENGTH + 1];
|
char contents[B_PATH_NAME_LENGTH + 1];
|
||||||
bool result = (ReadLink(contents, sizeof(contents)) >= 0);
|
bool result = (ReadLink(contents, sizeof(contents)) >= 0);
|
||||||
if (result)
|
if (result)
|
||||||
result = StorageKit::is_absolute_path(contents);
|
result = BPrivate::Storage::is_absolute_path(contents);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ void BSymLink::_ReservedSymLink6() {}
|
|||||||
/*! To be used instead of accessing the BNode's private \c fFd member directly.
|
/*! To be used instead of accessing the BNode's private \c fFd member directly.
|
||||||
\return the file descriptor, or -1, if not properly initialized.
|
\return the file descriptor, or -1, if not properly initialized.
|
||||||
*/
|
*/
|
||||||
StorageKit::FileDescriptor
|
BPrivate::Storage::FileDescriptor
|
||||||
BSymLink::get_fd() const
|
BSymLink::get_fd() const
|
||||||
{
|
{
|
||||||
return fFd;
|
return fFd;
|
||||||
@@ -325,3 +325,6 @@ BSymLink::get_fd() const
|
|||||||
#ifdef USE_OPENBEOS_NAMESPACE
|
#ifdef USE_OPENBEOS_NAMESPACE
|
||||||
}; // namespace OpenBeOS
|
}; // namespace OpenBeOS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-12
@@ -126,7 +126,7 @@ BVolume::SetTo(
|
|||||||
// Call the kernel function that gets device information
|
// Call the kernel function that gets device information
|
||||||
// in order to determine the device status:
|
// in order to determine the device status:
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(dev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(dev, &fsInfo);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fCStatus = errno;
|
fCStatus = errno;
|
||||||
@@ -189,7 +189,7 @@ BVolume::GetRootDirectory(
|
|||||||
// the device and root node values.
|
// the device and root node values.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
currentStatus = errno;
|
currentStatus = errno;
|
||||||
@@ -226,7 +226,7 @@ BVolume::Capacity(void) const
|
|||||||
// and calculate the total storage capacity.
|
// and calculate the total storage capacity.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
totalBytes = fsInfo.block_size * fsInfo.total_blocks;
|
totalBytes = fsInfo.block_size * fsInfo.total_blocks;
|
||||||
@@ -255,7 +255,7 @@ BVolume::FreeBytes(void) const
|
|||||||
// and calculate the free storage available.
|
// and calculate the free storage available.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
remainingBytes = fsInfo.block_size * fsInfo.free_blocks;
|
remainingBytes = fsInfo.block_size * fsInfo.free_blocks;
|
||||||
@@ -284,7 +284,7 @@ BVolume::GetName(
|
|||||||
// and copies the device name into the buffer.
|
// and copies the device name into the buffer.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
currentStatus = errno;
|
currentStatus = errno;
|
||||||
@@ -365,7 +365,7 @@ BVolume::IsRemovable(void) const
|
|||||||
// and determines whether or not the device is removable.
|
// and determines whether or not the device is removable.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeIsRemovable = (fsInfo.flags & B_FS_IS_REMOVABLE);
|
volumeIsRemovable = (fsInfo.flags & B_FS_IS_REMOVABLE);
|
||||||
@@ -389,7 +389,7 @@ BVolume::IsReadOnly(void) const
|
|||||||
// and determines whether or not the device is read-only.
|
// and determines whether or not the device is read-only.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeIsReadOnly = (fsInfo.flags & B_FS_IS_READONLY);
|
volumeIsReadOnly = (fsInfo.flags & B_FS_IS_READONLY);
|
||||||
@@ -414,7 +414,7 @@ BVolume::IsPersistent(void) const
|
|||||||
// is persistent.
|
// is persistent.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeIsPersistent = (fsInfo.flags & B_FS_IS_PERSISTENT);
|
volumeIsPersistent = (fsInfo.flags & B_FS_IS_PERSISTENT);
|
||||||
@@ -439,7 +439,7 @@ BVolume::IsShared(void) const
|
|||||||
// over a network.
|
// over a network.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeIsShared = (fsInfo.flags & B_FS_IS_SHARED);
|
volumeIsShared = (fsInfo.flags & B_FS_IS_SHARED);
|
||||||
@@ -464,7 +464,7 @@ BVolume::KnowsMime(void) const
|
|||||||
// MIME types.
|
// MIME types.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeKnowsMime = (fsInfo.flags & B_FS_HAS_MIME);
|
volumeKnowsMime = (fsInfo.flags & B_FS_HAS_MIME);
|
||||||
@@ -490,7 +490,7 @@ BVolume::KnowsAttr(void) const
|
|||||||
// volume accept attributes.
|
// volume accept attributes.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeKnowsAttr = (fsInfo.flags & B_FS_HAS_ATTR);
|
volumeKnowsAttr = (fsInfo.flags & B_FS_HAS_ATTR);
|
||||||
@@ -516,7 +516,7 @@ BVolume::KnowsQuery(void) const
|
|||||||
// respond to queries.
|
// respond to queries.
|
||||||
|
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(fDev, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(fDev, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
volumeKnowsQuery = (fsInfo.flags & B_FS_HAS_QUERY);
|
volumeKnowsQuery = (fsInfo.flags & B_FS_HAS_QUERY);
|
||||||
@@ -611,3 +611,6 @@ void BVolume::_TurnUpTheVolume8() {}
|
|||||||
#ifdef USE_OPENBEOS_NAMESPACE
|
#ifdef USE_OPENBEOS_NAMESPACE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ BVolumeRoster::GetBootVolume(BVolume* boot_vol)
|
|||||||
|
|
||||||
if(deviceID >= 0) {
|
if(deviceID >= 0) {
|
||||||
fs_info fsInfo;
|
fs_info fsInfo;
|
||||||
int err = StorageKit::stat_dev(deviceID, &fsInfo);
|
int err = BPrivate::Storage::stat_dev(deviceID, &fsInfo);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
if(std::strcmp(fsInfo.device_name, kBootVolumeName) == 0) {
|
if(std::strcmp(fsInfo.device_name, kBootVolumeName) == 0) {
|
||||||
@@ -180,3 +180,6 @@ BVolumeRoster::Messenger(void) const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ struct LongDIR : DIR { char _buffer[B_FILE_NAME_LENGTH]; };
|
|||||||
/*! Returns information about the file system on the specified device. */
|
/*! Returns information about the file system on the specified device. */
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::stat_dev(dev_t dev, fs_info* info)
|
BPrivate::Storage::stat_dev(dev_t dev, fs_info* info)
|
||||||
{
|
{
|
||||||
return fs_stat_dev(dev, info);
|
return fs_stat_dev(dev, info);
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ StorageKit::stat_dev(dev_t dev, fs_info* info)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::open( const char *path, OpenFlags flags, FileDescriptor &result )
|
BPrivate::Storage::open( const char *path, OpenFlags flags, FileDescriptor &result )
|
||||||
{
|
{
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
result = -1;
|
result = -1;
|
||||||
@@ -70,7 +70,7 @@ StorageKit::open( const char *path, OpenFlags flags, FileDescriptor &result )
|
|||||||
/*! Same as the other version of open() except the file is created with the
|
/*! Same as the other version of open() except the file is created with the
|
||||||
permissions given by creationFlags if it doesn't exist. */
|
permissions given by creationFlags if it doesn't exist. */
|
||||||
status_t
|
status_t
|
||||||
StorageKit::open( const char *path, OpenFlags flags,
|
BPrivate::Storage::open( const char *path, OpenFlags flags,
|
||||||
CreationFlags creationFlags, FileDescriptor &result )
|
CreationFlags creationFlags, FileDescriptor &result )
|
||||||
{
|
{
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
@@ -84,7 +84,7 @@ StorageKit::open( const char *path, OpenFlags flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::close(StorageKit::FileDescriptor file)
|
BPrivate::Storage::close(BPrivate::Storage::FileDescriptor file)
|
||||||
{
|
{
|
||||||
return (::close(file) == -1) ? errno : B_OK ;
|
return (::close(file) == -1) ? errno : B_OK ;
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ StorageKit::close(StorageKit::FileDescriptor file)
|
|||||||
\return the number of bytes actually read or an error code
|
\return the number of bytes actually read or an error code
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::read(StorageKit::FileDescriptor fd, void *buf, size_t len)
|
BPrivate::Storage::read(BPrivate::Storage::FileDescriptor fd, void *buf, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t result = (buf == NULL ? B_BAD_VALUE : B_OK);
|
ssize_t result = (buf == NULL ? B_BAD_VALUE : B_OK);
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
@@ -113,7 +113,7 @@ StorageKit::read(StorageKit::FileDescriptor fd, void *buf, size_t len)
|
|||||||
\return the number of bytes actually read or an error code
|
\return the number of bytes actually read or an error code
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::read(StorageKit::FileDescriptor fd, void *buf, off_t pos,
|
BPrivate::Storage::read(BPrivate::Storage::FileDescriptor fd, void *buf, off_t pos,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
ssize_t result = (buf == NULL || pos < 0 ? B_BAD_VALUE : B_OK);
|
ssize_t result = (buf == NULL || pos < 0 ? B_BAD_VALUE : B_OK);
|
||||||
@@ -131,7 +131,7 @@ StorageKit::read(StorageKit::FileDescriptor fd, void *buf, off_t pos,
|
|||||||
\return the number of bytes actually written or an error code
|
\return the number of bytes actually written or an error code
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::write(StorageKit::FileDescriptor fd, const void *buf, size_t len)
|
BPrivate::Storage::write(BPrivate::Storage::FileDescriptor fd, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t result = (buf == NULL ? B_BAD_VALUE : B_OK);
|
ssize_t result = (buf == NULL ? B_BAD_VALUE : B_OK);
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
@@ -149,7 +149,7 @@ StorageKit::write(StorageKit::FileDescriptor fd, const void *buf, size_t len)
|
|||||||
\return the number of bytes actually written or an error code
|
\return the number of bytes actually written or an error code
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::write(StorageKit::FileDescriptor fd, const void *buf, off_t pos,
|
BPrivate::Storage::write(BPrivate::Storage::FileDescriptor fd, const void *buf, off_t pos,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
ssize_t result = (buf == NULL || pos < 0 ? B_BAD_VALUE : B_OK);
|
ssize_t result = (buf == NULL || pos < 0 ? B_BAD_VALUE : B_OK);
|
||||||
@@ -169,8 +169,8 @@ StorageKit::write(StorageKit::FileDescriptor fd, const void *buf, off_t pos,
|
|||||||
beginning of the file, or an error code
|
beginning of the file, or an error code
|
||||||
*/
|
*/
|
||||||
off_t
|
off_t
|
||||||
StorageKit::seek(StorageKit::FileDescriptor fd, off_t pos,
|
BPrivate::Storage::seek(BPrivate::Storage::FileDescriptor fd, off_t pos,
|
||||||
StorageKit::SeekMode mode)
|
BPrivate::Storage::SeekMode mode)
|
||||||
{
|
{
|
||||||
off_t result = ::lseek(fd, pos, mode);
|
off_t result = ::lseek(fd, pos, mode);
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
@@ -183,7 +183,7 @@ StorageKit::seek(StorageKit::FileDescriptor fd, off_t pos,
|
|||||||
beginning of the file, or an error code
|
beginning of the file, or an error code
|
||||||
*/
|
*/
|
||||||
off_t
|
off_t
|
||||||
StorageKit::get_position(StorageKit::FileDescriptor fd)
|
BPrivate::Storage::get_position(BPrivate::Storage::FileDescriptor fd)
|
||||||
{
|
{
|
||||||
off_t result = ::lseek(fd, 0, SEEK_CUR);
|
off_t result = ::lseek(fd, 0, SEEK_CUR);
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
@@ -191,8 +191,8 @@ StorageKit::get_position(StorageKit::FileDescriptor fd)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageKit::FileDescriptor
|
BPrivate::Storage::FileDescriptor
|
||||||
StorageKit::dup(StorageKit::FileDescriptor file)
|
BPrivate::Storage::dup(BPrivate::Storage::FileDescriptor file)
|
||||||
{
|
{
|
||||||
return ::dup(file);
|
return ::dup(file);
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ StorageKit::dup(StorageKit::FileDescriptor file)
|
|||||||
\return B_OK, if everything went fine, or an error code.
|
\return B_OK, if everything went fine, or an error code.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::dup( FileDescriptor file, FileDescriptor& result )
|
BPrivate::Storage::dup( FileDescriptor file, FileDescriptor& result )
|
||||||
{
|
{
|
||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
if (file == -1)
|
if (file == -1)
|
||||||
@@ -218,13 +218,13 @@ StorageKit::dup( FileDescriptor file, FileDescriptor& result )
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::sync( FileDescriptor file )
|
BPrivate::Storage::sync( FileDescriptor file )
|
||||||
{
|
{
|
||||||
return (fsync(file) == -1) ? errno : B_OK ;
|
return (fsync(file) == -1) ? errno : B_OK ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! /todo Get rid of DumpLock() at some point (it's only for debugging)
|
//! /todo Get rid of DumpLock() at some point (it's only for debugging)
|
||||||
void DumpLock(StorageKit::FileLock &lock)
|
void DumpLock(BPrivate::Storage::FileLock &lock)
|
||||||
{
|
{
|
||||||
cout << endl;
|
cout << endl;
|
||||||
cout << "type == ";
|
cout << "type == ";
|
||||||
@@ -258,7 +258,7 @@ void DumpLock(StorageKit::FileLock &lock)
|
|||||||
// are unimplemented in BeOS R5. Thus locking we'll have to wait for the new
|
// are unimplemented in BeOS R5. Thus locking we'll have to wait for the new
|
||||||
// kernel. I believe this function would work if fcntl() worked correctly.
|
// kernel. I believe this function would work if fcntl() worked correctly.
|
||||||
status_t
|
status_t
|
||||||
StorageKit::lock(FileDescriptor file, OpenFlags mode, FileLock *lock)
|
BPrivate::Storage::lock(FileDescriptor file, OpenFlags mode, FileLock *lock)
|
||||||
{
|
{
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
/*
|
/*
|
||||||
@@ -307,7 +307,7 @@ StorageKit::lock(FileDescriptor file, OpenFlags mode, FileLock *lock)
|
|||||||
// are unimplemented in BeOS R5. Thus locking will have to wait for the new
|
// are unimplemented in BeOS R5. Thus locking will have to wait for the new
|
||||||
// kernel. I believe this function would work if fcntl() worked correctly.
|
// kernel. I believe this function would work if fcntl() worked correctly.
|
||||||
status_t
|
status_t
|
||||||
StorageKit::unlock(FileDescriptor file, FileLock *lock)
|
BPrivate::Storage::unlock(FileDescriptor file, FileLock *lock)
|
||||||
{
|
{
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ StorageKit::unlock(FileDescriptor file, FileLock *lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_stat(const char *path, Stat *s)
|
BPrivate::Storage::get_stat(const char *path, Stat *s)
|
||||||
{
|
{
|
||||||
if (path == NULL || s == NULL)
|
if (path == NULL || s == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -331,7 +331,7 @@ StorageKit::get_stat(const char *path, Stat *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_stat(FileDescriptor file, Stat *s)
|
BPrivate::Storage::get_stat(FileDescriptor file, Stat *s)
|
||||||
{
|
{
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -340,17 +340,17 @@ StorageKit::get_stat(FileDescriptor file, Stat *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_stat(entry_ref &ref, Stat *result)
|
BPrivate::Storage::get_stat(entry_ref &ref, Stat *result)
|
||||||
{
|
{
|
||||||
char path[B_PATH_NAME_LENGTH + 1];
|
char path[B_PATH_NAME_LENGTH + 1];
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
status = StorageKit::entry_ref_to_path(&ref, path, B_PATH_NAME_LENGTH + 1);
|
status = BPrivate::Storage::entry_ref_to_path(&ref, path, B_PATH_NAME_LENGTH + 1);
|
||||||
return (status != B_OK) ? status : StorageKit::get_stat(path, result);
|
return (status != B_OK) ? status : BPrivate::Storage::get_stat(path, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::set_stat(FileDescriptor file, Stat &s, StatMember what)
|
BPrivate::Storage::set_stat(FileDescriptor file, Stat &s, StatMember what)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ StorageKit::set_stat(FileDescriptor file, Stat &s, StatMember what)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::set_stat(const char *file, Stat &s, StatMember what)
|
BPrivate::Storage::set_stat(const char *file, Stat &s, StatMember what)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ StorageKit::set_stat(const char *file, Stat &s, StatMember what)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::read_attr ( StorageKit::FileDescriptor file, const char *attribute,
|
BPrivate::Storage::read_attr ( BPrivate::Storage::FileDescriptor file, const char *attribute,
|
||||||
uint32 type, off_t pos, void *buf, size_t count )
|
uint32 type, off_t pos, void *buf, size_t count )
|
||||||
{
|
{
|
||||||
if (attribute == NULL || buf == NULL)
|
if (attribute == NULL || buf == NULL)
|
||||||
@@ -490,7 +490,7 @@ StorageKit::read_attr ( StorageKit::FileDescriptor file, const char *attribute,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::write_attr ( StorageKit::FileDescriptor file,
|
BPrivate::Storage::write_attr ( BPrivate::Storage::FileDescriptor file,
|
||||||
const char *attribute, uint32 type, off_t pos,
|
const char *attribute, uint32 type, off_t pos,
|
||||||
const void *buf, size_t count )
|
const void *buf, size_t count )
|
||||||
{
|
{
|
||||||
@@ -502,7 +502,7 @@ StorageKit::write_attr ( StorageKit::FileDescriptor file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::rename_attr(FileDescriptor file, const char *oldName,
|
BPrivate::Storage::rename_attr(FileDescriptor file, const char *oldName,
|
||||||
const char *newName)
|
const char *newName)
|
||||||
{
|
{
|
||||||
status_t error = (oldName && newName ? B_OK : B_BAD_VALUE);
|
status_t error = (oldName && newName ? B_OK : B_BAD_VALUE);
|
||||||
@@ -553,7 +553,7 @@ StorageKit::rename_attr(FileDescriptor file, const char *oldName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::remove_attr ( StorageKit::FileDescriptor file, const char *attr )
|
BPrivate::Storage::remove_attr ( BPrivate::Storage::FileDescriptor file, const char *attr )
|
||||||
{
|
{
|
||||||
if (attr == NULL)
|
if (attr == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -566,7 +566,7 @@ StorageKit::remove_attr ( StorageKit::FileDescriptor file, const char *attr )
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::stat_attr( FileDescriptor file, const char *name, AttrInfo *ai )
|
BPrivate::Storage::stat_attr( FileDescriptor file, const char *name, AttrInfo *ai )
|
||||||
{
|
{
|
||||||
if (name == NULL || ai == NULL)
|
if (name == NULL || ai == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -580,7 +580,7 @@ StorageKit::stat_attr( FileDescriptor file, const char *name, AttrInfo *ai )
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::open_attr_dir( FileDescriptor file, FileDescriptor &result )
|
BPrivate::Storage::open_attr_dir( FileDescriptor file, FileDescriptor &result )
|
||||||
{
|
{
|
||||||
result = NullFd;
|
result = NullFd;
|
||||||
if (DIR *dir = ::fs_fopen_attr_dir(file)) {
|
if (DIR *dir = ::fs_fopen_attr_dir(file)) {
|
||||||
@@ -591,7 +591,7 @@ StorageKit::open_attr_dir( FileDescriptor file, FileDescriptor &result )
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::rewind_attr_dir( FileDescriptor dir )
|
BPrivate::Storage::rewind_attr_dir( FileDescriptor dir )
|
||||||
{
|
{
|
||||||
if (dir < 0)
|
if (dir < 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -606,7 +606,7 @@ StorageKit::rewind_attr_dir( FileDescriptor dir )
|
|||||||
|
|
||||||
// buffer must be large enough!!!
|
// buffer must be large enough!!!
|
||||||
status_t
|
status_t
|
||||||
StorageKit::read_attr_dir( FileDescriptor dir, StorageKit::DirEntry& buffer )
|
BPrivate::Storage::read_attr_dir( FileDescriptor dir, BPrivate::Storage::DirEntry& buffer )
|
||||||
{
|
{
|
||||||
// init a DIR structure
|
// init a DIR structure
|
||||||
LongDIR dirDir;
|
LongDIR dirDir;
|
||||||
@@ -629,9 +629,9 @@ StorageKit::read_attr_dir( FileDescriptor dir, StorageKit::DirEntry& buffer )
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::close_attr_dir ( FileDescriptor dir )
|
BPrivate::Storage::close_attr_dir ( FileDescriptor dir )
|
||||||
{
|
{
|
||||||
if (dir == StorageKit::NullFd)
|
if (dir == BPrivate::Storage::NullFd)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
// init a DIR structure
|
// init a DIR structure
|
||||||
@@ -648,7 +648,7 @@ StorageKit::close_attr_dir ( FileDescriptor dir )
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::open_dir( const char *path, FileDescriptor &result )
|
BPrivate::Storage::open_dir( const char *path, FileDescriptor &result )
|
||||||
{
|
{
|
||||||
result = NullFd;
|
result = NullFd;
|
||||||
if (DIR *dir = ::opendir(path)) {
|
if (DIR *dir = ::opendir(path)) {
|
||||||
@@ -664,7 +664,7 @@ StorageKit::open_dir( const char *path, FileDescriptor &result )
|
|||||||
\return B_OK, if everything went fine, an error code otherwise
|
\return B_OK, if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::create_dir( const char *path, mode_t mode )
|
BPrivate::Storage::create_dir( const char *path, mode_t mode )
|
||||||
{
|
{
|
||||||
status_t error = (path ? B_OK : B_BAD_VALUE);
|
status_t error = (path ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
@@ -681,7 +681,7 @@ StorageKit::create_dir( const char *path, mode_t mode )
|
|||||||
\return B_OK, if everything went fine, an error code otherwise
|
\return B_OK, if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::create_dir( const char *path, FileDescriptor &result,
|
BPrivate::Storage::create_dir( const char *path, FileDescriptor &result,
|
||||||
mode_t mode )
|
mode_t mode )
|
||||||
{
|
{
|
||||||
status_t error = create_dir(path, mode);
|
status_t error = create_dir(path, mode);
|
||||||
@@ -700,7 +700,7 @@ StorageKit::create_dir( const char *path, FileDescriptor &result,
|
|||||||
- \c B_BAD_VALUE, if \a buffer is NULL, or the supplied buffer is too small
|
- \c B_BAD_VALUE, if \a buffer is NULL, or the supplied buffer is too small
|
||||||
*/
|
*/
|
||||||
int32
|
int32
|
||||||
StorageKit::read_dir( FileDescriptor dir, DirEntry *buffer, size_t length,
|
BPrivate::Storage::read_dir( FileDescriptor dir, DirEntry *buffer, size_t length,
|
||||||
int32 count )
|
int32 count )
|
||||||
{
|
{
|
||||||
// init a DIR structure
|
// init a DIR structure
|
||||||
@@ -729,7 +729,7 @@ StorageKit::read_dir( FileDescriptor dir, DirEntry *buffer, size_t length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::rewind_dir( FileDescriptor dir )
|
BPrivate::Storage::rewind_dir( FileDescriptor dir )
|
||||||
{
|
{
|
||||||
if (dir < 0)
|
if (dir < 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -743,7 +743,7 @@ StorageKit::rewind_dir( FileDescriptor dir )
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::find_dir( FileDescriptor dir, const char *name,
|
BPrivate::Storage::find_dir( FileDescriptor dir, const char *name,
|
||||||
DirEntry *result, size_t length )
|
DirEntry *result, size_t length )
|
||||||
{
|
{
|
||||||
if (dir < 0 || name == NULL || result == NULL)
|
if (dir < 0 || name == NULL || result == NULL)
|
||||||
@@ -751,9 +751,9 @@ StorageKit::find_dir( FileDescriptor dir, const char *name,
|
|||||||
|
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
status = StorageKit::rewind_dir(dir);
|
status = BPrivate::Storage::rewind_dir(dir);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
while ( StorageKit::read_dir(dir, result, length, 1) == 1)
|
while ( BPrivate::Storage::read_dir(dir, result, length, 1) == 1)
|
||||||
{
|
{
|
||||||
if (strcmp(result->d_name, name) == 0)
|
if (strcmp(result->d_name, name) == 0)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -765,12 +765,12 @@ StorageKit::find_dir( FileDescriptor dir, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::find_dir( FileDescriptor dir, const char *name, entry_ref *result )
|
BPrivate::Storage::find_dir( FileDescriptor dir, const char *name, entry_ref *result )
|
||||||
{
|
{
|
||||||
status_t status = (result ? B_OK : B_BAD_VALUE);
|
status_t status = (result ? B_OK : B_BAD_VALUE);
|
||||||
LongDirEntry entry;
|
LongDirEntry entry;
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
status = StorageKit::find_dir(dir, name, &entry, sizeof(entry));
|
status = BPrivate::Storage::find_dir(dir, name, &entry, sizeof(entry));
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
result->device = entry.d_pdev;
|
result->device = entry.d_pdev;
|
||||||
result->directory = entry.d_pino;
|
result->directory = entry.d_pino;
|
||||||
@@ -780,13 +780,13 @@ StorageKit::find_dir( FileDescriptor dir, const char *name, entry_ref *result )
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::dup_dir( FileDescriptor dir, FileDescriptor &result )
|
BPrivate::Storage::dup_dir( FileDescriptor dir, FileDescriptor &result )
|
||||||
{
|
{
|
||||||
return StorageKit::dup(dir, result);
|
return BPrivate::Storage::dup(dir, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::close_dir( FileDescriptor dir )
|
BPrivate::Storage::close_dir( FileDescriptor dir )
|
||||||
{
|
{
|
||||||
// init a DIR structure
|
// init a DIR structure
|
||||||
if (LongDIR* dirDir = (LongDIR*)malloc(sizeof(LongDIR))) {
|
if (LongDIR* dirDir = (LongDIR*)malloc(sizeof(LongDIR))) {
|
||||||
@@ -806,7 +806,7 @@ StorageKit::close_dir( FileDescriptor dir )
|
|||||||
\return B_OK, if everything went fine, an error code otherwise
|
\return B_OK, if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::create_link( const char *path, const char *linkToPath )
|
BPrivate::Storage::create_link( const char *path, const char *linkToPath )
|
||||||
{
|
{
|
||||||
status_t error = (path && linkToPath ? B_OK : B_BAD_VALUE);
|
status_t error = (path && linkToPath ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
@@ -823,7 +823,7 @@ StorageKit::create_link( const char *path, const char *linkToPath )
|
|||||||
\return B_OK, if everything went fine, an error code otherwise
|
\return B_OK, if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::create_link( const char *path, const char *linkToPath,
|
BPrivate::Storage::create_link( const char *path, const char *linkToPath,
|
||||||
FileDescriptor &result)
|
FileDescriptor &result)
|
||||||
{
|
{
|
||||||
status_t error = create_link(path, linkToPath);
|
status_t error = create_link(path, linkToPath);
|
||||||
@@ -833,7 +833,7 @@ StorageKit::create_link( const char *path, const char *linkToPath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::read_link( const char *path, char *result, size_t size )
|
BPrivate::Storage::read_link( const char *path, char *result, size_t size )
|
||||||
{
|
{
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -853,7 +853,7 @@ StorageKit::read_link( const char *path, char *result, size_t size )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
StorageKit::read_link( FileDescriptor fd, char *result, size_t size )
|
BPrivate::Storage::read_link( FileDescriptor fd, char *result, size_t size )
|
||||||
{
|
{
|
||||||
ssize_t error = (result ? B_OK : B_BAD_VALUE);
|
ssize_t error = (result ? B_OK : B_BAD_VALUE);
|
||||||
// no way to implement it :-(
|
// no way to implement it :-(
|
||||||
@@ -868,7 +868,7 @@ StorageKit::read_link( FileDescriptor fd, char *result, size_t size )
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::open_query( dev_t device, const char *query, uint32 flags,
|
BPrivate::Storage::open_query( dev_t device, const char *query, uint32 flags,
|
||||||
FileDescriptor &result )
|
FileDescriptor &result )
|
||||||
{
|
{
|
||||||
if (flags & B_LIVE_QUERY)
|
if (flags & B_LIVE_QUERY)
|
||||||
@@ -882,7 +882,7 @@ StorageKit::open_query( dev_t device, const char *query, uint32 flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::open_live_query( dev_t device, const char *query, uint32 flags,
|
BPrivate::Storage::open_live_query( dev_t device, const char *query, uint32 flags,
|
||||||
port_id port, int32 token,
|
port_id port, int32 token,
|
||||||
FileDescriptor &result )
|
FileDescriptor &result )
|
||||||
{
|
{
|
||||||
@@ -906,7 +906,7 @@ StorageKit::open_live_query( dev_t device, const char *query, uint32 flags,
|
|||||||
- \c B_BAD_VALUE, if \a buffer is NULL, or the supplied buffer is too small
|
- \c B_BAD_VALUE, if \a buffer is NULL, or the supplied buffer is too small
|
||||||
*/
|
*/
|
||||||
int32
|
int32
|
||||||
StorageKit::read_query( FileDescriptor query, DirEntry *buffer, size_t length,
|
BPrivate::Storage::read_query( FileDescriptor query, DirEntry *buffer, size_t length,
|
||||||
int32 count )
|
int32 count )
|
||||||
{
|
{
|
||||||
// init a DIR structure
|
// init a DIR structure
|
||||||
@@ -935,7 +935,7 @@ StorageKit::read_query( FileDescriptor query, DirEntry *buffer, size_t length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::close_query( FileDescriptor query )
|
BPrivate::Storage::close_query( FileDescriptor query )
|
||||||
{
|
{
|
||||||
// init a DIR structure
|
// init a DIR structure
|
||||||
if (LongDIR* queryDir = (LongDIR*)malloc(sizeof(LongDIR))) {
|
if (LongDIR* queryDir = (LongDIR*)malloc(sizeof(LongDIR))) {
|
||||||
@@ -951,7 +951,7 @@ StorageKit::close_query( FileDescriptor query )
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::entry_ref_to_path( const struct entry_ref *ref, char *result,
|
BPrivate::Storage::entry_ref_to_path( const struct entry_ref *ref, char *result,
|
||||||
size_t size )
|
size_t size )
|
||||||
{
|
{
|
||||||
if (ref == NULL) {
|
if (ref == NULL) {
|
||||||
@@ -963,22 +963,22 @@ StorageKit::entry_ref_to_path( const struct entry_ref *ref, char *result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::entry_ref_to_path( dev_t device, ino_t directory, const char *name,
|
BPrivate::Storage::entry_ref_to_path( dev_t device, ino_t directory, const char *name,
|
||||||
char *result, size_t size )
|
char *result, size_t size )
|
||||||
{
|
{
|
||||||
return entry_ref_to_path_adapter(device, directory, name, result, size);
|
return entry_ref_to_path_adapter(device, directory, name, result, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::dir_to_self_entry_ref( FileDescriptor dir, entry_ref *result )
|
BPrivate::Storage::dir_to_self_entry_ref( FileDescriptor dir, entry_ref *result )
|
||||||
{
|
{
|
||||||
if (dir == StorageKit::NullFd || result == NULL)
|
if (dir == BPrivate::Storage::NullFd || result == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
return find_dir(dir, ".", result);
|
return find_dir(dir, ".", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::dir_to_path( FileDescriptor dir, char *result, size_t size )
|
BPrivate::Storage::dir_to_path( FileDescriptor dir, char *result, size_t size )
|
||||||
{
|
{
|
||||||
if (dir < 0 || result == NULL)
|
if (dir < 0 || result == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -1000,7 +1000,7 @@ StorageKit::dir_to_path( FileDescriptor dir, char *result, size_t size )
|
|||||||
\return \c B_OK if everything went fine, an error code otherwise
|
\return \c B_OK if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_canonical_path(const char *path, char *result, size_t size)
|
BPrivate::Storage::get_canonical_path(const char *path, char *result, size_t size)
|
||||||
{
|
{
|
||||||
status_t error = (path && result ? B_OK : B_BAD_VALUE);
|
status_t error = (path && result ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
@@ -1041,7 +1041,7 @@ StorageKit::get_canonical_path(const char *path, char *result, size_t size)
|
|||||||
\return \c B_OK if everything went fine, an error code otherwise
|
\return \c B_OK if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_canonical_path(const char *path, char *&result)
|
BPrivate::Storage::get_canonical_path(const char *path, char *&result)
|
||||||
{
|
{
|
||||||
status_t error = (path ? B_OK : B_BAD_VALUE);
|
status_t error = (path ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
@@ -1066,7 +1066,7 @@ StorageKit::get_canonical_path(const char *path, char *&result)
|
|||||||
\return \c B_OK if everything went fine, an error code otherwise
|
\return \c B_OK if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_canonical_dir_path(const char *path, char *result, size_t size)
|
BPrivate::Storage::get_canonical_dir_path(const char *path, char *result, size_t size)
|
||||||
{
|
{
|
||||||
status_t error = (path && result ? B_OK : B_BAD_VALUE);
|
status_t error = (path && result ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
@@ -1086,7 +1086,7 @@ StorageKit::get_canonical_dir_path(const char *path, char *result, size_t size)
|
|||||||
\return \c B_OK if everything went fine, an error code otherwise
|
\return \c B_OK if everything went fine, an error code otherwise
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_canonical_dir_path(const char *path, char *&result)
|
BPrivate::Storage::get_canonical_dir_path(const char *path, char *&result)
|
||||||
{
|
{
|
||||||
status_t error = (path ? B_OK : B_BAD_VALUE);
|
status_t error = (path ? B_OK : B_BAD_VALUE);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
@@ -1106,7 +1106,7 @@ StorageKit::get_canonical_dir_path(const char *path, char *&result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::get_app_path(char *buffer)
|
BPrivate::Storage::get_app_path(char *buffer)
|
||||||
{
|
{
|
||||||
status_t error = (buffer ? B_OK : B_BAD_VALUE);
|
status_t error = (buffer ? B_OK : B_BAD_VALUE);
|
||||||
image_info info;
|
image_info info;
|
||||||
@@ -1127,14 +1127,14 @@ StorageKit::get_app_path(char *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StorageKit::entry_ref_is_root_dir( entry_ref &ref )
|
BPrivate::Storage::entry_ref_is_root_dir( entry_ref &ref )
|
||||||
{
|
{
|
||||||
return ref.directory == 1 && ref.device == 1 && ref.name[0] == '.'
|
return ref.directory == 1 && ref.device == 1 && ref.name[0] == '.'
|
||||||
&& ref.name[1] == 0;
|
&& ref.name[1] == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StorageKit::rename(const char *oldPath, const char *newPath)
|
BPrivate::Storage::rename(const char *oldPath, const char *newPath)
|
||||||
{
|
{
|
||||||
if (oldPath == NULL || newPath == NULL)
|
if (oldPath == NULL || newPath == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -1144,7 +1144,7 @@ StorageKit::rename(const char *oldPath, const char *newPath)
|
|||||||
|
|
||||||
/*! Removes path from the filesystem. */
|
/*! Removes path from the filesystem. */
|
||||||
status_t
|
status_t
|
||||||
StorageKit::remove(const char *path)
|
BPrivate::Storage::remove(const char *path)
|
||||||
{
|
{
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -1152,3 +1152,6 @@ StorageKit::remove(const char *path)
|
|||||||
return (::remove(path) == -1) ? errno : B_OK ;
|
return (::remove(path) == -1) ? errno : B_OK ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <sniffer/DisjList.h>
|
#include <sniffer/DisjList.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
DisjList::DisjList()
|
DisjList::DisjList()
|
||||||
: fCaseInsensitive(false)
|
: fCaseInsensitive(false)
|
||||||
@@ -29,3 +29,6 @@ DisjList::IsCaseInsensitive() {
|
|||||||
return fCaseInsensitive;
|
return fCaseInsensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <sniffer/Err.h>
|
#include <sniffer/Err.h>
|
||||||
#include <new.h>
|
#include <new.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Err
|
// Err
|
||||||
@@ -92,3 +92,6 @@ void
|
|||||||
Err::SetPos(ssize_t pos) {
|
Err::SetPos(ssize_t pos) {
|
||||||
fPos = pos;
|
fPos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <String.h> // BString
|
#include <String.h> // BString
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
// Miscellaneous helper functions
|
// Miscellaneous helper functions
|
||||||
char escapeChar(char ch);
|
char escapeChar(char ch);
|
||||||
@@ -37,7 +37,7 @@ bool isDecimalChar(char ch);
|
|||||||
bool isPunctuation(char ch);
|
bool isPunctuation(char ch);
|
||||||
|
|
||||||
//! Parses the given rule.
|
//! Parses the given rule.
|
||||||
/*! The resulting parsed Sniffer::Rule structure is stored in \c rule, which
|
/*! The resulting parsed Rule structure is stored in \c rule, which
|
||||||
must be pre-allocated. If parsing fails, a descriptive error message (meant
|
must be pre-allocated. If parsing fails, a descriptive error message (meant
|
||||||
to be viewed in a monospaced font) is placed in the pre-allocated \c BString
|
to be viewed in a monospaced font) is placed in the pre-allocated \c BString
|
||||||
pointed to by \c parseError (which may be \c NULL if you don't care about
|
pointed to by \c parseError (which may be \c NULL if you don't care about
|
||||||
@@ -45,7 +45,7 @@ bool isPunctuation(char ch);
|
|||||||
|
|
||||||
\param rule Pointer to a NULL-terminated string containing the sniffer
|
\param rule Pointer to a NULL-terminated string containing the sniffer
|
||||||
rule to be parsed
|
rule to be parsed
|
||||||
\param result Pointer to a pre-allocated \c Sniffer::Rule object into which the result
|
\param result Pointer to a pre-allocated \c Rule object into which the result
|
||||||
of parsing is placed upon success.
|
of parsing is placed upon success.
|
||||||
\param parseError Point to pre-allocated \c BString object into which
|
\param parseError Point to pre-allocated \c BString object into which
|
||||||
a descriptive error message is stored upon failure.
|
a descriptive error message is stored upon failure.
|
||||||
@@ -55,7 +55,7 @@ bool isPunctuation(char ch);
|
|||||||
- B_BAD_MIME_SNIFFER_RULE: Failure
|
- B_BAD_MIME_SNIFFER_RULE: Failure
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
Sniffer::parse(const char *rule, Rule *result, BString *parseError) {
|
BPrivate::Storage::Sniffer::parse(const char *rule, Rule *result, BString *parseError) {
|
||||||
Parser parser;
|
Parser parser;
|
||||||
return parser.Parse(rule, result, parseError);
|
return parser.Parse(rule, result, parseError);
|
||||||
}
|
}
|
||||||
@@ -743,7 +743,7 @@ TokenStream::InitCheck() const {
|
|||||||
|
|
||||||
//! Returns a pointer to the next token in the stream.
|
//! Returns a pointer to the next token in the stream.
|
||||||
/*! The TokenStream object retains owner ship of the Token object returned by Get().
|
/*! The TokenStream object retains owner ship of the Token object returned by Get().
|
||||||
If Get() is called at the end of the stream, a pointer to a Sniffer::Err object is thrown.
|
If Get() is called at the end of the stream, a pointer to a Err object is thrown.
|
||||||
*/
|
*/
|
||||||
const Token*
|
const Token*
|
||||||
TokenStream::Get() {
|
TokenStream::Get() {
|
||||||
@@ -759,7 +759,7 @@ TokenStream::Get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Places token returned by the most recent call to Get() back on the head of the stream.
|
//! Places token returned by the most recent call to Get() back on the head of the stream.
|
||||||
/*! If Unget() is called at the beginning of the stream, a pointer to a Sniffer::Err object is thrown.
|
/*! If Unget() is called at the beginning of the stream, a pointer to a Err object is thrown.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TokenStream::Unget() {
|
TokenStream::Unget() {
|
||||||
@@ -773,7 +773,7 @@ TokenStream::Unget() {
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Reads the next token in the stream and verifies it is of the given type,
|
/*! \brief Reads the next token in the stream and verifies it is of the given type,
|
||||||
throwing a pointer to a Sniffer::Err object if it is not.
|
throwing a pointer to a Err object if it is not.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TokenStream::Read(TokenType type) {
|
TokenStream::Read(TokenType type) {
|
||||||
@@ -954,7 +954,7 @@ isPunctuation(char ch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
Sniffer::tokenTypeToString(TokenType type) {
|
BPrivate::Storage::Sniffer::tokenTypeToString(TokenType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LeftParen:
|
case LeftParen:
|
||||||
return "LeftParen";
|
return "LeftParen";
|
||||||
@@ -1341,3 +1341,6 @@ Parser::ThrowUnexpectedTokenError(TokenType expected1, TokenType expected2, cons
|
|||||||
+ (found ? tokenTypeToString(found->Type()) : "NULL token")).c_str()
|
+ (found ? tokenTypeToString(found->Type()) : "NULL token")).c_str()
|
||||||
, (found ? found->Pos() : stream.EndPos()));
|
, (found ? found->Pos() : stream.EndPos()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
#include <stdio.h> // for SEEK_* defines
|
#include <stdio.h> // for SEEK_* defines
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
Pattern::Pattern(const std::string &string, const std::string &mask)
|
Pattern::Pattern(const std::string &string, const std::string &mask)
|
||||||
: fCStatus(B_NO_INIT)
|
: fCStatus(B_NO_INIT)
|
||||||
@@ -160,3 +160,6 @@ Pattern::SetErrorMessage(const char *msg) {
|
|||||||
delete fErrorMessage;
|
delete fErrorMessage;
|
||||||
fErrorMessage = (msg) ? (new(nothrow) Err(msg, -1)) : (NULL);
|
fErrorMessage = (msg) ? (new(nothrow) Err(msg, -1)) : (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
PatternList::PatternList(Range range)
|
PatternList::PatternList(Range range)
|
||||||
: DisjList()
|
: DisjList()
|
||||||
@@ -61,3 +61,6 @@ PatternList::Add(Pattern *pattern) {
|
|||||||
if (pattern)
|
if (pattern)
|
||||||
fList.push_back(pattern);
|
fList.push_back(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <sniffer/RPattern.h>
|
#include <sniffer/RPattern.h>
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
RPattern::RPattern(Range range, Pattern *pattern)
|
RPattern::RPattern(Range range, Pattern *pattern)
|
||||||
: fRange(range)
|
: fRange(range)
|
||||||
@@ -59,3 +59,6 @@ RPattern::Sniff(BPositionIO *data, bool caseInsensitive) const {
|
|||||||
else
|
else
|
||||||
return fPattern->Sniff(fRange, data, caseInsensitive);
|
return fPattern->Sniff(fRange, data, caseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
RPatternList::RPatternList()
|
RPatternList::RPatternList()
|
||||||
: DisjList()
|
: DisjList()
|
||||||
@@ -61,3 +61,6 @@ RPatternList::Add(RPattern *rpattern) {
|
|||||||
if (rpattern)
|
if (rpattern)
|
||||||
fList.push_back(rpattern);
|
fList.push_back(rpattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <sniffer/Parser.h>
|
#include <sniffer/Parser.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
Range::Range(int32 start, int32 end)
|
Range::Range(int32 start, int32 end)
|
||||||
: fStart(-1)
|
: fStart(-1)
|
||||||
@@ -60,3 +60,6 @@ Range::SetTo(int32 start, int32 end) {
|
|||||||
fCStatus = B_OK;
|
fCStatus = B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <sniffer/Rule.h>
|
#include <sniffer/Rule.h>
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
Rule::Rule()
|
Rule::Rule()
|
||||||
: fPriority(0.0)
|
: fPriority(0.0)
|
||||||
@@ -72,3 +72,6 @@ Rule::SetTo(double priority, std::vector<DisjList*>* list) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include "storage_support.h"
|
#include "storage_support.h"
|
||||||
|
|
||||||
namespace StorageKit {
|
namespace BPrivate {
|
||||||
|
namespace Storage {
|
||||||
|
|
||||||
/*! \param path the path
|
/*! \param path the path
|
||||||
\return \c true, if \a path is not \c NULL and absolute, \c false otherwise
|
\return \c true, if \a path is not \c NULL and absolute, \c false otherwise
|
||||||
@@ -315,4 +316,8 @@ check_path_name(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace StorageKit
|
}; // namespace Storage
|
||||||
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace Sniffer;
|
using namespace BPrivate::Storage::Sniffer;
|
||||||
|
|
||||||
// Suite
|
// Suite
|
||||||
CppUnit::Test*
|
CppUnit::Test*
|
||||||
|
|||||||
Reference in New Issue
Block a user