iso9660: new license LGPL
[meinos.git] / apps / iso9660 / main.c
blob28ae0c655630cc801a864fa833fdad1536328cdc
1 /*
2 iso9660 - An iso9660 CDI driver with Rockridge support
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include <stdio.h>
20 #include <stdarg.h>
22 #include "cdi/fs.h"
24 #include "iso9660_cdi.h"
25 #include "iso9660def.h"
27 struct iso9660_driver {
28 struct cdi_fs_driver drv;
31 static struct iso9660_driver iso9660_driver;
32 static const char* driver_name = "iso9660";
34 static int iso9660_driver_init(struct iso9660_driver *driver);
35 static void iso9660_driver_destroy(struct cdi_driver* driver);
37 #ifdef CDI_STANDALONE
38 int main()
39 #else
40 int init_iso9660()
41 #endif
43 cdi_init();
45 if (iso9660_driver_init(&iso9660_driver)!=0) return -1;
46 cdi_fs_driver_register((struct cdi_fs_driver*)&iso9660_driver);
48 #ifdef CDI_STANDALONE
49 cdi_run_drivers();
50 #endif
52 return 0;
55 /**
56 * Initializes the data structures for the iso9660 driver
58 static int iso9660_driver_init(struct iso9660_driver *driver) {
59 // Konstruktor der Vaterklasse
60 cdi_fs_driver_init((struct cdi_fs_driver*)driver);
62 // Namen setzen
63 driver->drv.drv.name = driver_name;
64 driver->drv.fs_init = iso9660_fs_init;
65 driver->drv.fs_destroy = iso9660_fs_destroy;
66 driver->drv.drv.destroy = iso9660_driver_destroy;
67 return 0;
70 /**
71 * Deinitialize the data structures for the iso9660 driver
73 static void iso9660_driver_destroy(struct cdi_driver* driver)
75 cdi_fs_driver_destroy((struct cdi_fs_driver*)driver);
78 /**
79 * If DEBUG is definded, it outputs the debug message onto the stream
80 * defined with DEBUG
81 * @param fmt Format (see printf)
82 * @param ... Parameters
83 * @return Amount of output characters
85 int debug(const char *fmt,...) {
86 #ifdef DEBUG
87 va_list args;
88 va_start(args,fmt);
89 int ret = vfprintf(DEBUG,fmt,args);
90 va_end(args);
91 return ret;
92 #else
93 return 0;
94 #endif