2 * Copyright (c) [2011-2013] Novell, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as published
8 * by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, contact Novell, Inc.
18 * To contact Novell about this file by physical or electronic mail, you may
19 * find current contact information at www.novell.com.
23 #ifndef SNAPPER_FILESYSTEM_H
24 #define SNAPPER_FILESYSTEM_H
30 #include "snapper/FileUtils.h"
31 #include "snapper/Compare.h"
47 Filesystem(const string& subvolume) : subvolume(subvolume) {}
48 virtual ~Filesystem() {}
50 static Filesystem* create(const string& fstype, const string& subvolume);
52 virtual string fstype() const = 0;
54 virtual void createConfig() const = 0;
55 virtual void deleteConfig() const = 0;
57 virtual string snapshotDir(unsigned int num) const = 0;
59 virtual SDir openSubvolumeDir() const;
60 virtual SDir openInfosDir() const = 0;
61 virtual SDir openInfoDir(unsigned int num) const;
62 virtual SDir openSnapshotDir(unsigned int num) const = 0;
64 virtual void createSnapshot(unsigned int num) const = 0;
65 virtual void deleteSnapshot(unsigned int num) const = 0;
67 virtual bool isSnapshotMounted(unsigned int num) const = 0;
68 virtual void mountSnapshot(unsigned int num) const = 0;
69 virtual void umountSnapshot(unsigned int num) const = 0;
71 virtual bool checkSnapshot(unsigned int num) const = 0;
73 virtual void cmpDirs(const SDir& dir1, const SDir& dir2, cmpdirs_cb_t cb) const;
77 const string subvolume;
79 static vector<string> filter_mount_options(const vector<string>& options);
81 static bool mount(const string& device, int fd, const string& mount_type,
82 const vector<string>& options);
83 static bool umount(int fd, const string& mount_point);