]> git.ipfire.org Git - thirdparty/squid.git/blame - src/fs/ufs/StoreFSufs.h
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / fs / ufs / StoreFSufs.h
CommitLineData
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
19class DiskIOModule;
20
21namespace Fs
22{
23namespace 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 33template <class TheSwapDir>
59b2d47f 34class StoreFSufs : public StoreFileSystem
35{
59b2d47f 36public:
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
49protected:
b9ae18aa 50 DiskIOModule *IO;
51 char const *moduleName;
59b2d47f 52 char const *label;
53};
54
55template <class C>
b9ae18aa 56StoreFSufs<C>::StoreFSufs(char const *defaultModuleName, char const *aLabel) : IO(NULL), moduleName(defaultModuleName), label(aLabel)
59b2d47f 57{
58 FsAdd(*this);
59}
60
61template <class C>
62char const *
63StoreFSufs<C>::type() const
64{
65 return label;
66}
67
68template <class C>
69SwapDir *
70StoreFSufs<C>::createSwapDir()
71{
b9ae18aa 72 C *result = new C(type(), moduleName);
59b2d47f 73 return result;
74}
75
76template <class C>
77void
78StoreFSufs<C>::done()
79{
59b2d47f 80 initialised = false;
81}
82
83template <class C>
84void
85StoreFSufs<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 */