]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 1996-2025 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 = nullptr; | |
15 | ||
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 | ||
29 | std::vector<StoreFileSystem *> const & | |
30 | StoreFileSystem::FileSystems() | |
31 | { | |
32 | return GetFileSystems(); | |
33 | } | |
34 | ||
35 | std::vector<StoreFileSystem*> & | |
36 | StoreFileSystem::GetFileSystems() | |
37 | { | |
38 | if (!_FileSystems) | |
39 | _FileSystems = new std::vector<StoreFileSystem *>; | |
40 | ||
41 | return *_FileSystems; | |
42 | } | |
43 | ||
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 |