From 9ee4e39899a08ac8aec90e478ba575875f81e581 Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Date: Sat, 24 Nov 2007 13:14:45 +0100 Subject: [PATCH] Added build files and first code stub. --- .bzrignore | 23 +++++ .cdtproject | 1 + .project | 19 ++-- Makefile.am | 64 ++++++++++++ NEWS | 1 + README | 256 +++++++++++++++++++++++++++++++++++++++++++++++ TODO | 1 + acinclude.m4 | 22 ++++ bootstrap | 10 ++ configure.ac | 116 +++++++++++++++++++++ libisofs-5.pc.in | 11 ++ src/image.h | 17 ++++ src/libisofs.h | 19 ++++ src/tree.c | 18 ++++ src/tree.h | 80 +++++++++++++++ test/iso.c | 16 +++ version.h.in | 3 + 17 files changed, 669 insertions(+), 8 deletions(-) create mode 100644 .bzrignore create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 acinclude.m4 create mode 100755 bootstrap create mode 100644 configure.ac create mode 100644 libisofs-5.pc.in create mode 100644 src/image.h create mode 100644 src/libisofs.h create mode 100644 src/tree.c create mode 100644 src/tree.h create mode 100644 test/iso.c create mode 100644 version.h.in diff --git a/.bzrignore b/.bzrignore new file mode 100644 index 0000000..3589eae --- /dev/null +++ b/.bzrignore @@ -0,0 +1,23 @@ +./aclocal.m4 +./autom4te.cache +./compile +./config.guess +./config.sub +./configure +./depcomp +./install-sh +./ltmain.sh +./missing +./Makefile.in +./config.log +./config.status +./libtool +Makefile +./libisofs-5.pc +./version.h +.deps +.dirstamp +.libs +test/iso +*.lo +*.la diff --git a/.cdtproject b/.cdtproject index 6a9b5b6..534a026 100644 --- a/.cdtproject +++ b/.cdtproject @@ -51,6 +51,7 @@ + diff --git a/.project b/.project index fa0dbb0..8ebe17c 100644 --- a/.project +++ b/.project @@ -7,7 +7,6 @@ org.eclipse.cdt.make.core.makeBuilder - clean,full,incremental, org.eclipse.cdt.make.core.enableCleanBuild @@ -37,16 +36,16 @@ org.eclipse.cdt.make.core.build.arguments - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - org.eclipse.cdt.make.core.environment - org.eclipse.cdt.make.core.enableFullBuild + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + org.eclipse.cdt.make.core.enableAutoBuild true @@ -54,13 +53,17 @@ all - org.eclipse.cdt.make.core.enableAutoBuild - false + org.eclipse.cdt.make.core.enableFullBuild + true org.eclipse.cdt.make.core.build.target.clean clean + + org.eclipse.cdt.make.core.build.location + + org.eclipse.cdt.core.errorOutputParser org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser; diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..99edae9 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,64 @@ +pkgconfigdir=$(libdir)/pkgconfig +libincludedir=$(includedir)/libisofs + +lib_LTLIBRARIES = src/libisofs.la + +## ========================================================================= ## + +# Build libraries + +src_libisofs_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +src_libisofs_la_SOURCES = \ + src/tree.h \ + src/tree.c \ + src/image.h +libinclude_HEADERS = \ + src/libisofs.h + +## ========================================================================= ## + +## Build test applications +noinst_PROGRAMS = \ + test/iso + +test_iso_CPPFLAGS = -Isrc +test_iso_LDADD = $(src_libisofs_la_OBJECTS) $(THREAD_LIBS) +test_iso_SOURCES = test/iso.c + + +## Build unit test + +#check_PROGRAMS = \ +# test/test + +#test_test_CPPFLAGS = -Ilibisofs +#test_test_LDADD = $(libisofs_libisofs_la_OBJECTS) $(THREAD_LIBS) -lcunit +#test_test_LDFLAGS = -L.. -lm + +#test_test_SOURCES = \ +# test/test_exclude.c + +## ========================================================================= ## + +## Build documentation (You need Doxygen for this to work) +## TODO!! + +## ========================================================================= ## + +# Extra things +nodist_pkgconfig_DATA = \ + libisofs-5.pc + +EXTRA_DIST = \ + libisofs-5.pc.in \ + version.h.in \ + README \ + AUTHORS \ + COPYRIGHT \ + COPYING \ + NEWS \ + INSTALL \ + TODO \ + ChangeLog + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..7001d0f --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +nothing here now diff --git a/README b/README new file mode 100644 index 0000000..704fe87 --- /dev/null +++ b/README @@ -0,0 +1,256 @@ +------------------------------------------------------------------------------ + libburnia-project.org +------------------------------------------------------------------------------ +This all is under GPL. +(See GPL reference, our clarification and commitment at the end of this text) +------------------------------------------------------------------------------ +libburnia-project.org +By Mario Danic and Thomas Schmitt +Copyright (C) 2006-2007 Mario Danic, Thomas Schmitt + +Still containing parts of +Libburn. By Derek Foreman and + Ben Jansens +Copyright (C) 2002-2006 Derek Foreman and Ben Jansens +These parts are to be replaced by own code of above libburnia-project.org +copyright holders and then libburnia-project.org is to be their sole copyright. +This is done to achieve the right to issue the clarification and the +commitment as written at the end of this text. +The rights and merits of the Libburn-copyright holders Derek Foreman and +Ben Jansens will be duely respected. + +This libburnia-project.org toplevel README (C) 2006-2007 Thomas Schmitt +------------------------------------------------------------------------------ + + Build and Installation + +Our build system is based on autotools. For preparing the build of a SVN +snapshot you will need autotools of at least version 1.7. +Check out from SVN by + svn co http://svn.libburnia-project.org/libburn/trunk libburn +go into directory libburn and apply autotools by + ./bootstrap + +Alternatively you may unpack a release tarball for which you do not need +autotools installed. + +To build a libburnia-project.org subproject it should be sufficient to go +into its toplevel directory (here: "libburn") and execute + ./configure --prefix=/usr + make + +To make the libraries accessible for running resp. developing applications + make install + + +The other half of the project, libisofs, is hosted in the libburnia SVN, too: + svn co http://svn.libburnia-project.org/libisofs/trunk libisofs +See README file there. + + +------------------------------------------------------------------------------ + + + Overview of libburnia-project.org + +libburnia-project.org is an open-source software project for reading, mastering +and writing optical discs. +For now this means only CD media and all single layer DVD media except DVD+R. + +The project comprises of several more or less interdependent parts which +together strive to be a usable foundation for application development. +These are libraries, language bindings, and middleware binaries which emulate +classical (and valuable) Linux tools. + +Our scope is currently Linux 2.4 and 2.6 only. For ports to other systems +we would need : login on a development machine resp. a live OS on CD or DVD, +advise from a system person about the equivalent of Linux sg or FreeBSD CAM, +volunteers for testing of realistic use cases. + +We have a workable code base for burning CD and most single layer DVD. +The burn API is quite comprehensively documented and can be used to build a +presentable application. +We have a functional binary which emulates parts of cdrecord in order to +prove that usability, and in order to allow you to explore libburnia's scope +by help of existing cdrecord frontends. + +The project components (list subject to growth, hopefully): + +- libburn is the library by which preformatted data get onto optical media. + It uses either /dev/sgN (e.g. on kernel 2.4 with ide-scsi) or + /dev/hdX (e.g. on kernel 2.6). + libburn is the foundation of our cdrecord emulation. Its code is + independent of cdrecord. Its DVD capabilities are learned from + studying the code of dvd+rw-tools and MMC-5 specs. No code but only + the pure SCSI knowledge has been taken from dvd+rw-tools, though. + +- libisofs is the library to pack up hard disk files and directories into a + ISO 9660 disk image. This may then be brought to media via libburn. + libisofs is to be the foundation of our upcoming mkisofs emulation. + +- cdrskin is a limited cdrecord compatibility wrapper for libburn. + Cdrecord is a powerful GPL'ed burn program included in Joerg + Schilling's cdrtools. cdrskin strives to be a second source for + the services traditionally provided by cdrecord. Additionally it + provides libburn's DVD capabilities, where only -sao is compatible + with cdrecord. + cdrskin does not contain any bytes copied from cdrecord's sources. + Many bytes have been copied from the message output of cdrecord + runs, though. + See cdrskin/README and man cdrskin/cdrskin.1 for more. + +- test is a collection of application gestures and examples given by the + authors of the library features. The main API example for libburn + is test/libburner.c . + Explore these examples if you look for inspiration. + +We plan to be a responsive upstream. Bear with us. We are still practicing. + + +------------------------------------------------------------------------------ +Project history as far as known to me: + +- Founded in 2002 as it seems. See mailing list archives + http://lists.freedesktop.org/archives/libburn/ + The site of this founder team is reachable and offers download of a + (somewhat outdated) tarball and from CVS : + http://icculus.org/burn/ + Copyright holders and most probably founders: + Derek Foreman and Ben Jansens. + +- I came to using libburn in 2005. Founded the cdrskin project and submitted + necessary patches which were accepted or implemented better. Except one + remaining patch which prevented cdrskin from using vanilla libburn from CVS. + The cdrskin project site is reachable and offers download of the heavily + patched (elsewise outdated) tarball under the name cdrskin-0.1.2 : + http://scdbackup.sourceforge.net/cdrskin_eng.html + It has meanwhile moved to use vanilla libburn.pykix.org , though. + Version 0.1.4 constitutes the first release of this kind. + +- In July 2006 our team mate Mario Danic announced a revival of libburn + which by about nearly everybody else was perceived as unfriendly fork. + Derek Foreman four days later posted a message which expressed his + discontent. + The situation first caused me to publically regret it and then - after i + got the opportunity to move in with cdrskin - gave me true reason to + personally apologize to Derek Foreman, Ben Jansens and the contibutors at + icculus.org/burn. Posted to both projects: + http://lists.freedesktop.org/archives/libburn/2006-August/000446.html + http://mailman-mail1.webfaction.com/pipermail/libburn-hackers/2006-August/000024.html + +- Mid August 2006 project cdrskin established a branch office in + libburn.pykix.org so that all maintainers of our tools have one single place + to get the current (at least slightely) usable coordinated versions of + everything. + Project cdrskin will live forth independendly for a while but it is committed + to stay in sync with libburn.pykix.org (or some successor, if ever). + cdrskin is also committed to support icculus.org/burn if the pending fork + is made reality by content changes in that project. It will cease to maintain + a patched version of icculus.org/burn though. Precondition for a new + release of cdrskin on base of icculus.org/burn would be the pending + "whitelist patch" therefore. + I would rather prefer if both projects find consense and merge, or at least + cooperate. I have not given up hope totally, yet. + I, personally, will honor any approach. + +- 2nd September 2006 the decision is made to strive for a consolidation of + copyright and a commitment to GPL in a reasonable and open minded way. + This is to avoid long term problems with code of unknown origin and + with finding consense among the not so clearly defined group of copyright + claimers and -holders. + libisofs is already claimed sole copyright Mario Danic. + cdrskin and libburner are already claimed sole copyright Thomas Schmitt. + Rewrites of other components will follow and concluded by claiming full + copyright within the group of libburn.pykix.org-copyright holders. + +- 16th September 2006 feature freeze for release of libburn-0.2.2 . + +- 20th September 2006 release of libburn-0.2.2 . + +- 26th October 2006 feature freeze for cdrskin-0.2.4 based on libburn-0.2.3 . + This version of cdrskin is much more cdrecord compatible in repect + to drive addressing and audio features. + +- 30th October 2006 release of cdrskin-0.2.4 . + +- 13th November 2006 splitting releases of libburn+cdrskin from libisofs. + +- 24th November 2006 release of libburn-0.2.6 and cdrskin-0.2.6 . cdrskin has + become suitable for unaware frontends as long as they perform only the core + of cdrecord use cases (including open-ended input streams, audio, and + multi-session). + +- 28th November 2006 the umbrella project which encloses both, libisofs and + libburn, is now called libburnia. For the origin of this name, see + http://en.wikipedia.org/wiki/Liburnians . + +- 16th January 2007 release of libburn-0.3.0 and cdrskin-0.3.0 . Now the scope + is widened to a first class of DVD media: overwriteable single layer types + DVD-RAM, DVD+RW, DVD-RW. This is not a cdrecord emulation but rather inspired + by dvd+rw-tools' "poor man" writing facility for this class of media. + Taking a bow towards Andy Polyakov. + +- 11th February 2007 version 0.3.2 covers sequential DVD-RW and DVD-R with + multi-session and with DAO. + +- 12th March 2007 version 0.3.4 supports DVD+R and thus covers all single layer + DVD media. Code for double layer DVD+/-R is implemented but awaits a tester + yet. + +- 23th April 2007 version 0.3.6 follows the unanimous opinion of Linux kernel + people that one should not use /dev/sg on kernel 2.6. + +- 31st July 2007 version 0.3.8 marks the first anniversary of libburn revival. + We look back on improved stability, a substantially extended list of media + and write modes, and better protection against typical user mishaps. + + +------------------------------------------------------------------------------ + + 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. To be exact: version 2 of that License. + + 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 + +------------------------------------------------------------------------------ +Clarification in my name and in the name of Mario Danic, upcoming copyright +holders on toplevel of libburnia. To be fully in effect after the remaining +other copyrighted code has been replaced by ours and by copyright-free +contributions of our friends: +------------------------------------------------------------------------------ + +We, the copyright holders, agree on the interpretation that +dynamical linking of our libraries constitutes "use of" and +not "derivation from" our work in the sense of GPL, provided +those libraries are compiled from our unaltered code. + +Thus you may link our libraries dynamically with applications +which are not under GPL. You may distribute our libraries and +application tools in binary form, if you fulfill the usual +condition of GPL to offer a copy of the source code -altered +or unaltered- under GPL. + +We ask you politely to use our work in open source spirit +and with the due reference to the entire open source community. + +If there should really arise the case where above clarification +does not suffice to fulfill a clear and neat request in open source +spirit that would otherwise be declined for mere formal reasons, +only in that case we will duely consider to issue a special license +covering only that special case. +It is the open source idea of responsible freedom which will be +decisive and you will have to prove that you exhausted all own +means to qualify for GPL. + +For now we are firmly committed to maintain one single license: GPL. + +signed: Mario Danic, Thomas Schmitt + diff --git a/TODO b/TODO index 9f21820..1a1259e 100644 --- a/TODO +++ b/TODO @@ -5,6 +5,7 @@ FEATURES TODO ==== +#00001 (tree.h) -> consider adding new timestamps to IsoTreeNode FIXME ===== diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..861847b --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,22 @@ +AC_DEFUN([TARGET_SHIZZLE], +[ + ARCH="" + + AC_MSG_CHECKING([target operating system]) + + case $target in + *-*-linux*) + ARCH=linux + LIBBURN_ARCH_LIBS= + ;; + *-*-freebsd*) + ARCH=freebsd + LIBBURN_ARCH_LIBS=-lcam + ;; + *) + AC_ERROR([You are attempting to compile for an unsupported platform]) + ;; + esac + + AC_MSG_RESULT([$ARCH]) +]) diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..86709bf --- /dev/null +++ b/bootstrap @@ -0,0 +1,10 @@ +#!/bin/sh -x + +aclocal +libtoolize --copy --force +autoconf + +# ts A61101 : libburn is not prepared for config.h +# autoheader + +automake --foreign --add-missing --copy --include-deps diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..0e027ef --- /dev/null +++ b/configure.ac @@ -0,0 +1,116 @@ +AC_INIT([libisofs], [0.5.0], [http://libburnia-project.org]) +AC_PREREQ([2.50]) +dnl AC_CONFIG_HEADER([config.h]) + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +AM_INIT_AUTOMAKE([subdir-objects]) + +dnl A61101 This breaks Linux build (makes 32 bit off_t) +dnl http://sourceware.org/autobook/autobook/autobook_96.html says +dnl one must include some config.h and this was a pitfall. +dnl So why dig the pit at all ? +dnl AM_CONFIG_HEADER(config.h) + +dnl Making releases: +dnl LIBISOFS_MICRO_VERSION += 1; +dnl LIBISOFS_INTERFACE_AGE += 1; +dnl LIBISOFS_BINARY_AGE += 1; +dnl if any functions have been added, set LIBISOFS_INTERFACE_AGE to 0. +dnl if backwards compatibility has been broken, +dnl set LIBISOFS_BINARY_AGE and LIBISOFS_INTERFACE_AGE to 0. +dnl +dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match +dnl +LIBISOFS_MAJOR_VERSION=0 +LIBISOFS_MINOR_VERSION=5 +LIBISOFS_MICRO_VERSION=0 +LIBISOFS_INTERFACE_AGE=0 +LIBISOFS_BINARY_AGE=0 +LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION + +AC_SUBST(LIBISOFS_MAJOR_VERSION) +AC_SUBST(LIBISOFS_MINOR_VERSION) +AC_SUBST(LIBISOFS_MICRO_VERSION) +AC_SUBST(LIBISOFS_INTERFACE_AGE) +AC_SUBST(LIBISOFS_BINARY_AGE) +AC_SUBST(LIBISOFS_VERSION) + +dnl Libtool versioning +LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION +LT_CURRENT=`expr $LIBISOFS_MICRO_VERSION - $LIBISOFS_INTERFACE_AGE` +LT_REVISION=$LIBISOFS_INTERFACE_AGE +LT_AGE=`expr $LIBISOFS_BINARY_AGE - $LIBISOFS_INTERFACE_AGE` +LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` + +AC_SUBST(LT_RELEASE) +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) +AC_SUBST(LT_CURRENT_MINUS_AGE) + +AC_PREFIX_DEFAULT([/usr/local]) +test "$prefix" = "NONE" && prefix=$ac_default_prefix + +AM_MAINTAINER_MODE + +AM_PROG_CC_C_O +AC_C_CONST +AC_C_INLINE +AC_C_BIGENDIAN + +dnl Large file support +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO +AC_CHECK_FUNC([fseeko]) +if test ! $ac_cv_func_fseeko; then + AC_ERROR([Libisofs requires largefile support.]) +fi + +AC_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) +LIBTOOL="$LIBTOOL --silent" + +AC_PROG_INSTALL + +AC_CHECK_HEADERS() + +AC_CHECK_MEMBER([struct tm.tm_gmtoff], + [AC_DEFINE(HAVE_TM_GMTOFF, 1, + [Define this if tm structure includes a tm_gmtoff entry.])], + , + [#include ]) + +THREAD_LIBS=-lpthread +AC_SUBST(THREAD_LIBS) + +TARGET_SHIZZLE +AC_SUBST(ARCH) +AC_SUBST(LIBBURN_ARCH_LIBS) + +dnl Add compiler-specific flags + +dnl See if the user wants aggressive optimizations of the code +AC_ARG_ENABLE(debug, +[ --enable-debug Disable aggressive optimizations [default=yes]], + , enable_debug=yes) +if test x$enable_debug != xyes; then + if test x$GCC = xyes; then + CFLAGS="$CFLAGS -O3" + CFLAGS="$CFLAGS -fexpensive-optimizations" + fi + CFLAGS="$CFLAGS -DNDEBUG" +else + if test x$GCC = xyes; then + CFLAGS="$CFLAGS -g -pedantic -Wall" + fi + CFLAGS="$CFLAGS -DDEBUG" +fi + +AC_CONFIG_FILES([ + Makefile + version.h + libisofs-5.pc + ]) +AC_OUTPUT diff --git a/libisofs-5.pc.in b/libisofs-5.pc.in new file mode 100644 index 0000000..4cf18c1 --- /dev/null +++ b/libisofs-5.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libisofs +Description: ISO9660 filesystem creation library +Version: @VERSION@ +Requires: +Libs: -L${libdir} -lisofs +Cflags: -I${includedir}/libisofs diff --git a/src/image.h b/src/image.h new file mode 100644 index 0000000..bec1d8c --- /dev/null +++ b/src/image.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2007 Vreixo Formoso + * + * This file is part of the libisofs project; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See COPYING file for details. + */ +#ifndef LIBISO_IMAGE_H_ +#define LIBISO_IMAGE_H_ + + +struct IsoImage { + + +}; + +#endif /*LIBISO_IMAGE_H_*/ diff --git a/src/libisofs.h b/src/libisofs.h new file mode 100644 index 0000000..234ca11 --- /dev/null +++ b/src/libisofs.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2007 Vreixo Formoso + * + * This file is part of the libisofs project; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See COPYING file for details. + */ +#ifndef LIBISO_LIBISOFS_H_ +#define LIBISO_LIBISOFS_H_ + +typedef struct Iso_Tree_Node IsoTreeNode; + +/** + * Increments the reference counting of the given node. + */ +void iso_node_ref(IsoTreeNode *node); + + +#endif /*LIBISO_LIBISOFS_H_*/ diff --git a/src/tree.c b/src/tree.c new file mode 100644 index 0000000..c35d53f --- /dev/null +++ b/src/tree.c @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2007 Vreixo Formoso + * + * This file is part of the libisofs project; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See COPYING file for details. + */ + +#include "tree.h" +#include "libisofs.h" + + +/** + * Increments the reference counting of the given node. + */ +void iso_node_ref(IsoTreeNode *node) { + node->refcount++; +} diff --git a/src/tree.h b/src/tree.h new file mode 100644 index 0000000..0636200 --- /dev/null +++ b/src/tree.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2007 Vreixo Formoso + * + * This file is part of the libisofs project; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See COPYING file for details. + */ +#ifndef LIBISO_TREE_H_ +#define LIBISO_TREE_H_ + +/* + * Definitions for the public iso tree + */ + +#include "libisofs.h" + +#include +#include +#include + +/** + * The type of an IsoTreeNode. + */ +enum IsoTreeNodeType { + LIBISO_DIR, + LIBISO_FILE, + LIBISO_SYMLINK, + LIBISO_SPECIAL, + LIBISO_BOOT +}; + +/** + * + */ +struct Iso_Tree_Node { + /* + * Initilized to 1, originally owned by user, until added to another node. + * Then it is owned by the parent node, so the user must take his own ref + * if needed. With the exception of the creation functions, none of the + * other libisofs functions that return an IsoTreeNode increment its + * refcount. This is responsablity of the client, if (s)he needs it. + */ + int refcount; + + /**< Type of the IsoTreeNode, do not confuse with mode */ + enum IsoTreeNodeType type; + + char *name; /**< Real name, supossed to be in UTF-8 */ + + mode_t mode; /**< protection */ + uid_t uid; /**< user ID of owner */ + gid_t gid; /**< group ID of owner */ + + /* TODO #00001 : consider adding new timestamps */ + time_t atime; /**< time of last access */ + time_t mtime; /**< time of last modification */ + time_t ctime; /**< time of last status change */ + + struct IsoDir *parent; /**< parent node, NULL for root */ + + /* + * Pointers to the doubled linked list of children in a dir. + * It is a circular list where the last child points to the first + * and viceversa. + */ + IsoTreeNode *prev; + IsoTreeNode *next; +}; + +struct IsoDir { + IsoTreeNode node; + + size_t nchildren; /**< The number of children of this directory. */ + struct IsoTreeNode *children; /**< list of children. ptr to first child */ +}; + +//void iso_node_unref(IsoTreeNode *node); + + +#endif /*TREE_H_*/ diff --git a/test/iso.c b/test/iso.c new file mode 100644 index 0000000..9fa0890 --- /dev/null +++ b/test/iso.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2007 Vreixo Formoso + * + * This file is part of the libisofs project; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See COPYING file for details. + */ + +#include "libisofs.h" + + +int main(int argc, char **argv) +{ + IsoTreeNode *node; + +} \ No newline at end of file diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000..f903ff0 --- /dev/null +++ b/version.h.in @@ -0,0 +1,3 @@ +#define LIBISOFS_MAJOR_VERSION @LIBISOFS_MAJOR_VERSION@ +#define LIBISOFS_MINOR_VERSION @LIBISOFS_MINOR_VERSION@ +#define LIBISOFS_MICRO_VERSION @LIBISOFS_MICRO_VERSION@