]>
Commit | Line | Data |
---|---|---|
59b2d47f | 1 | /* |
f70aedc4 | 2 | * Copyright (C) 1996-2021 The Squid Software Foundation and contributors |
26ac0430 | 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. | |
59b2d47f | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 92 Storage File System */ |
10 | ||
582c2af2 | 11 | #include "squid.h" |
59b2d47f | 12 | #include "StoreFileSystem.h" |
13 | ||
81481ec0 | 14 | std::vector<StoreFileSystem*> *StoreFileSystem::_FileSystems = NULL; |
59b2d47f | 15 | |
62ee09ca | 16 | void |
ff82835a | 17 | StoreFileSystem::RegisterAllFsWithCacheManager(void) |
62ee09ca | 18 | { |
19 | for (iterator i = GetFileSystems().begin(); i != GetFileSystems().end(); ++i) | |
15fab853 | 20 | (*i)->registerWithCacheManager(); |
62ee09ca | 21 | } |
22 | ||
59b2d47f | 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 | ||
81481ec0 | 44 | std::vector<StoreFileSystem *> const & |
59b2d47f | 45 | StoreFileSystem::FileSystems() |
46 | { | |
47 | return GetFileSystems(); | |
48 | } | |
49 | ||
81481ec0 | 50 | std::vector<StoreFileSystem*> & |
59b2d47f | 51 | StoreFileSystem::GetFileSystems() |
52 | { | |
53 | if (!_FileSystems) | |
81481ec0 | 54 | _FileSystems = new std::vector<StoreFileSystem *>; |
59b2d47f | 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 | { | |
385acf91 | 66 | while (!GetFileSystems().empty()) { |
59b2d47f | 67 | StoreFileSystem *fs = GetFileSystems().back(); |
68 | GetFileSystems().pop_back(); | |
69 | fs->done(); | |
70 | } | |
71 | } | |
72 | ||
5d84beb5 EB |
73 | StoreFileSystem * |
74 | StoreFileSystem::FindByType(const char *type) | |
75 | { | |
76 | for (const auto fs: FileSystems()) { | |
77 | if (strcasecmp(type, fs->type()) == 0) | |
78 | return fs; | |
79 | } | |
80 | return nullptr; | |
81 | } | |
82 | ||
62ee09ca | 83 | /* no filesystem is required to export statistics */ |
84 | void | |
15fab853 | 85 | StoreFileSystem::registerWithCacheManager(void) |
62ee09ca | 86 | {} |
f53969cc | 87 |