Hello community,
here is the log from the commit of package fuseiso
checked in at Thu Sep 28 10:29:10 CEST 2006.
--------
--- fuseiso/fuseiso.changes 2006-09-25 09:35:29.000000000 +0200
+++ /mounts/work_src_done/STABLE/fuseiso/fuseiso.changes 2006-09-28 09:36:05.000000000 +0200
@@ -1,0 +2,15 @@
+Thu Sep 28 09:35:26 CEST 2006 - cthiel@suse.de
+
+- update to 20060928
+ * Fixed race-condition with find -- display stable inode numbers on
+ mounted filesystem to the outside world. Added check/addition for
+ library option "use_ino" -- required from now. isofs_real_init() split
+ into two parts to make real initialization/error checking before giving
+ control to libfuse.
+ * Several options added to maintain mount point (create if it does not
+ exists, delete on exit), do NOT maintain file ~/.mtab.fuseiso (with
+ format of /etc/mtab), specify iocharset (default iocharset is now
+ locale-specific).
+ * Added support to mounting NRG-image files created by Nero software.
+
+-------------------------------------------------------------------
Old:
----
fuseiso-20060925.tar.bz2
New:
----
fuseiso-20060928.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ fuseiso.spec ++++++
--- /var/tmp/diff_new_pack.A0Vkhd/_old 2006-09-28 10:28:54.000000000 +0200
+++ /var/tmp/diff_new_pack.A0Vkhd/_new 2006-09-28 10:28:54.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package fuseiso (Version 20060925)
+# spec file for package fuseiso (Version 20060928)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -13,7 +13,7 @@
Name: fuseiso
BuildRequires: fuse-devel glib2-devel
Summary: fuseiso is a FUSE module to mount ISO filesystem images
-Version: 20060925
+Version: 20060928
Release: 1
License: GPL
Group: System/Filesystems
@@ -52,6 +52,18 @@
%{_bindir}/*
%changelog -n fuseiso
+* Thu Sep 28 2006 - cthiel@suse.de
+- update to 20060928
+ * Fixed race-condition with find -- display stable inode numbers on
+ mounted filesystem to the outside world. Added check/addition for
+ library option "use_ino" -- required from now. isofs_real_init() split
+ into two parts to make real initialization/error checking before giving
+ control to libfuse.
+ * Several options added to maintain mount point (create if it does not
+ exists, delete on exit), do NOT maintain file ~/.mtab.fuseiso (with
+ format of /etc/mtab), specify iocharset (default iocharset is now
+ locale-specific).
+ * Added support to mounting NRG-image files created by Nero software.
* Mon Sep 25 2006 - cthiel@suse.de
- update to 20060925 snapshot
* Added support to mounting BIN-image files. One-track only for now.
++++++ fuseiso-20060925.tar.bz2 -> fuseiso-20060928.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/ChangeLog new/fuseiso-20060928/ChangeLog
--- old/fuseiso-20060925/ChangeLog 2006-09-24 17:13:56.000000000 +0200
+++ new/fuseiso-20060928/ChangeLog 2006-09-27 20:48:39.000000000 +0200
@@ -1,3 +1,12 @@
+2006-09-28
+ * all: Fixed race-condition with find -- display stable inode numbers on mounted filesystem to the outside world. Added check/addition for library option "use_ino" -- required from now. isofs_real_init() split into two parts to make real initialization/error checking before giving control to libfuse.
+
+2006-09-27
+ * all: Several options added to maintain mount point (create if it does not exists, delete on exit), do NOT maintain file ~/.mtab.fuseiso (with format of /etc/mtab), specify iocharset (default iocharset is now locale-specific).
+
+2006-09-26
+ * all: Added support to mounting NRG-image files created by Nero software.
+
2006-09-25
* all: Added support to mounting BIN-image files. One-track only for now.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/NEWS new/fuseiso-20060928/NEWS
--- old/fuseiso-20060925/NEWS 2006-09-24 17:14:24.000000000 +0200
+++ new/fuseiso-20060928/NEWS 2006-09-27 19:22:34.000000000 +0200
@@ -1,2 +1,8 @@
+2006-09-27
+ * Added support to maintain ~/.mtab.fuseiso, maintain mount point directory. Added support for iocharset.
+
+2006-09-26
+ * Added support to mounting NRG-image files.
+
2006-09-25
* Added support to mounting BIN-image files. One-track only for now.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/README new/fuseiso-20060928/README
--- old/fuseiso-20060925/README 2006-09-24 17:21:37.000000000 +0200
+++ new/fuseiso-20060928/README 2006-09-27 09:21:06.000000000 +0200
@@ -1,15 +1,35 @@
Usage:
- fuseiso <mountpoint> [<FUSE library options>]
+ fuseiso [<options>] <mountpoint> [<FUSE library options>]
mounts image, while fusermount shipped with FUSE library can be used to unmount:
fusermount -u <mountpoint>
+
+fuseiso options are:
+
+ -p Maintain mountpoint. Create it if it does not exists on start, delete it on exit.
+ -n Do NOT maintain ~/.mtab.fuseiso . This file have format of /etc/mtab and normally stores information about currently mounted iso images.
+ -c iocharset Specify iocharset to use. Joliet filesystem store filenames in unicode and to show them properly they need to be converted to local charset. Default charset is a current locale charset.
-fuseiso supports plain ISO images (created by mkisofs for example) along with BIN images
-containing ISO9660 filesystem. BIN images support have now major limitation --
-fuseiso does not handle .CUE files in any way and thus can work only with
-first track of the BIN image. I don`t know if this is important to support .CUE files
-properly. Please email me if you need it.
+fuseiso supports plain ISO images (created by mkisofs for example), BIN and NRG images
+containing ISO9660 filesystem. Along with standard ISO9660 filesystem it support some common extensions:
+
+Joliet Common in windows world. Allow long filenames stored in unicode.
+RockRidge Common in unix world. Allow long filenames, deep directories, symbolic links and permission bits to be stored.
+zisofs Compressed filesystem, drastically increases capasity of standard CDROM.
+
+In fact i found what CCD (CloneCD) .IMG files along with .MDF (Alcohol 120%) images
+can be mounted without problems because their format looks exactly as .BIN image file format.
+So currently fuseiso supports disk images with following extensions:
+
+.iso
+.img
+.bin
+.mdf
+.nrg
-Status: tested on ISO images and some BIN images. Unfortunately i have no many BIN images to test.
+Although, BIN images support have now major limitation -- fuseiso does not handle .CUE files in any way
+and thus can work only with first track of the BIN image. I don`t know if this is important
+to support .CUE files properly. Please email me if you need it. Support for other types of media
+descriptors like .ccd and .mds looks more difficult task because no one know it`s format.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/configure new/fuseiso-20060928/configure
--- old/fuseiso-20060925/configure 2006-09-24 17:25:39.000000000 +0200
+++ new/fuseiso-20060928/configure 2006-09-27 21:02:45.000000000 +0200
@@ -2218,7 +2218,7 @@
# Define the identity of the package.
PACKAGE=fuseiso
- VERSION=20060925
+ VERSION=20060928
cat >>confdefs.h <<_ACEOF
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/configure.in new/fuseiso-20060928/configure.in
--- old/fuseiso-20060925/configure.in 2006-09-24 17:09:23.000000000 +0200
+++ new/fuseiso-20060928/configure.in 2006-09-27 20:49:07.000000000 +0200
@@ -1,7 +1,7 @@
AC_INIT(configure.in)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(fuseiso, 20060925)
+AM_INIT_AUTOMAKE(fuseiso, 20060928)
AC_LANG_C
AC_PROG_CC
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/fuseiso.spec new/fuseiso-20060928/fuseiso.spec
--- old/fuseiso-20060925/fuseiso.spec 2006-09-24 17:12:39.000000000 +0200
+++ new/fuseiso-20060928/fuseiso.spec 2006-09-27 20:52:06.000000000 +0200
@@ -1,6 +1,6 @@
-%define reldate 20060925
+%define reldate 20060928
Name: fuseiso
-Version: 1.2
+Version: 1.3
Release: 0.%{reldate}%{?dist}
Summary: Mount ISO filesystem images as a non-root user
@@ -17,7 +17,7 @@
%description
Mount ISO filesystem images as a non-root user. Currently supports
plain ISO9660 Level 1 and 2, Rock Ridge, Joliet, zisofs.
-Supported image types: ISO, BIN (single track only).
+Supported image types: ISO, BIN (single track only), NRG, MDF, IMG (CCD).
%prep
%setup -q -n %{name}-%{reldate}
@@ -39,15 +39,18 @@
%files
%defattr(-,root,root,-)
-%doc AUTHORS COPYING INSTALL NEWS README TODO
+%doc AUTHORS COPYING INSTALL NEWS README TODO ChangeLog
%{_bindir}/*
%changelog
-* Fri Feb 17 2006 Dmitry Morozhnikov - 1.0-0.20060925
+* Fri Sep 28 2006 Dmitry Morozhnikov - 1.3-0.20060928
+- Update for 2006-09-28 snapshot.
+
+* Fri Sep 25 2006 Dmitry Morozhnikov - 1.2-0.20060925
- Update for 2006-09-25 snapshot.
-* Fri Feb 17 2006 Dmitry Morozhnikov - 1.0-0.20060731
+* Fri Jul 31 2006 Dmitry Morozhnikov - 1.1-0.20060731
- Update for 2006-07-31 snapshot.
* Fri Feb 17 2006 Dmitry Morozhnikov - 1.0-0.20060217
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/linux/iso_fs.h new/fuseiso-20060928/linux/iso_fs.h
--- old/fuseiso-20060925/linux/iso_fs.h 2006-02-16 22:17:37.000000000 +0100
+++ new/fuseiso-20060928/linux/iso_fs.h 2006-09-27 04:42:10.000000000 +0200
@@ -1,3 +1,12 @@
+// this file was borrowed from linux kernel
+// originally it has name /usr/src/linux/include/linux/iso_fs.h
+// unfortunately there was no copyright header on it,
+// so i`m assume it have copyrighted under terms of
+// GNU GENERAL PUBLIC LICENSE version 2
+// as a whole linux kernel
+// copy of this license included into fuseiso
+// distribution in file COPYING
+
#ifndef _ISOFS_FS_H
#define _ISOFS_FS_H
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/linux/rock.h new/fuseiso-20060928/linux/rock.h
--- old/fuseiso-20060925/linux/rock.h 2005-09-29 00:10:18.000000000 +0200
+++ new/fuseiso-20060928/linux/rock.h 2006-09-27 04:42:00.000000000 +0200
@@ -1,3 +1,13 @@
+// this file was borrowed from linux kernel
+// originally it has name /usr/src/linux/fs/isofs/rock.h
+// unfortunately there was no copyright header on it,
+// so i`m assume it have copyrighted under terms of
+// GNU GENERAL PUBLIC LICENSE version 2
+// as a whole linux kernel
+// copy of this license included into fuseiso
+// distribution in file COPYING
+
+
/* These structs are used by the system-use-sharing protocol, in which the
Rock Ridge extensions are embedded. It is quite possible that other
extensions are present on the disk, and this is fine as long as they
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/src/Makefile.am new/fuseiso-20060928/src/Makefile.am
--- old/fuseiso-20060925/src/Makefile.am 2005-10-09 19:31:15.000000000 +0200
+++ new/fuseiso-20060928/src/Makefile.am 2006-09-27 09:17:37.000000000 +0200
@@ -1,14 +1,11 @@
bin_PROGRAMS = fuseiso
-noinst_PROGRAMS = testiso
fuseiso_SOURCES = fuseiso.c isofs.c
-testiso_SOURCES = testiso.c isofs.c
# set the include path found by configure
INCLUDES= $(all_includes)
# the library search path.
fuseiso_LDFLAGS = $(all_libraries)
-testiso_LDFLAGS = $(all_libraries)
noinst_HEADERS = isofs.h
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 `pkg-config --cflags fuse glib-2.0`
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/src/Makefile.in new/fuseiso-20060928/src/Makefile.in
--- old/fuseiso-20060925/src/Makefile.in 2006-09-24 17:25:38.000000000 +0200
+++ new/fuseiso-20060928/src/Makefile.in 2006-09-27 21:02:43.000000000 +0200
@@ -38,7 +38,6 @@
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = fuseiso$(EXEEXT)
-noinst_PROGRAMS = testiso$(EXEEXT)
subdir = src
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -51,13 +50,10 @@
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+PROGRAMS = $(bin_PROGRAMS)
am_fuseiso_OBJECTS = fuseiso.$(OBJEXT) isofs.$(OBJEXT)
fuseiso_OBJECTS = $(am_fuseiso_OBJECTS)
fuseiso_LDADD = $(LDADD)
-am_testiso_OBJECTS = testiso.$(OBJEXT) isofs.$(OBJEXT)
-testiso_OBJECTS = $(am_testiso_OBJECTS)
-testiso_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -69,8 +65,8 @@
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(fuseiso_SOURCES) $(testiso_SOURCES)
-DIST_SOURCES = $(fuseiso_SOURCES) $(testiso_SOURCES)
+SOURCES = $(fuseiso_SOURCES)
+DIST_SOURCES = $(fuseiso_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -177,14 +173,12 @@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
fuseiso_SOURCES = fuseiso.c isofs.c
-testiso_SOURCES = testiso.c isofs.c
# set the include path found by configure
INCLUDES = $(all_includes)
# the library search path.
fuseiso_LDFLAGS = $(all_libraries)
-testiso_LDFLAGS = $(all_libraries)
noinst_HEADERS = isofs.h
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 `pkg-config --cflags fuse glib-2.0`
AM_LDFLAGS = `pkg-config --libs fuse glib-2.0` -lz
@@ -249,19 +243,9 @@
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-
-clean-noinstPROGRAMS:
- @list='$(noinst_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
fuseiso$(EXEEXT): $(fuseiso_OBJECTS) $(fuseiso_DEPENDENCIES)
@rm -f fuseiso$(EXEEXT)
$(LINK) $(fuseiso_LDFLAGS) $(fuseiso_OBJECTS) $(fuseiso_LDADD) $(LIBS)
-testiso$(EXEEXT): $(testiso_OBJECTS) $(testiso_DEPENDENCIES)
- @rm -f testiso$(EXEEXT)
- $(LINK) $(testiso_LDFLAGS) $(testiso_OBJECTS) $(testiso_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -271,7 +255,6 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fuseiso.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isofs.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testiso.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -412,8 +395,7 @@
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-generic clean-libtool \
- clean-noinstPROGRAMS mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -462,17 +444,16 @@
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic clean-libtool clean-noinstPROGRAMS ctags \
- distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-exec install-exec-am \
- install-info install-info-am install-man install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-binPROGRAMS \
- uninstall-info-am
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/src/fuseiso.c new/fuseiso-20060928/src/fuseiso.c
--- old/fuseiso-20060925/src/fuseiso.c 2006-01-07 05:17:57.000000000 +0100
+++ new/fuseiso-20060928/src/fuseiso.c 2006-09-27 20:46:28.000000000 +0200
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2005 by Dmitry Morozhnikov *
+ * Copyright (C) 2005, 2006 by Dmitry Morozhnikov *
* dmiceman@mail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -30,6 +30,11 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
#include
@@ -37,6 +42,8 @@
#include
#include
+#include
+#include
#include "isofs.h"
@@ -47,8 +54,165 @@
#endif
static char *imagefile = NULL;
+static char *mount_point = NULL;
static int image_fd = -1;
+int maintain_mount_point;
+int maintain_mtab;
+char* iocharset;
+
+char* normalize_name(const char* fname) {
+ char* abs_fname = (char *) malloc(PATH_MAX);
+ char* buf = realpath(fname, abs_fname);
+ // ignore errors from realpath()
+ return abs_fname;
+};
+
+int check_mount_point() {
+ struct stat st;
+ int rc = lstat(mount_point, &st);
+ if(rc == -1 && errno == ENOENT) {
+ // directory does not exists, createcontext
+ rc = mkdir(mount_point, 0777); // let`s underlying filesystem manage permissions
+ if(rc != 0) {
+ perror("Can`t create mount point");
+ return -EIO;
+ };
+ } else if(rc == -1) {
+ perror("Can`t check mount point");
+ return -1;
+ };
+ return 0;
+};
+
+void del_mount_point() {
+ int rc = rmdir(mount_point);
+ if(rc != 0) {
+ perror("Can`t delete mount point");
+ };
+};
+
+char* get_mtab_path() {
+ char* mtab_path = (char*) malloc(PATH_MAX);
+ uid_t uid = getuid();
+ struct passwd* passwd = getpwuid(uid);
+ if(!passwd) {
+ fprintf(stderr, "Can`t get home directory for user %d: %s\n", uid, strerror(errno));
+ return NULL;
+ };
+ mtab_path[0] = 0;
+ if(passwd->pw_dir) { // may be NULL, who know..
+ strncpy(mtab_path, passwd->pw_dir, PATH_MAX - 16);
+ mtab_path[PATH_MAX - 1] = 0;
+ };
+ strcat(mtab_path, "/.mtab.fuseiso");
+ return mtab_path;
+};
+
+int add_mtab_record() {
+ int rc;
+ char* mtab_path = get_mtab_path();
+ if(!mtab_path) {
+ return -EIO;
+ };
+ int fd = open(mtab_path, O_RDWR | O_CREAT, 0644);
+ if(fd < 0) {
+ perror("Can`t open mtab");
+ return -EIO;
+ };
+ rc = lockf(fd, F_LOCK, 0);
+ if(rc != 0) {
+ perror("Can`t lock mtab");
+ return -EIO;
+ };
+ FILE* mtab = setmntent(mtab_path, "a");
+ if(!mtab) {
+ perror("Can`t open mtab");
+ return -EIO;
+ };
+ struct mntent ent;
+ ent.mnt_fsname = imagefile;
+ ent.mnt_dir = mount_point;
+ ent.mnt_type = "fuseiso";
+ ent.mnt_opts = "defaults";
+ ent.mnt_freq = 0;
+ ent.mnt_passno = 0;
+ rc = addmntent(mtab, &ent);
+ if(rc != 0) {
+ perror("Can`t add mtab entry");
+ return -EIO;
+ };
+ endmntent(mtab);
+ rc = lockf(fd, F_ULOCK, 0);
+ if(rc != 0) {
+ perror("Can`t unlock mtab");
+ return -EIO;
+ };
+ close(fd);
+ free(mtab_path);
+ return 0;
+};
+
+int del_mtab_record() {
+ int rc;
+ char* mtab_path = get_mtab_path();
+ char new_mtab_path[PATH_MAX];
+ if(!mtab_path) {
+ return -EIO;
+ };
+ int fd = open(mtab_path, O_RDWR | O_CREAT, 0644);
+ if(fd < 0) {
+ perror("Can`t open mtab");
+ return -EIO;
+ };
+ rc = lockf(fd, F_LOCK, 0);
+ if(rc != 0) {
+ perror("Can`t lock mtab");
+ return -EIO;
+ };
+ strncpy(new_mtab_path, mtab_path, PATH_MAX - 16);
+ new_mtab_path[PATH_MAX - 1] = 0;
+ strcat(new_mtab_path, ".new");
+ FILE* mtab = setmntent(mtab_path, "r");
+ if(!mtab) {
+ perror("Can`t open mtab");
+ return -EIO;
+ };
+ FILE* new_mtab = setmntent(new_mtab_path, "a+");
+ if(!new_mtab) {
+ perror("Can`t open new mtab");
+ return -EIO;
+ };
+ struct mntent* ent;
+ while((ent = getmntent(mtab)) != NULL) {
+ if(strcmp(ent->mnt_fsname, imagefile) == 0 &&
+ strcmp(ent->mnt_dir, mount_point) == 0 &&
+ strcmp(ent->mnt_type, "fuseiso") == 0) {
+ // skip
+ } else {
+ rc = addmntent(new_mtab, ent);
+ if(rc != 0) {
+ perror("Can`t add mtab entry");
+ return -EIO;
+ };
+ };
+ };
+ endmntent(mtab);
+ endmntent(new_mtab);
+ rc = rename(new_mtab_path, mtab_path);
+ if(rc != 0) {
+ perror("Can`t rewrite mtab");
+ return -EIO;
+ };
+ rc = lockf(fd, F_ULOCK, 0);
+ if(rc != 0) {
+ perror("Can`t unlock mtab");
+ return -EIO;
+ };
+ close(fd);
+ free(mtab_path);
+};
+
static int isofs_getattr(const char *path, struct stat *stbuf)
{
return isofs_real_getattr(path, stbuf);
@@ -74,7 +238,21 @@
};
static void* isofs_init() {
- return isofs_real_init(imagefile, image_fd);
+ int rc;
+ if(maintain_mtab) {
+ rc = add_mtab_record();
+ if(rc != 0) {
+ exit(EXIT_FAILURE);
+ };
+ };
+ return isofs_real_init();
+};
+
+static void isofs_destroy(void* param) {
+ if(maintain_mtab) {
+ del_mtab_record();
+ };
+ return;
};
static int isofs_opendir(const char *path, struct fuse_file_info *UNUSED(fi)) {
@@ -98,38 +276,139 @@
.read = isofs_read,
.flush = isofs_flush,
.init = isofs_init,
+ .destroy = isofs_destroy,
.opendir = isofs_opendir,
.readdir = isofs_readdir,
.statfs = isofs_statfs,
};
+void usage(const char* prog) {
+ printf("Version: %s\nUsage: %s [-n] [-p] [-c <iocharset>] [-h] [<FUSE library options>]\n"
+ "Where options are:\n"
+ " -n -- do NOT maintain file $HOME/.mtab.fuseiso\n"
+ " -p -- maintain mount point; \n"
+ " create it if it does not exists and delete it on exit\n"
+ " -c <iocharset> -- specify iocharset for Joliet filesystem\n"
+ " -h -- print this screen\n"
+ "\nCommon FUSE library options are:\n"
+ " -f -- run in foreground, do not daemonize\n"
+ " -d -- run in foreground and print debug information\n"
+ " -s -- run single-threaded\n"
+ "\nPlease consult with FUSE ducumentation for more information\n",
+ VERSION,
+ prog);
+};
+
int main(int argc, char *argv[])
{
- if(argc < 3) {
- printf("Version: %s\nUsage: %s [<FUSE library options>]\n",
- VERSION,
- argv[0]);
- exit(EINVAL);
+ setlocale(LC_ALL, ""); // set current locale for proper iocharset
+
+ // defaults
+ maintain_mount_point = 0;
+ maintain_mtab = 1;
+ iocharset = NULL;
+
+ char c;
+ while((c = getopt(argc, argv, "+npc:h")) > 0) {
+ switch(c) {
+ case 'n':
+ maintain_mtab = 0;
+ break;
+ case 'p':
+ maintain_mount_point = 1;
+ break;
+ case 'c':
+ if(optarg) {
+ iocharset = optarg;
+ };
+ break;
+ case 'h':
+ usage(argv[0]);
+ exit(0);
+ break;
+ case '?':
+ case ':':
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+ break;
+ };
};
- imagefile = argv[1];
+ if((argc - optind) < 2) {
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+ };
+
+ imagefile = normalize_name(argv[optind]);
image_fd = open(imagefile, O_RDONLY);
if(image_fd == -1) {
- perror("open image file");
- exit(EINVAL);
+ perror("Can`t open image file");
+ exit(EXIT_FAILURE);
};
-
- char **nargv = (char **) malloc(argc * sizeof(char *));
- int nargc = argc - 1;
+
+ mount_point = normalize_name(argv[optind + 1]);
+
+ // with space for possible -o use_ino arguments
+ char **nargv = (char **) malloc((argc + 2) * sizeof(char *));
+ int nargc = argc - optind;
nargv[0] = argv[0];
int i;
+ int next_opt = 0;
+ int use_ino_found = 0;
+ for(i = 0; i < nargc - 1; ++i) {
+ if(next_opt && !use_ino_found) {
+ if(strstr(argv[i + optind + 1], "use_ino")) { // ok, already there
+ use_ino_found = 1;
+ nargv[i + 1] = argv[i + optind + 1];
+ } else { // add it
+ char* str = (char*) malloc(strlen(argv[i + optind + 1]) + 10);
+ strcpy(str, argv[i + optind + 1]);
+ strcat(str, ",use_ino");
+ nargv[i + 1] = str;
+ use_ino_found = 1;
+ };
+ } else {
+ nargv[i + 1] = argv[i + optind + 1];
+ };
+ // check if this is -o string mean that next argument should be options string
+ if(i > 1 && nargv[i + 1][0] == '-' && nargv[i + 1][1] == 'o') {
+ next_opt = 1;
+ };
+ };
+ if(!use_ino_found) {
+ nargv[nargc] = "-o";
+ nargc++;
+ nargv[nargc] = "use_ino";
+ nargc++;
+ };
- for(i = 0; i < nargc; i++) {
- nargv[i + 1] = argv[i + 2];
+ if(!iocharset) {
+ iocharset = nl_langinfo(CODESET);
+ if(!iocharset) {
+ iocharset = "UTF-8";
+ };
};
+ int rc;
+ if(maintain_mount_point) {
+ rc = check_mount_point();
+ if(rc != 0) {
+ exit(EXIT_FAILURE);
+ };
+ };
+ if(maintain_mount_point) {
+ rc = atexit(del_mount_point);
+ if(rc != 0) {
+ fprintf(stderr, "Can`t set exit function\n");
+ exit(EXIT_FAILURE);
+ }
+ };
+
+ // will exit in case of failure
+ rc = isofs_real_preinit(imagefile, image_fd);
+
return fuse_main(nargc, nargv, &isofs_oper);
-}
+};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/src/isofs.c new/fuseiso-20060928/src/isofs.c
--- old/fuseiso-20060925/src/isofs.c 2006-09-24 15:18:06.000000000 +0200
+++ new/fuseiso-20060928/src/isofs.c 2006-09-27 21:07:05.000000000 +0200
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2005 by Dmitry Morozhnikov *
+ * Copyright (C) 2005, 2006 by Dmitry Morozhnikov *
* dmiceman@mail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -47,7 +47,9 @@
static int isofs_check_rr(struct iso_directory_record *root_record);
static int isofs_read_raw_block(int block, char *buf);
-void *isofs_real_init( char* imagefile, int fd) {
+extern char* iocharset;
+
+int isofs_real_preinit( char* imagefile, int fd) {
memset(& context, 0, sizeof(isofs_context));
@@ -57,19 +59,30 @@
// trying to read all volume descriptors
struct iso_volume_descriptor *vd =
(struct iso_volume_descriptor *) malloc(sizeof(struct iso_volume_descriptor));
+ if(!vd) {
+ perror("Can`t malloc: ");
+ exit(ENOMEM);
+ };
int vd_num = 0;
+ // defaults for iso
+ context.block_size = 2048;
+ context.data_size = 2048;
+ context.block_offset = 0;
+ context.file_offset = 0;
+
enum {
IDOFF_ISO_2048 = 2048 * 16,
IDOFF_MODE1_2352 = 2352 * 16 + 16,
IDOFF_MODE2_2352_RAW = 2352 * 16,
IDOFF_MODE2_2352 = 2352 * 16 + 24,
IDOFF_MODE2_2336 = 2336 * 16 + 16,
+ IDOFF_NRG = 2048 * 16 + 307200,
};
- int iso_offsets[] = {IDOFF_ISO_2048, IDOFF_MODE2_2336, IDOFF_MODE2_2352_RAW};
+ int iso_offsets[] = {IDOFF_ISO_2048, IDOFF_MODE2_2336, IDOFF_MODE2_2352_RAW, IDOFF_NRG};
// try to find CD001 identifier
int i;
- for(i = 0; i < 5; i++) {
+ for(i = 0; i < 4; i++) {
if(lseek(fd, iso_offsets[i], SEEK_SET) == -1) {
perror("can`t lseek() to next possible data start position; is it really supported file?");
exit(EIO);
@@ -87,20 +100,18 @@
switch(iso_offsets[i]) {
case IDOFF_ISO_2048:
// normal iso file
- context.block_size = 2048;
- context.data_size = 2048;
- context.block_offset = 0;
+ // use defaults
break;
case IDOFF_MODE2_2352_RAW:
context.block_size = 2352;
- context.data_size = 2048;
- context.block_offset = 0;
break;
case IDOFF_MODE2_2336:
context.block_size = 2336;
- context.data_size = 2048;
context.block_offset = 16;
break;
+ case IDOFF_NRG:
+ context.file_offset = 307200;
+ break;
default:
break;
};
@@ -108,13 +119,11 @@
} else if(strncmp("CD001", vd->id + 16, 5) == 0) {
context.id_offset = iso_offsets[i] + 16;
context.block_size = 2352;
- context.data_size = 2048;
context.block_offset = 16;
break;
} else if(strncmp("CD001", vd->id + 24, 5) == 0) {
context.id_offset = iso_offsets[i] + 24;
context.block_size = 2352;
- context.data_size = 2048;
context.block_offset = 24;
break;
};
@@ -122,22 +131,9 @@
/* printf("CD001 found at %d, bs %d, boff %d, ds %d\n",
context.id_offset, context.block_size, context.block_offset, context.data_size);*/
- if(context.block_size == 2048) {
- printf("ISO9660 image found\n");
- } else if(context.block_size == 2352 && context.block_offset == 0) {
- printf("MODE2 RAW BIN image found\n");
- } else if(context.block_size == 2352 && context.block_offset == 16) {
- printf("MODE1 BIN image found\n");
- } else if(context.block_size == 2352 && context.block_offset == 24) {
- printf("MODE2 BIN image found\n");
- } else if(context.block_size == 2336 && context.block_offset == 16) {
- printf("MODE2/2336 BIN image found\n");
- } else {
- printf("UNKNOWN image found; probably will not work\n");
- };
-
while(1) {
- if(lseek(fd, context.block_size * (16 + vd_num) + context.block_offset, SEEK_SET) == -1) {
+ if(lseek(fd, context.block_size * (16 + vd_num) +
+ context.block_offset + context.file_offset, SEEK_SET) == -1) {
perror("can`t lseek() to next volume descriptor");
exit(EIO);
};
@@ -178,7 +174,8 @@
if(context.block_size != 2048) {
// report unusual data block size
- printf("Data block size: %d\n", context.block_size);
+ // later
+ // printf("Data block size: %d\n", context.block_size);
};
if(isofs_check_rr(context.root)) {
@@ -226,12 +223,12 @@
context.root = (struct iso_directory_record *) context.sd.root_directory_record;
- printf("init: switching to supplementary descriptor %d, joliet_level %d, have_rr %d\n",
- vd_num, context.joliet_level, have_rr);
+ // printf("init: switching to supplementary descriptor %d, joliet_level %d, have_rr %d\n",
+ // vd_num, context.joliet_level, have_rr);
} else {
context.joliet_level = 0;
- printf("init: found supplementary descriptor %d, flags %d\n",
- vd_num, isonum_711(sd->flags));
+ // printf("init: found supplementary descriptor %d, flags %d\n",
+ // vd_num, isonum_711(sd->flags));
};
};
};
@@ -262,20 +259,6 @@
exit(EIO);
};
- printf("System Identifier : %.32s\n", context.pd.system_id);
- printf("Volume Identifier : %.32s\n", context.pd.volume_id);
- printf("Volume Set Identifier : %.128s\n", context.pd.volume_set_id);
- printf("Publisher Identifier : %.128s\n", context.pd.publisher_id);
- printf("Data Preparer Identifier : %.128s\n", context.pd.preparer_id);
- printf("Application Identifier : %.128s\n", context.pd.application_id);
- printf("Copyright File Identifier : %.37s\n", context.pd.copyright_file_id);
- printf("Abstract File Identifier : %.37s\n", context.pd.abstract_file_id);
- printf("Bibliographic File Identifier : %.37s\n", context.pd.bibliographic_file_id);
- printf("Volume Creation Date and Time : %.17s\n", context.pd.creation_date);
- printf("Volume Modification Date and Time : %.17s\n", context.pd.modification_date);
- printf("Volume Expiration Date and Time : %.17s\n", context.pd.expiration_date);
- printf("Volume Effective Date and Time : %.17s\n", context.pd.effective_date);
-
context.susp = 0;
context.susp_skip = 0;
@@ -283,16 +266,83 @@
negative_lookup_table = g_hash_table_new(g_str_hash, g_str_equal);
isofs_inode *inode = (isofs_inode *) malloc(sizeof(isofs_inode));
+ if(!inode) {
+ perror("Can`t malloc: ");
+ exit(ENOMEM);
+ };
memset(inode, 0, sizeof(isofs_inode));
inode->record = context.root;
+ context.last_ino++; // set to 1
+ inode->st_ino = context.last_ino;
+ context.last_ino++;
g_hash_table_insert(lookup_table, "/", inode);
- return (void *) & context;
+
+ return 0;
+};
+
+static char* dstr(char* str, const char* src, int len) {
+ int i;
+ strncpy(str, src, len);
+ str[len] = '\0';
+ for(i = len - 1; i >= 0; --i) {
+ if(str[i] == '\0' || str[i] == ' ' || str[i] == '\t' || str[i] == '\r' || str[i] == '\n') {
+ str[i] = '\0';
+ } else {
+ return str;
+ };
+ };
+ return str;
+};
+
+void* isofs_real_init() {
+ if(context.file_offset == 307200) {
+ printf("NRG image found\n");
+ } else if(context.block_size == 2048) {
+ printf("ISO9660 image found\n");
+ } else if(context.block_size == 2352 && context.block_offset == 0) {
+ printf("MODE2 RAW BIN image found\n");
+ } else if(context.block_size == 2352 && context.block_offset == 16) {
+ printf("MODE1 BIN image found (or CCD MODE1 image, or MDF image)\n");
+ } else if(context.block_size == 2352 && context.block_offset == 24) {
+ printf("MODE2 BIN image found (or CCD MODE2 image)\n");
+ } else if(context.block_size == 2336 && context.block_offset == 16) {
+ printf("MODE2/2336 BIN image found\n");
+ } else {
+ printf("UNKNOWN image found; probably will not work\n");
+ };
+
+ if(context.block_size != 2048) {
+ // report unusual data block size
+ printf("Data block size: %d\n", context.block_size);
+ };
+
+ char buf[129];
+
+ printf("System Identifier : %s\n", dstr(buf, context.pd.system_id, 32));
+ printf("Volume Identifier : %.32s\n", dstr(buf, context.pd.volume_id, 32));
+ printf("Volume Set Identifier : %.128s\n", dstr(buf, context.pd.volume_set_id, 128));
+ printf("Publisher Identifier : %.128s\n", dstr(buf, context.pd.publisher_id, 128));
+ printf("Data Preparer Identifier : %.128s\n", dstr(buf, context.pd.preparer_id, 128));
+ printf("Application Identifier : %.128s\n", dstr(buf, context.pd.application_id, 128));
+ printf("Copyright File Identifier : %.37s\n", dstr(buf, context.pd.copyright_file_id, 37));
+ printf("Abstract File Identifier : %.37s\n", dstr(buf, context.pd.abstract_file_id, 37));
+ printf("Bibliographic File Identifier : %.37s\n", dstr(buf, context.pd.bibliographic_file_id, 37));
+ printf("Volume Creation Date and Time : %.17s\n", dstr(buf, context.pd.creation_date, 17));
+ printf("Volume Modification Date and Time : %.17s\n", dstr(buf, context.pd.modification_date, 17));
+ printf("Volume Expiration Date and Time : %.17s\n", dstr(buf, context.pd.expiration_date, 17));
+ printf("Volume Effective Date and Time : %.17s\n", dstr(buf, context.pd.effective_date, 17));
+
+ return (void*) &context;
};
static int isofs_check_rr(struct iso_directory_record *root_record) {
int extent = isonum_733(root_record->extent);
char *buf = (char *) malloc(context.data_size); // can we use "standard" 2048 there?
+ if(!buf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
int rc = isofs_read_raw_block(extent, buf);
if(rc < 0) {
@@ -406,7 +456,7 @@
};
static int isofs_read_raw_block(int block, char *buf) {
- off_t off = block * context.block_size + context.block_offset;
+ off_t off = block * context.block_size + context.block_offset + context.file_offset;
if(pthread_mutex_lock(& fd_mutex)) {
int err = errno;
perror("isofs_read_raw_block: can`l lock fd_mutex");
@@ -463,6 +513,13 @@
static int isofs_direntry2stat(struct stat *st, isofs_inode *inode) {
struct iso_directory_record *record = inode->record;
+ // fill st_ino from block number where file start
+ // since there is no files begin in the same block
+ // st->st_ino = isonum_733(record->extent);
+ // but some iso images save space by sharing content between several files
+ // so it is better to save it unique
+ st->st_ino = inode->st_ino;
+
if(inode->ZF) { // compressed file, report real (uncompressed) size
st->st_size = inode->real_size;
} else { // no zisofs compression
@@ -532,8 +589,7 @@
return entry;
} else {
// initialize iconv descriptor
- /// TODO BIG FAT TODO: find resulting codepage from current locale
- iconv_t cd = iconv_open("UTF-8", "UCS-2BE");
+ iconv_t cd = iconv_open(iocharset, "UCS-2BE");
if(cd < 0) {
perror("iconv");
return NULL;
@@ -543,6 +599,10 @@
size_t inbytesleft = len;
char *outbuf = (char *) malloc(NAME_MAX); // this should be sufficient for our purposes
+ if(!outbuf) {
+ perror("Can`t malloc: ");
+ return NULL;
+ };
char *outentry = outbuf;
size_t outbytesleft = NAME_MAX;
@@ -596,6 +656,10 @@
static int isofs_parse_zisofs_header(isofs_inode *inode) {
char *buf = (char *) malloc(context.block_size);
+ if(!buf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
int block_num = isonum_733(inode->record->extent);
int len = isofs_read_raw_block(block_num, buf);
@@ -624,6 +688,10 @@
size_t block_table_size = (inode->zf_nblocks + 1) * 4;
if(!inode->zf_blockptr) {
inode->zf_blockptr = (int *) malloc(block_table_size);
+ if(!inode->zf_blockptr) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
};
// copy offset table into memory buffer, maintaining iso9660 block boundaries
@@ -874,6 +942,10 @@
if(!inode->sl) {
inode->sl = (char *) malloc(PATH_MAX);
+ if(!inode->sl) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
};
if(c_separator) {
@@ -977,6 +1049,10 @@
} else {
if(!inode->nm) {
inode->nm = (char *) malloc(NAME_MAX);
+ if(!inode->nm) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
};
strncpy(inode->nm + inode->nm_len, sue->u.NM.name, sue_len - 5);
@@ -1010,6 +1086,10 @@
// read block pointed by CL record and process first directory entry
char *buf = (char *) malloc(context.data_size);
+ if(!buf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
int rc = isofs_read_raw_block(inode->cl_block, buf);
if(rc < 0) {
free(buf);
@@ -1044,6 +1124,10 @@
// ignoring anything from original record
struct iso_directory_record *cl_record =
(struct iso_directory_record *) malloc(sizeof(struct iso_directory_record));
+ if(!cl_record) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
memcpy(cl_record, record, sizeof(struct iso_directory_record));
// drop existing record
@@ -1210,6 +1294,10 @@
// process continuation area if found
if(cont_block) {
char *buf = (char *) malloc(context.data_size);
+ if(!buf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
int rc = isofs_read_raw_block(cont_block, buf);
if(rc < 0) {
free(buf);
@@ -1262,8 +1350,12 @@
int block = isonum_733(current->extent);
char *buf = (char *) malloc(context.data_size);
+ if(!buf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
int rc;
-// printf("path %s, current_size %d, block %d\n", path, current_size, block);
+ // printf("path %s, current_size %d, block %d\n", path, current_size, block);
size_t total_size = 0;
int count = 1;
@@ -1275,6 +1367,12 @@
if(rc < 0) {
return rc;
};
+ if(rc != context.data_size) {
+ // can`t be allowed
+ fprintf(stderr, "readdir: can`t read whole block, read only %d bytes, block %d\n", rc, block);
+ free(buf);
+ return -EIO;
+ };
block_count++;
if(boff > 0) {
@@ -1336,9 +1434,20 @@
};
isofs_inode *inode = (isofs_inode *) malloc(sizeof(isofs_inode));
+ if(!inode) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
memset(inode, 0, sizeof(isofs_inode));
+ inode->st_ino = context.last_ino;
+ context.last_ino++;
+
struct iso_directory_record *n_rec =
(struct iso_directory_record *) malloc (sizeof(struct iso_directory_record));
+ if(!n_rec) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
memcpy(n_rec, record, sizeof(struct iso_directory_record));
inode->record = n_rec;
@@ -1356,6 +1465,10 @@
};
char *entry = (char *) malloc(NAME_MAX);
+ if(!entry) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
if(count == 1) { // . entry ('\0' on disk)
strcpy(entry, ".");
} else if(count == 2) { // .. entry ('\1' on disk)
@@ -1436,10 +1549,13 @@
// fprintf(stderr, "getattr: know nothing about %s\n", path);
return -ENOENT;
} else {
-// printf("getattr: found %s, size %d\n", path, isonum_733(record->size));
+ // printf("getattr: found %s, size %d\n", path, isonum_733(inode->record->size));
};
memset(stbuf, 0, sizeof(struct stat));
isofs_direntry2stat(stbuf, inode);
+/* if(ISO_FLAGS_DIR(inode->record->flags)) {
+ printf("%s %i %i\n", path, (int) stbuf->st_size, stbuf->st_mode);
+ };*/
return 0;
};
@@ -1496,7 +1612,15 @@
};
char *cbuf = (char *) malloc(zf_block_size * 2);
+ if(!cbuf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
char *ubuf = (char *) malloc(zf_block_size);
+ if(!ubuf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
size_t total_size = 0;
size_t size_left = size;
@@ -1625,6 +1749,10 @@
// path, size, (int) offset, fsize, start, end, shift);
char *buf = (char *) malloc(context.data_size);
+ if(!buf) {
+ perror("Can`t malloc: ");
+ return -ENOMEM;
+ };
int i;
size_t total_size = 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/src/isofs.h new/fuseiso-20060928/src/isofs.h
--- old/fuseiso-20060925/src/isofs.h 2006-09-24 02:42:26.000000000 +0200
+++ new/fuseiso-20060928/src/isofs.h 2006-09-27 20:47:47.000000000 +0200
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2005 by Dmitry Morozhnikov *
+ * Copyright (C) 2005, 2006 by Dmitry Morozhnikov *
* dmiceman@mail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -36,6 +36,7 @@
int supplementary; // 1 if supplementary descriptor found and in effect
struct iso_supplementary_descriptor sd;
struct iso_directory_record *root;
+ int file_offset; // offset to begin of useful data (for .nrg files)
int id_offset; // offset to CD001 inside file
size_t block_size; // raw block size
size_t block_offset; // offset from block start to data
@@ -43,11 +44,13 @@
int susp; // parse susp entries
int susp_skip; // skip bytes from susp SP entry
int joliet_level; // joliet extension level (1, 2 or 3)
+ ino_t last_ino;
} isofs_context;
typedef struct _isofs_inode {
struct iso_directory_record *record;
struct stat st;
+ ino_t st_ino;
time_t ctime; // cached value from record->date
char *sl;
size_t sl_len;
@@ -147,6 +150,7 @@
#endif
}
-void *isofs_real_init( char* imagefile, int fd);
+int isofs_real_preinit(char* imagefile, int fd);
+void* isofs_real_init();
#endif // _ISOFS_H
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fuseiso-20060925/src/testiso.c new/fuseiso-20060928/src/testiso.c
--- old/fuseiso-20060925/src/testiso.c 2006-01-07 05:30:23.000000000 +0100
+++ new/fuseiso-20060928/src/testiso.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,90 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Dmitry Morozhnikov *
- * dmiceman@mail.ru *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "isofs.h"
-
-int filler(void *buf, char *name, struct stat *st, off_t off) {
- if(st) {
- printf(
- "%c%c%c%c%c%c%c%c%c ",
- (S_ISDIR(st->st_mode) ? 'd' : '-'),
- ((st->st_mode & S_IRUSR) ? 'r' : '-'),
- ((st->st_mode & S_IWUSR) ? 'w' : '-'),
- ((st->st_mode & S_IXUSR) ? 'x' : '-'),
- ((st->st_mode & S_IRGRP) ? 'r' : '-'),
- ((st->st_mode & S_IWGRP) ? 'w' : '-'),
- ((st->st_mode & S_IXGRP) ? 'x' : '-'),
- ((st->st_mode & S_IROTH) ? 'r' : '-'),
- ((st->st_mode & S_IWOTH) ? 'w' : '-'),
- ((st->st_mode & S_IXOTH) ? 'x' : '-')
- );
- };
- printf("%s\n", name);
- return 0;
-};
-
-static int image_fd = -1;
-
-int main(int argc, char *argv[])
-{
- if(argc < 2) {
- printf("Version: %s\nUsage: %s \n",
- VERSION,
- argv[0]);
- exit(EINVAL);
- };
-
- char *imagefile = argv[1];
-
- image_fd = open(imagefile, O_RDONLY);
- if(image_fd == -1) {
- perror("open image file");
- exit(EINVAL);
- };
-
- isofs_context *context = isofs_real_init(imagefile, image_fd);
-
- printf("primary descriptor type: %d (%s)\n", isonum_711(context->pd.type),
- (isonum_711(context->pd.type) == ISO_VD_PRIMARY ? "OK" : "FAIL!"));
- printf("block size: %d\n", context->block_size);
- printf("size of root directory record: %d\n", isonum_711(context->root->length));
- printf("size of root directory content: %d\n", isonum_733(context->root->size));
-
- int rc = isofs_real_readdir("/", NULL, filler);
- if(rc) {
- errno = -rc;
- perror(NULL);
- return -rc;
- };
-
- return 0;
-}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org