]> git.ipfire.org Git - thirdparty/squid.git/blob - src/fs/ufs/StoreFSufs.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / fs / ufs / StoreFSufs.h
1 /*
2 * Copyright (C) 1996-2023 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 #ifndef SQUID_SRC_FS_UFS_STOREFSUFS_H
10 #define SQUID_SRC_FS_UFS_STOREFSUFS_H
11
12 /**
13 \defgroup UFS UFS Storage Filesystem
14 \ingroup FileSystems
15 */
16
17 #include "StoreFileSystem.h"
18
19 class DiskIOModule;
20
21 namespace Fs
22 {
23 namespace Ufs
24 {
25 /**
26 \ingroup UFS, FileSystems
27 *
28 * Core UFS class. This template provides compile time aliases for
29 * ufs/aufs/diskd to ease configuration conversion - each becomes a
30 * StoreFS module whose createSwapDir method parameterises the common
31 * UFSSwapDir with an IO module instance.
32 */
33 template <class TheSwapDir>
34 class StoreFSufs : public StoreFileSystem
35 {
36 public:
37 static StoreFileSystem &GetInstance();
38 StoreFSufs(char const *DefaultModuleType, char const *label);
39 ~StoreFSufs() override {}
40
41 /* StoreFileSystem API */
42 const char *type() const override;
43 SwapDir *createSwapDir() override;
44
45 protected:
46 DiskIOModule *IO;
47 char const *moduleName;
48 char const *label;
49 };
50
51 template <class C>
52 StoreFSufs<C>::StoreFSufs(char const *defaultModuleName, char const *aLabel) : IO(nullptr), moduleName(defaultModuleName), label(aLabel)
53 {
54 FsAdd(*this);
55 }
56
57 template <class C>
58 char const *
59 StoreFSufs<C>::type() const
60 {
61 return label;
62 }
63
64 template <class C>
65 SwapDir *
66 StoreFSufs<C>::createSwapDir()
67 {
68 C *result = new C(type(), moduleName);
69 return result;
70 }
71
72 } /* namespace Ufs */
73 } /* namespace Fs */
74
75 #endif /* SQUID_SRC_FS_UFS_STOREFSUFS_H */
76