]>
Commit | Line | Data |
---|---|---|
59b2d47f | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 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 | ||
aee3523a | 14 | std::vector<StoreFileSystem*> *StoreFileSystem::_FileSystems = nullptr; |
59b2d47f | 15 | |
59b2d47f | 16 | void |
17 | StoreFileSystem::FsAdd(StoreFileSystem &instance) | |
18 | { | |
19 | iterator i = GetFileSystems().begin(); | |
20 | ||
21 | while (i != GetFileSystems().end()) { | |
22 | assert(strcmp((*i)->type(), instance.type()) != 0); | |
23 | ++i; | |
24 | } | |
25 | ||
26 | GetFileSystems().push_back (&instance); | |
27 | } | |
28 | ||
81481ec0 | 29 | std::vector<StoreFileSystem *> const & |
59b2d47f | 30 | StoreFileSystem::FileSystems() |
31 | { | |
32 | return GetFileSystems(); | |
33 | } | |
34 | ||
81481ec0 | 35 | std::vector<StoreFileSystem*> & |
59b2d47f | 36 | StoreFileSystem::GetFileSystems() |
37 | { | |
38 | if (!_FileSystems) | |
81481ec0 | 39 | _FileSystems = new std::vector<StoreFileSystem *>; |
59b2d47f | 40 | |
41 | return *_FileSystems; | |
42 | } | |
43 | ||
5d84beb5 EB |
44 | StoreFileSystem * |
45 | StoreFileSystem::FindByType(const char *type) | |
46 | { | |
47 | for (const auto fs: FileSystems()) { | |
48 | if (strcasecmp(type, fs->type()) == 0) | |
49 | return fs; | |
50 | } | |
51 | return nullptr; | |
52 | } | |
53 |