]> git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreFileSystem.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / StoreFileSystem.cc
1 /*
2 * Copyright (C) 1996-2020 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 "StoreFileSystem.h"
13
14 std::vector<StoreFileSystem*> *StoreFileSystem::_FileSystems = NULL;
15
16 void
17 StoreFileSystem::RegisterAllFsWithCacheManager(void)
18 {
19 for (iterator i = GetFileSystems().begin(); i != GetFileSystems().end(); ++i)
20 (*i)->registerWithCacheManager();
21 }
22
23 void
24 StoreFileSystem::SetupAllFs()
25 {
26 for (iterator i = GetFileSystems().begin(); i != GetFileSystems().end(); ++i)
27 /* Call the FS to set up capabilities and initialize the FS driver */
28 (*i)->setup();
29 }
30
31 void
32 StoreFileSystem::FsAdd(StoreFileSystem &instance)
33 {
34 iterator i = GetFileSystems().begin();
35
36 while (i != GetFileSystems().end()) {
37 assert(strcmp((*i)->type(), instance.type()) != 0);
38 ++i;
39 }
40
41 GetFileSystems().push_back (&instance);
42 }
43
44 std::vector<StoreFileSystem *> const &
45 StoreFileSystem::FileSystems()
46 {
47 return GetFileSystems();
48 }
49
50 std::vector<StoreFileSystem*> &
51 StoreFileSystem::GetFileSystems()
52 {
53 if (!_FileSystems)
54 _FileSystems = new std::vector<StoreFileSystem *>;
55
56 return *_FileSystems;
57 }
58
59 /*
60 * called when a graceful shutdown is to occur
61 * of each fs module.
62 */
63 void
64 StoreFileSystem::FreeAllFs()
65 {
66 while (!GetFileSystems().empty()) {
67 StoreFileSystem *fs = GetFileSystems().back();
68 GetFileSystems().pop_back();
69 fs->done();
70 }
71 }
72
73 /* no filesystem is required to export statistics */
74 void
75 StoreFileSystem::registerWithCacheManager(void)
76 {}
77