1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-09-29 20:20:46 +00:00
falk-werner_webfuse-provider/lib/webfuse/adapter/impl/mountpoint.c

54 lines
1.0 KiB
C
Raw Normal View History

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-16 03:02:23 +00:00
void * user_data;
wf_mountpoint_userdata_dispose_fn * dispose;
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-16 03:02:23 +00:00
mountpoint->user_data = NULL;
mountpoint->dispose = NULL;
2020-02-15 14:11:35 +00:00
return mountpoint;
}
void
wf_impl_mountpoint_dispose(
struct wf_mountpoint * mountpoint)
{
2020-02-16 03:02:23 +00:00
if (NULL != mountpoint->dispose)
{
mountpoint->dispose(mountpoint->user_data);
}
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-16 03:02:23 +00:00
extern void
wf_impl_mountpoint_set_userdata(
struct wf_mountpoint * mountpoint,
2020-02-16 03:02:23 +00:00
void * user_data,
wf_mountpoint_userdata_dispose_fn * dispose)
{
2020-02-16 03:02:23 +00:00
mountpoint->user_data = user_data;
mountpoint->dispose = dispose;
}