genode/libports/src/lib/exfat/init.cc
Josef Söntgen 9f5c13564c libports: extend FUSE implementation
* add sync method:
  Since file systems tend to have a inbuild caching mechansim we need to
  sync these caches at the end of session when using the fuse_fs server.
  Therefore each FUSE file system port has to implement a Fuse::sync_fs()
  function that executes the necessary actions if requested.

* add symlink check

* allow to check FUSE fs initialization
  This changes the private API of the FUSE implementation. The init_fs
  method now has to return true if the initialization was successful and
  otherwise false. All current users of the API are also changed
  accordingly.

Fixes #1058.
2014-02-28 10:11:09 +01:00

67 lines
1.1 KiB
C++

/*
* \brief libc_fuse_exfat
* \author Josef Soentgen
* \date 2013-11-11
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/printf.h>
#include <fuse_private.h>
extern "C" {
#include <exfat.h>
extern struct fuse_operations fuse_exfat_ops;
struct fuse_chan *fc;
struct fuse *fh;
struct exfat ef;
}
bool Fuse::init_fs(void)
{
PLOG("libc_fuse_exfat: try to mount /dev/blkdev...");
int err = exfat_mount(&ef, "/dev/blkdev", "");
if (err) {
PERR("libc_fuse_exfat: could not mount /dev/blkdev");
return false;
}
fh = fuse_new(fc, NULL, &fuse_exfat_ops, sizeof (struct fuse_operations), NULL);
if (fh == 0) {
PERR("libc_fuse_exfat: fuse_new() failed");
return false;
}
return true;
}
void Fuse::deinit_fs(void)
{
PLOG("libc_fuse_exfat: umount /dev/blkdev...");
exfat_unmount(&ef);
}
void Fuse::sync_fs(void) { }
bool Fuse::support_symlinks(void)
{
return false;
}