]>
Commit | Line | Data |
---|---|---|
59b2d47f | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
59b2d47f | 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 | */ |
bbc27441 | 8 | |
59b2d47f | 9 | #ifndef SQUID_STOREFSUFS_H |
10 | #define SQUID_STOREFSUFS_H | |
11 | ||
63be0a78 | 12 | /** |
13 | \defgroup UFS UFS Storage Filesystem | |
14 | \ingroup FileSystems | |
15 | */ | |
59b2d47f | 16 | |
e1f7507e AJ |
17 | #include "StoreFileSystem.h" |
18 | ||
58373ff8 FC |
19 | class DiskIOModule; |
20 | ||
21 | namespace Fs | |
22 | { | |
23 | namespace Ufs | |
24 | { | |
63be0a78 | 25 | /** |
26 | \ingroup UFS, FileSystems | |
27 | * | |
28 | * Core UFS class. This template provides compile time aliases for | |
26ac0430 | 29 | * ufs/aufs/diskd to ease configuration conversion - each becomes a |
b7717b61 | 30 | * StoreFS module whose createSwapDir method parameterises the common |
31 | * UFSSwapDir with an IO module instance. | |
32 | */ | |
59b2d47f | 33 | template <class TheSwapDir> |
59b2d47f | 34 | class StoreFSufs : public StoreFileSystem |
35 | { | |
59b2d47f | 36 | public: |
37 | static StoreFileSystem &GetInstance(); | |
b9ae18aa | 38 | StoreFSufs(char const *DefaultModuleType, char const *label); |
59b2d47f | 39 | virtual ~StoreFSufs() {} |
40 | ||
41 | virtual char const *type() const; | |
42 | virtual SwapDir *createSwapDir(); | |
43 | virtual void done(); | |
44 | virtual void setup(); | |
63be0a78 | 45 | /** Not implemented */ |
59b2d47f | 46 | StoreFSufs (StoreFSufs const &); |
47 | StoreFSufs &operator=(StoreFSufs const &); | |
48 | ||
49 | protected: | |
b9ae18aa | 50 | DiskIOModule *IO; |
51 | char const *moduleName; | |
59b2d47f | 52 | char const *label; |
53 | }; | |
54 | ||
55 | template <class C> | |
b9ae18aa | 56 | StoreFSufs<C>::StoreFSufs(char const *defaultModuleName, char const *aLabel) : IO(NULL), moduleName(defaultModuleName), label(aLabel) |
59b2d47f | 57 | { |
58 | FsAdd(*this); | |
59 | } | |
60 | ||
61 | template <class C> | |
62 | char const * | |
63 | StoreFSufs<C>::type() const | |
64 | { | |
65 | return label; | |
66 | } | |
67 | ||
68 | template <class C> | |
69 | SwapDir * | |
70 | StoreFSufs<C>::createSwapDir() | |
71 | { | |
b9ae18aa | 72 | C *result = new C(type(), moduleName); |
59b2d47f | 73 | return result; |
74 | } | |
75 | ||
76 | template <class C> | |
77 | void | |
78 | StoreFSufs<C>::done() | |
79 | { | |
59b2d47f | 80 | initialised = false; |
81 | } | |
82 | ||
83 | template <class C> | |
84 | void | |
85 | StoreFSufs<C>::setup() | |
86 | { | |
87 | assert(!initialised); | |
88 | initialised = true; | |
b9ae18aa | 89 | } |
90 | ||
58373ff8 FC |
91 | } /* namespace Ufs */ |
92 | } /* namespace Fs */ | |
93 | ||
59b2d47f | 94 | #endif /* SQUID_STOREFSUFS_H */ |