libports: add fuse-exfat

Fixes #942.
This commit is contained in:
Josef Söntgen 2013-11-25 16:14:59 +01:00 committed by Norman Feske
parent 3a0922001b
commit aba67e365f
10 changed files with 160 additions and 0 deletions

View File

@ -0,0 +1 @@
REP_INC_DIR += include/exfat

View File

@ -0,0 +1,12 @@
include $(REP_DIR)/ports/exfat.inc
EXFAT_DIR = $(REP_DIR)/contrib/$(EXFAT)
SRC_C = $(notdir $(EXFAT_DIR)/fuse/main.c)
SRC_CC = init.cc
LIBS = libc libc_block libc_fuse libfuse libexfat
vpath %.c $(EXFAT_DIR)/fuse
vpath %.cc $(REP_DIR)/src/lib/exfat
SHARED_LIB = yes

View File

@ -0,0 +1,16 @@
include $(REP_DIR)/ports/exfat.inc
EXFAT_DIR = $(REP_DIR)/contrib/$(EXFAT)
#FILTER_OUT = win32_io.c
#SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(EXFAT_DIR)/libexfat/*.c)))
SRC_C = $(notdir $(wildcard $(EXFAT_DIR)/libexfat/*.c))
INC_DIR += $(REP_DIR)/include/exfat \
$(EXFAT_DIR)/libexfat
#CC_OPT += -DHAVE_CONFIG_H -DRECORD_LOCKING_NOT_IMPLEMENTED
LIBS += libc
vpath %.c $(EXFAT_DIR)/libexfat

2
libports/ports/exfat.inc Normal file
View File

@ -0,0 +1,2 @@
EXFAT_VERSION = 1.0.1
EXFAT = fuse-exfat-$(EXFAT_VERSION)

35
libports/ports/exfat.mk Normal file
View File

@ -0,0 +1,35 @@
include ports/exfat.inc
EXFAT_TGZ = $(EXFAT).tar.gz
EXFAT_BASE_URL = https://exfat.googlecode.com/files
EXFAT_URL = $(EXFAT_BASE_URL)/$(EXFAT_TGZ)
#
# Interface to top-level prepare Makefile
#
PORTS += exfat
prepare-exfat: $(CONTRIB_DIR)/$(EXFAT) include/exfat
#
# Port-specific local rules
#
$(DOWNLOAD_DIR)/$(EXFAT_TGZ):
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(EXFAT_URL) && touch $@
$(CONTRIB_DIR)/$(EXFAT): $(DOWNLOAD_DIR)/$(EXFAT_TGZ)
$(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@
$(VERBOSE)patch -N -p0 < src/lib/exfat/main.c.patch
#
# Install exfat headers
#
include/exfat:
$(VERBOSE)mkdir -p $@
$(VERBOSE)for i in `find $(CONTRIB_DIR)/$(EXFAT)/libexfat -name *.h`; do \
ln -fs ../../$$i $@; done
clean-exfat:
$(VERBOSE)rm -rf include/exfat
$(VERBOSE)rm -rf $(CONTRIB_DIR)/$(EXFAT)

View File

@ -0,0 +1,5 @@
set mkfs_cmd mkfs.exfat
set mkfs_opts ""
set filesystem fuse_exfat
source ${genode_dir}/libports/run/libc_filesystem_test.inc

View File

@ -0,0 +1,53 @@
/*
* \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;
}
void 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;
}
fh = fuse_new(fc, NULL, &fuse_exfat_ops, sizeof (struct fuse_operations), NULL);
if (fh == 0) {
PERR("libc_fuse_exfat: fuse_new() failed");
return;
}
}
void Fuse::deinit_fs(void)
{
PLOG("libc_fuse_exfat: umount /dev/blkdev...");
exfat_unmount(&ef);
}

View File

@ -0,0 +1,26 @@
Make fuse_operation struct globally accessible and comment-out
main() function.
--- contrib/fuse-exfat-1.0.1/fuse/main.c.orig 2013-11-11 14:34:42.668119109 +0100
+++ contrib/fuse-exfat-1.0.1/fuse/main.c 2013-11-11 14:36:25.728122089 +0100
@@ -296,7 +296,7 @@
exit(1);
}
-static struct fuse_operations fuse_exfat_ops =
+struct fuse_operations fuse_exfat_ops =
{
.getattr = fuse_exfat_getattr,
.truncate = fuse_exfat_truncate,
@@ -403,6 +403,7 @@
return options;
}
+#if 0
int main(int argc, char* argv[])
{
struct fuse_args mount_args = FUSE_ARGS_INIT(0, NULL);
@@ -550,3 +551,4 @@
fuse_destroy(fh);
return 0;
}
+#endif

View File

@ -0,0 +1,5 @@
TARGET = test-libc_fuse_exfat
LIBS = libc libc_log libc_fuse_exfat
SRC_CC = main.cc
vpath %.cc $(PRG_DIR)/../libc_ffat/

View File

@ -0,0 +1,5 @@
TARGET = test-libexfat
LIBS = libc libexfat
SRC_CC = main.cc
vpath main.cc $(PRG_DIR)/..