]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / DiskDaemon / DiskDaemonDiskIOModule.cc
CommitLineData
b9ae18aa 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
b9ae18aa 3 *
bbc27441
AJ
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
b9ae18aa 7 */
8
582c2af2 9#include "squid.h"
b9ae18aa 10#include "DiskDaemonDiskIOModule.h"
11#include "DiskdIOStrategy.h"
8822ebee
AR
12#include "DiskIO/DiskDaemon/DiskdAction.h"
13#include "mgr/Registration.h"
b9ae18aa 14#include "Store.h"
15
16DiskDaemonDiskIOModule::DiskDaemonDiskIOModule() : initialised(false)
17{
18 ModuleAdd(*this);
19}
20
21DiskDaemonDiskIOModule &
22DiskDaemonDiskIOModule::GetInstance()
23{
24 return Instance;
25}
26
27void
28DiskDaemonDiskIOModule::init()
29{
30 /* We may be reused - for instance in coss - eventually.
31 * When we do, we either need per-using-module stats (
26ac0430 32 * no singleton pattern), or we need to refcount the
b9ae18aa 33 * initialisation level and handle multiple clients.
34 * RBC - 20030718.
35 */
36 assert(!initialised);
37 memset(&diskd_stats, '\0', sizeof(diskd_stats));
af00d03d 38#if 0
39 /*
40 * DPW 2007-04-12
41 * No debugging here please because this method is called before
42 * the debug log is configured and we'll get the message on
43 * stderr when doing things like 'squid -k reconfigure'
44 */
e0236918 45 debugs(47, DBG_IMPORTANT, "diskd started");
af00d03d 46#endif
b9ae18aa 47 initialised = true;
6fdc2d18
FC
48
49 registerWithCacheManager();
b9ae18aa 50}
51
62ee09ca 52void
15fab853 53DiskDaemonDiskIOModule::registerWithCacheManager(void)
62ee09ca 54{
8822ebee 55 Mgr::RegisterAction("diskd", "DISKD Stats", &DiskdAction::Create, 0, 1);
62ee09ca 56}
57
b9ae18aa 58void
1e1a9021 59DiskDaemonDiskIOModule::gracefulShutdown()
b9ae18aa 60{
61 initialised = false;
62}
63
64DiskIOStrategy *
65DiskDaemonDiskIOModule::createStrategy()
66{
67 return new DiskdIOStrategy();
68}
69
70DiskDaemonDiskIOModule DiskDaemonDiskIOModule::Instance;
71
b9ae18aa 72char const *
73DiskDaemonDiskIOModule::type () const
74{
75 return "DiskDaemon";
76}
f53969cc 77