Migrated cowfs_t to INIT/METHOD macros.
This commit is contained in:
+17
-21
@@ -835,10 +835,8 @@ static struct fuse_operations cowfs_operations = {
|
|||||||
.init = cowfs_init,
|
.init = cowfs_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(cowfs_t, add_overlay, bool,
|
||||||
* Implementation of cowfs_t.add_overlay.
|
private_cowfs_t *this, char *path)
|
||||||
*/
|
|
||||||
static bool add_overlay(private_cowfs_t *this, char *path)
|
|
||||||
{
|
{
|
||||||
overlay_t *over = malloc_thing(overlay_t);
|
overlay_t *over = malloc_thing(overlay_t);
|
||||||
over->fd = open(path, O_RDONLY | O_DIRECTORY);
|
over->fd = open(path, O_RDONLY | O_DIRECTORY);
|
||||||
@@ -856,10 +854,8 @@ static bool add_overlay(private_cowfs_t *this, char *path)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(cowfs_t, del_overlay, bool,
|
||||||
* Implementation of cowfs_t.del_overlay.
|
private_cowfs_t *this, char *path)
|
||||||
*/
|
|
||||||
static bool del_overlay(private_cowfs_t *this, char *path)
|
|
||||||
{
|
{
|
||||||
bool removed;
|
bool removed;
|
||||||
char real[PATH_MAX];
|
char real[PATH_MAX];
|
||||||
@@ -869,10 +865,8 @@ static bool del_overlay(private_cowfs_t *this, char *path)
|
|||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(cowfs_t, pop_overlay, bool,
|
||||||
* Implementation of cowfs_t.pop_overlay.
|
private_cowfs_t *this)
|
||||||
*/
|
|
||||||
static bool pop_overlay(private_cowfs_t *this)
|
|
||||||
{
|
{
|
||||||
overlay_t *over;
|
overlay_t *over;
|
||||||
this->lock->write_lock(this->lock);
|
this->lock->write_lock(this->lock);
|
||||||
@@ -886,10 +880,8 @@ static bool pop_overlay(private_cowfs_t *this)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(cowfs_t, destroy, void,
|
||||||
* stop, umount and destroy a cowfs FUSE filesystem
|
private_cowfs_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_cowfs_t *this)
|
|
||||||
{
|
{
|
||||||
fuse_exit(this->fuse);
|
fuse_exit(this->fuse);
|
||||||
fuse_unmount(this->mount, this->chan);
|
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)
|
cowfs_t *cowfs_create(char *master, char *host, char *mount)
|
||||||
{
|
{
|
||||||
struct fuse_args args = {0, NULL, 0};
|
struct fuse_args args = {0, NULL, 0};
|
||||||
private_cowfs_t *this = malloc_thing(private_cowfs_t);
|
private_cowfs_t *this;
|
||||||
|
|
||||||
this->public.add_overlay = (bool(*)(cowfs_t*, char *path))add_overlay;
|
INIT(this,
|
||||||
this->public.del_overlay = (bool(*)(cowfs_t*, char *path))del_overlay;
|
.public = {
|
||||||
this->public.pop_overlay = (bool(*)(cowfs_t*))pop_overlay;
|
.add_overlay = _add_overlay,
|
||||||
this->public.destroy = (void(*)(cowfs_t*))destroy;
|
.del_overlay = _del_overlay,
|
||||||
|
.pop_overlay = _pop_overlay,
|
||||||
|
.destroy = _destroy,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this->master_fd = open(master, O_RDONLY | O_DIRECTORY);
|
this->master_fd = open(master, O_RDONLY | O_DIRECTORY);
|
||||||
if (this->master_fd < 0)
|
if (this->master_fd < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user