]> git.ipfire.org Git - thirdparty/squid.git/blame_incremental - src/StoreFileSystem.cc
Simplify appending SBuf to String (#2108)
[thirdparty/squid.git] / src / StoreFileSystem.cc
... / ...
CommitLineData
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
14std::vector<StoreFileSystem*> *StoreFileSystem::_FileSystems = nullptr;
15
16void
17StoreFileSystem::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
29std::vector<StoreFileSystem *> const &
30StoreFileSystem::FileSystems()
31{
32 return GetFileSystems();
33}
34
35std::vector<StoreFileSystem*> &
36StoreFileSystem::GetFileSystems()
37{
38 if (!_FileSystems)
39 _FileSystems = new std::vector<StoreFileSystem *>;
40
41 return *_FileSystems;
42}
43
44StoreFileSystem *
45StoreFileSystem::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