aboutsummaryrefslogtreecommitdiffstats
path: root/src/dumm/cowfs.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-10-03 16:19:21 +0200
committerTobias Brunner <tobias@strongswan.org>2011-10-03 16:19:21 +0200
commit59e1c865f41ac27a59f829503db725ff5b644a1f (patch)
tree6c764fbb17b93ae8b35e1919cd1ea0fd086aee60 /src/dumm/cowfs.c
parente6cf719ce92cd9c64834025ff771aded34f04afc (diff)
downloadstrongswan-59e1c865f41ac27a59f829503db725ff5b644a1f.tar.bz2
strongswan-59e1c865f41ac27a59f829503db725ff5b644a1f.tar.xz
Migrated cowfs_t to INIT/METHOD macros.
Diffstat (limited to 'src/dumm/cowfs.c')
-rw-r--r--src/dumm/cowfs.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/dumm/cowfs.c b/src/dumm/cowfs.c
index b92be53e0..f708a293b 100644
--- a/src/dumm/cowfs.c
+++ b/src/dumm/cowfs.c
@@ -835,10 +835,8 @@ static struct fuse_operations cowfs_operations = {
.init = cowfs_init,
};
-/**
- * Implementation of cowfs_t.add_overlay.
- */
-static bool add_overlay(private_cowfs_t *this, char *path)
+METHOD(cowfs_t, add_overlay, bool,
+ private_cowfs_t *this, char *path)
{
overlay_t *over = malloc_thing(overlay_t);
over->fd = open(path, O_RDONLY | O_DIRECTORY);
@@ -856,10 +854,8 @@ static bool add_overlay(private_cowfs_t *this, char *path)
return TRUE;
}
-/**
- * Implementation of cowfs_t.del_overlay.
- */
-static bool del_overlay(private_cowfs_t *this, char *path)
+METHOD(cowfs_t, del_overlay, bool,
+ private_cowfs_t *this, char *path)
{
bool removed;
char real[PATH_MAX];
@@ -869,10 +865,8 @@ static bool del_overlay(private_cowfs_t *this, char *path)
return removed;
}
-/**
- * Implementation of cowfs_t.pop_overlay.
- */
-static bool pop_overlay(private_cowfs_t *this)
+METHOD(cowfs_t, pop_overlay, bool,
+ private_cowfs_t *this)
{
overlay_t *over;
this->lock->write_lock(this->lock);
@@ -886,10 +880,8 @@ static bool pop_overlay(private_cowfs_t *this)
return TRUE;
}
-/**
- * stop, umount and destroy a cowfs FUSE filesystem
- */
-static void destroy(private_cowfs_t *this)
+METHOD(cowfs_t, destroy, void,
+ private_cowfs_t *this)
{
fuse_exit(this->fuse);
fuse_unmount(this->mount, this->chan);
@@ -911,12 +903,16 @@ static void destroy(private_cowfs_t *this)
cowfs_t *cowfs_create(char *master, char *host, char *mount)
{
struct fuse_args args = {0, NULL, 0};
- private_cowfs_t *this = malloc_thing(private_cowfs_t);
-
- this->public.add_overlay = (bool(*)(cowfs_t*, char *path))add_overlay;
- this->public.del_overlay = (bool(*)(cowfs_t*, char *path))del_overlay;
- this->public.pop_overlay = (bool(*)(cowfs_t*))pop_overlay;
- this->public.destroy = (void(*)(cowfs_t*))destroy;
+ private_cowfs_t *this;
+
+ INIT(this,
+ .public = {
+ .add_overlay = _add_overlay,
+ .del_overlay = _del_overlay,
+ .pop_overlay = _pop_overlay,
+ .destroy = _destroy,
+ }
+ );
this->master_fd = open(master, O_RDONLY | O_DIRECTORY);
if (this->master_fd < 0)