#include "ipc/Queue.h"
#include "ipc/StrandSearch.h"
#include "ipc/UdsOp.h"
+#include "SBuf.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "StatCounters.h"
bool IpcIoFile::DiskerHandleMoreRequestsScheduled = false;
-static bool DiskerOpen(const String &path, int flags, mode_t mode);
-static void DiskerClose(const String &path);
+static bool DiskerOpen(const SBuf &path, int flags, mode_t mode);
+static void DiskerClose(const SBuf &path);
/// IpcIo wrapper for debugs() streams; XXX: find a better class name
struct SipcIo {
queue.reset(new Queue(ShmLabel, IamWorkerProcess() ? Queue::groupA : Queue::groupB, KidIdentifier));
if (IamDiskProcess()) {
- error_ = !DiskerOpen(dbName, flags, mode);
+ error_ = !DiskerOpen(SBuf(dbName.termedBuf()), flags, mode);
if (error_)
return;
assert(ioRequestor != NULL);
if (IamDiskProcess())
- DiskerClose(dbName);
+ DiskerClose(SBuf(dbName.termedBuf()));
// XXX: else nothing to do?
ioRequestor->closeCompleted();
/* XXX: disker code that should probably be moved elsewhere */
-static String DbName; ///< full db file name
+static SBuf DbName; ///< full db file name
static int TheFile = -1; ///< db file descriptor
static void
}
static bool
-DiskerOpen(const String &path, int flags, mode_t mode)
+DiskerOpen(const SBuf &path, int flags, mode_t mode)
{
assert(TheFile < 0);
DbName = path;
- TheFile = file_open(DbName.termedBuf(), flags);
+ TheFile = file_open(DbName.c_str(), flags);
if (TheFile < 0) {
const int xerrno = errno;
}
++store_open_disk_fd;
- debugs(79,3, HERE << "rock db opened " << DbName << ": FD " << TheFile);
+ debugs(79,3, "rock db opened " << DbName << ": FD " << TheFile);
return true;
}
static void
-DiskerClose(const String &path)
+DiskerClose(const SBuf &path)
{
if (TheFile >= 0) {
file_close(TheFile);
TheFile = -1;
--store_open_disk_fd;
}
- DbName.clean();
+ DbName.clear();
}
/// reports our needs for shared memory pages to Ipc::Mem::Pages
bool swappingOut() const { return swap_status == SWAPOUT_WRITING; }
void swapOutFileClose(int how);
const char *url() const;
- /// generally cachable (checks agnostic to disk/RAM-specific requirements)
- /// common part of mayStartSwapOut() and memoryCachable()
- /// TODO: Make private so only those two methods can call this.
- int checkCachable();
+ /// Satisfies cachability requirements shared among disk and RAM caches.
+ /// Encapsulates common checks of mayStartSwapOut() and memoryCachable().
+ /// TODO: Rename and make private so only those two methods can call this.
+ bool checkCachable();
int checkNegativeHit() const;
int locked() const;
int validToSend() const;
void StoreEntry::swapOut() STUB
void StoreEntry::swapOutFileClose(int how) STUB
const char *StoreEntry::url() const STUB_RETVAL(NULL)
-int StoreEntry::checkCachable() STUB_RETVAL(0)
+bool StoreEntry::checkCachable() STUB_RETVAL(0)
int StoreEntry::checkNegativeHit() const STUB_RETVAL(0)
int StoreEntry::locked() const STUB_RETVAL(0)
int StoreEntry::validToSend() const STUB_RETVAL(0)