2020-02-15 14:11:35 +00:00
|
|
|
#include "webfuse/adapter/impl/mountpoint.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
struct wf_mountpoint
|
|
|
|
{
|
|
|
|
char * path;
|
2020-02-15 14:50:32 +00:00
|
|
|
wf_mountpoint_ondispose_fn * ondispose;
|
2020-02-15 14:11:35 +00:00
|
|
|
};
|
|
|
|
|
2020-02-15 14:50:32 +00:00
|
|
|
static void wf_impl_mountpoint_default_ondispose(
|
|
|
|
struct wf_mountpoint * mountpoint)
|
|
|
|
{
|
|
|
|
(void) mountpoint;
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
2020-02-15 14:11:35 +00:00
|
|
|
struct wf_mountpoint *
|
|
|
|
wf_impl_mountpoint_create(
|
|
|
|
char const * path)
|
|
|
|
{
|
|
|
|
struct wf_mountpoint * mountpoint = malloc(sizeof(struct wf_mountpoint));
|
|
|
|
mountpoint->path = strdup(path);
|
2020-02-15 14:50:32 +00:00
|
|
|
mountpoint->ondispose = &wf_impl_mountpoint_default_ondispose;
|
2020-02-15 14:11:35 +00:00
|
|
|
|
|
|
|
return mountpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
wf_impl_mountpoint_dispose(
|
|
|
|
struct wf_mountpoint * mountpoint)
|
|
|
|
{
|
2020-02-15 14:50:32 +00:00
|
|
|
mountpoint->ondispose(mountpoint);
|
|
|
|
|
2020-02-15 14:11:35 +00:00
|
|
|
free(mountpoint->path);
|
|
|
|
free(mountpoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
char const *
|
|
|
|
wf_impl_mountpoint_get_path(
|
|
|
|
struct wf_mountpoint const * mountpoint)
|
|
|
|
{
|
|
|
|
return mountpoint->path;
|
|
|
|
}
|
2020-02-15 14:50:32 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
wf_impl_mountpoint_set_ondispose(
|
|
|
|
struct wf_mountpoint * mountpoint,
|
|
|
|
wf_mountpoint_ondispose_fn * ondispose)
|
|
|
|
{
|
|
|
|
mountpoint->ondispose = ondispose;
|
|
|
|
}
|