DiskIOModule.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 /* DEBUG: section 92 Storage File System */
10 
11 #include "squid.h"
12 #include "DiskIOModule.h"
13 #if HAVE_DISKIO_MODULE_AIO
15 #endif
16 #if HAVE_DISKIO_MODULE_BLOCKING
18 #endif
19 #if HAVE_DISKIO_MODULE_DISKDAEMON
21 #endif
22 #if HAVE_DISKIO_MODULE_DISKTHREADS
24 #endif
25 #if HAVE_DISKIO_MODULE_IPCIO
27 #endif
28 #if HAVE_DISKIO_MODULE_MMAPPED
30 #endif
31 
32 std::vector<DiskIOModule*> *DiskIOModule::_Modules = NULL;
33 
34 //DiskIOModule() : initialised (false) {}
35 
37 {
42 }
43 
44 void
46 {
47 #if HAVE_DISKIO_MODULE_AIO
48  AIODiskIOModule::GetInstance();
49 #endif
50 #if HAVE_DISKIO_MODULE_BLOCKING
52 #endif
53 #if HAVE_DISKIO_MODULE_DISKDAEMON
55 #endif
56 #if HAVE_DISKIO_MODULE_DISKTHREADS
58 #endif
59 #if HAVE_DISKIO_MODULE_IPCIO
61 #endif
62 #if HAVE_DISKIO_MODULE_MMAPPED
64 #endif
65 
66  for (iterator i = GetModules().begin(); i != GetModules().end(); ++i)
67  /* Call the FS to set up capabilities and initialize the FS driver */
68  (*i)->init();
69 }
70 
71 void
73 {
74  iterator i = GetModules().begin();
75 
76  while (i != GetModules().end()) {
77  assert(strcmp((*i)->type(), instance.type()) != 0);
78  ++i;
79  }
80 
81  GetModules().push_back (&instance);
82 }
83 
84 std::vector<DiskIOModule *> const &
86 {
87  return GetModules();
88 }
89 
90 std::vector<DiskIOModule*> &
92 {
93  if (!_Modules)
94  _Modules = new std::vector<DiskIOModule *>;
95 
96  return *_Modules;
97 }
98 
103 void
105 {
106  while (!GetModules().empty()) {
107  DiskIOModule *fs = GetModules().back();
108  GetModules().pop_back();
109  fs->gracefulShutdown();
110  }
111 }
112 
113 DiskIOModule *
115 {
116  for (iterator i = GetModules().begin(); i != GetModules().end(); ++i)
117  if (strcasecmp(type, (*i)->type()) == 0)
118  return *i;
119 
120  return NULL;
121 }
122 
123 DiskIOModule *
125 {
127  DiskIOModule * result;
128  result = Find("DiskThreads");
129  if (NULL == result)
130  result = Find("DiskDaemon");
131  if (NULL == result)
132  result = Find("AIO");
133  if (NULL == result)
134  result = Find("Blocking");
135  return result;
136 }
137 
static MmappedDiskIOModule & GetInstance()
#define assert(EX)
Definition: assert.h:17
static std::vector< DiskIOModule * > const & Modules()
Definition: DiskIOModule.cc:85
virtual char const * type() const =0
int i
Definition: membanger.c:49
static BlockingDiskIOModule & GetInstance()
static std::vector< DiskIOModule * > * _Modules
Definition: DiskIOModule.h:57
static DiskIOModule * Find(char const *type)
static DiskIOModule * FindDefault()
static DiskThreadsDiskIOModule & GetInstance()
static void ModuleAdd(DiskIOModule &)
Definition: DiskIOModule.cc:72
static IpcIoDiskIOModule & GetInstance()
std::vector< DiskIOModule * >::iterator iterator
Definition: DiskIOModule.h:36
static DiskDaemonDiskIOModule & GetInstance()
static std::vector< DiskIOModule * > & GetModules()
Definition: DiskIOModule.cc:91
static CacheManager * instance
static void FreeAllModules()
virtual void gracefulShutdown()=0
#define NULL
Definition: types.h:166
static void SetupAllModules()
Definition: DiskIOModule.cc:45

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors