Commit Graph

249 Commits

Author SHA1 Message Date
Vreixo Formoso
193fbaef8b Custom create_node() builder function to deal with old image files. 2008-01-03 19:47:44 +01:00
Vreixo Formoso
58a7d8e853 First functions and structures for image import. 2008-01-03 19:17:55 +01:00
Vreixo Formoso
2f535abe85 Fix bug related with reading of images with reallocated dirs. 2008-01-03 17:16:27 +01:00
Vreixo Formoso
b8e44a936a Little test app that extracts contents of a file from image. 2008-01-03 13:28:51 +01:00
Vreixo Formoso
2fada8eaa4 Support for getting arbitrary file on image by path. 2008-01-03 13:27:24 +01:00
Vreixo Formoso
282ffa9a98 Function to read file contents from image. 2008-01-03 00:56:11 +01:00
Vreixo Formoso
33635c4e41 Readlink implementation for Image filesystem. 2008-01-03 00:29:30 +01:00
Vreixo Formoso
b273290415 Little demo program that outputs a read iso image. 2008-01-03 00:19:39 +01:00
Vreixo Formoso
42cd599d2d Fix bug in DataSource. 2008-01-03 00:18:59 +01:00
Vreixo Formoso
5bf798d550 Support for close and readdir. 2008-01-02 19:12:12 +01:00
Vreixo Formoso
a7b687818f Support for reading a dir inside an image, step 1. 2008-01-02 18:56:45 +01:00
Vreixo Formoso
8423e0acf6 Handle propertly root dir, that hasn't name nor parent. 2008-01-01 20:27:52 +01:00
Vreixo Formoso
34e7a8dad0 Fix bug in RR PX entry parsing. 2008-01-01 20:27:07 +01:00
Vreixo Formoso
ad2974940a Correctly manage image size and written progress. 2008-01-01 20:25:07 +01:00
Vreixo Formoso
2a0f762213 Function to get root FileSource on a IsoImageFilesystem. 2007-12-31 22:00:44 +01:00
Vreixo Formoso
be37936534 Add function to create an IsoFileSource from an ISO image. 2007-12-31 21:51:35 +01:00
Vreixo Formoso
dc6cd09877 Add functions to read RockRidge SUSP entries. 2007-12-31 21:51:31 +01:00
Vreixo Formoso
c296ca9ff5 iso_file_source_new_lfs() can be static. 2007-12-31 16:29:47 +01:00
Vreixo Formoso
baf7f14b11 Change get_path() definition in IsoFileSource. 2007-12-31 16:27:08 +01:00
Vreixo Formoso
263770ab4f Read Volume Descriptors and identify RR extensions, if any. 2007-12-31 03:36:48 +01:00
Vreixo Formoso
e18f5d8898 Change message functions signature. 2007-12-30 22:04:41 +01:00
Vreixo Formoso
d8cb56ecf3 Start implementation of IsoFilesystem for reading ISO images. 2007-12-30 21:39:17 +01:00
Vreixo Formoso
135ac835eb Implementation of IsoDataSource based on POSIX I/O. 2007-12-30 18:29:39 +01:00
Vreixo Formoso
702bd0f288 Isolate non-standard eaccess usage in a util function.
That will be replaced soon with our own implementation, based on POSIX 
standard functions.
2007-12-30 18:07:01 +01:00
Vreixo Formoso
c786fc70b6 Fix bug in progress info, count last written bytes in percent. 2007-12-30 18:05:35 +01:00
Vreixo Formoso
48e243d5da Define interface for IsoDataSource to access existent images. 2007-12-30 17:47:44 +01:00
Vreixo Formoso
f9ee153a97 More unit test to check correct RR entries generation for symlinks. 2007-12-30 17:01:51 +01:00
Vreixo Formoso
d9c9aea0c5 Fix integer overflow in progress count. 2007-12-29 22:21:11 +01:00
Vreixo Formoso
7e66fe43ce Reduce memory usage in low level tree, by storing dir info separately. 2007-12-29 18:30:59 +01:00
Vreixo Formoso
4b8db2f274 Report writting progress. 2007-12-29 17:42:57 +01:00
Vreixo Formoso
a2645cbf40 Expose several tree options, to control recursive dir addition. 2007-12-29 17:15:24 +01:00
Vreixo Formoso
501275279d Change recOpts in Image, it can be part of the Image struct, not a ptr. 2007-12-29 16:49:04 +01:00
Vreixo Formoso
71cd3ccb89 Check access to file contents before adding it to public iso tree. 2007-12-29 16:34:17 +01:00
Vreixo Formoso
5c22069d19 Add function to check if we have access to IsoFileSource contents. 2007-12-29 16:30:13 +01:00
Vreixo Formoso
c915c6e3f4 Add a function to identify a Stream, for user notification. 2007-12-29 01:58:42 +01:00
Vreixo Formoso
26a04559c7 Some fixes to memory leak bugs. 2007-12-28 22:45:56 +01:00
Vreixo Formoso
4c9d83f051 Define code style formatter for eclipse and apply it to source. 2007-12-28 22:10:17 +01:00
Vreixo Formoso
9a90afcf69 Support for setting an output charset for RR NM entries.
It will default to input charset (i.e. the locale charset for now). 
Names will be stored internally in that locale charset. Note that input 
charset musn't be changed by user. Instead, we can provide an input 
charset property to IsoFilesystem implementations.
2007-12-28 00:20:02 +01:00
Vreixo Formoso
6c7c54af93 Fix bug in strconv, take care about the end of string NULL character. 2007-12-28 00:18:49 +01:00
Vreixo Formoso
c3ded11773 Util function to convert string charset. 2007-12-27 21:11:29 +01:00
Vreixo Formoso
1e4851792b First step to input/output charset handling. 2007-12-27 18:55:47 +01:00
Vreixo Formoso
a8636eaa60 Support for setting default modes for files and dirs. 2007-12-27 18:10:14 +01:00
Vreixo Formoso
941e2022e8 Expose RockRidge option. 2007-12-27 10:43:06 +01:00
Vreixo Formoso
c9957cb25e Some unit test for RR/SUSP entries generation and size calculation. 2007-12-27 00:45:44 +01:00
Vreixo Formoso
dd97f67ee4 Add functions to read timestamps from ISO images. 2007-12-27 00:29:12 +01:00
Vreixo Formoso
aae230a321 Add util functions to deal with ISO types. 2007-12-27 00:19:09 +01:00
Vreixo Formoso
bf51fba3bc Ensure ce is set to 0 at the beginning of calc size. 2007-12-26 19:05:06 +01:00
Vreixo Formoso
ddd703e7c4 Fix several bugs related to RR SL/NM fields (PT 2 :). 2007-12-26 18:19:00 +01:00
Vreixo Formoso
5f6b5fd930 Guard against wrong POSIX filenames in node. 2007-12-26 16:34:07 +01:00
Vreixo Formoso
6509134411 Fix bug with RR NM and SL entries. 2007-12-26 12:48:48 +01:00
Vreixo Formoso
49344b3ca9 Fix bug in path table size computation. 2007-12-25 23:33:37 +01:00
Vreixo Formoso
d954957d83 If needed, add version number to symlinks and special files too. 2007-12-25 18:59:20 +01:00
Vreixo Formoso
bf0c1dd219 Add nlink and ino fields. No true usage for now. 2007-12-25 18:51:00 +01:00
Vreixo Formoso
f8f2dcb6b0 RockRidge support, now RR/SUSP entries are correctly written.
This also fix a little bug, ensuring SP is written first to the "." 
entry of the directory record.
2007-12-25 18:35:10 +01:00
Vreixo Formoso
54038ec54b Functions to add RR/SUSP entries. Fix little bugs. 2007-12-25 17:53:17 +01:00
Vreixo Formoso
c3af3553df Define functions to generate and write the RR/SUSP fields. 2007-12-24 16:29:57 +01:00
Vreixo Formoso
778e39ba3c Take care about the RR entries when computing the size, and cache it.
When computing the size of the directory structures, take care about the size
taken by the RR/SUSP fields. Also, cache that size, otherwise we need to do
this computation several times and it is ugly, because the CE entries need to 
know where the Continuation Area will be stored.
2007-12-24 14:24:09 +01:00
Vreixo Formoso
98b2dc2658 Take into account that System Use Field may be padded. 2007-12-24 14:04:15 +01:00
Vreixo Formoso
d48c553f40 Implement function to compute the size needed for RR field. 2007-12-24 04:31:15 +01:00
Vreixo Formoso
9de0be2602 Guard in public API agains bad names or link destinations. 2007-12-24 04:20:29 +01:00
Vreixo Formoso
227b17f251 Store a pointer to the real parent in reparent dirs. 2007-12-23 17:41:21 +01:00
Vreixo Formoso
811655a9a1 Mangle file names inside root directory after reorder the tree. 2007-12-23 17:19:07 +01:00
Vreixo Formoso
041858360a Handle reallocation of directories. 2007-12-23 17:11:32 +01:00
Vreixo Formoso
ca1385cce1 Begin RR support. Symlinks and Special files added to low level tree. 2007-12-23 16:16:26 +01:00
Vreixo Formoso
b8aa48038b Minor changes. 2007-12-23 15:39:41 +01:00
Vreixo Formoso
002a832ac3 Minor changes. 2007-12-23 02:58:54 +01:00
Vreixo Formoso
6154fb1f0a Replace the pipe with the ring buffer. 2007-12-23 02:46:35 +01:00
Vreixo Formoso
94e687d9d3 Add a ring buffer implementation.
This is intented to replace the pipe between the writer and reader 
threads. That way we can have a much better control of cancelation 
situations. Still to be optimized.
2007-12-23 02:24:21 +01:00
Vreixo Formoso
9ec475a900 Change iso name conversion functions back to old style. 2007-12-22 20:49:30 +01:00
Vreixo Formoso
9e9c077c6e Minimize charset conversion errors, ignoring when we can't do better.
If a file name is encoded in a different encoding than default input, current
implementation make image generation to be cancelled. As this can happen quite
frequent, due to files from discs or Windows partitions incorrectly mounted,
the best we can do is just ignore this, replacing the wrong character with a
'_'.
2007-12-22 19:44:02 +01:00
Vreixo Formoso
35ef22cdd7 Implement ECMA-119 burn_source and writer thread handling.
At this time, nglibisofs is able to output an image!! Note that communication
between writer and read thread is done via a pipe. That will be replaced by a
ring buffer in the near future.
2007-12-22 17:09:28 +01:00
Vreixo Formoso
2ab23693db Replace path table size computation by a recursive version.
The recursive version wastes less memory, as it doesn't need the path table
array.
2007-12-22 16:02:29 +01:00
Vreixo Formoso
d07fed1a4c Add write function. Fix bug in PVD writing and dir. record len computation. 2007-12-22 14:45:00 +01:00
Vreixo Formoso
42731f4135 Fix bug in create tree, to propertly handle ignored files.
Due to a bug, when a file was ignored (for example, a dir whose deep 
level was greater than 8), all its parents where ignored, what causes 
root to be ignored!
2007-12-22 14:32:31 +01:00
Vreixo Formoso
5cf2980c9c Append version number to file ids. 2007-12-21 23:08:21 +01:00
Vreixo Formoso
2fd3195747 Write the path tables on the ISO structure. 2007-12-21 22:53:48 +01:00
Vreixo Formoso
31ee89c47b Code to write directory structure of the ECMA-119 tree. 2007-12-21 00:35:43 +01:00
Vreixo Formoso
46ffb6d33d Fix implementation of PVD writing. 2007-12-21 00:05:41 +01:00
Vreixo Formoso
2f383215ff Implement Writer for file contents.
Some aspects, such as better reporting of file bigger or smaller than 
expected is needed, but all situations are handled propertly.
2007-12-20 22:17:18 +01:00
Vreixo Formoso
449ed65fe9 Improve IsoStream interface implementation. 2007-12-20 20:58:03 +01:00
Vreixo Formoso
a161f4249c Improve IsoFileSource interface implementation. 2007-12-20 20:47:39 +01:00
Vreixo Formoso
f2e3a2c9fc Guard against empty names. 2007-12-20 16:09:29 +01:00
Vreixo Formoso
e6bd1586d6 Replace glibc tsearch() with a custom red-black tree implementation.
The library supplied tree estructure is not enought for our needs, due to its
limited API. Thus, we have implemented a suitable red-black tree.
2007-12-20 00:25:25 +01:00
Vreixo Formoso
5eb3a7e038 Implementation of function to write the PVD.
The directory entry for the root directory is still missing.
2007-12-18 21:55:01 +01:00
Vreixo Formoso
2dc15ab164 Add some util functions, mostly copied from old libisofs. 2007-12-18 21:51:33 +01:00
Vreixo Formoso
39bde82ff6 Move size, ino, dev cache from IsoFileSrc to IsoStream.
That is a better decission, as it reduces the number of stat() call 
needed, and anyway some Streams will need the size.
2007-12-18 20:46:28 +01:00
Vreixo Formoso
5b93cb4cdc Fix bug, root refcount must be initialized to 1. 2007-12-18 10:54:09 +01:00
Vreixo Formoso
36894d6a23 Implementation of the write function to use by the Writers. 2007-12-18 00:37:24 +01:00
Vreixo Formoso
257b08bfcf Code to compute position of directory records and path tables. 2007-12-18 00:20:03 +01:00
Vreixo Formoso
5e2de57aa9 Initial structure for ECMA-119 writer. 2007-12-17 23:22:19 +01:00
Vreixo Formoso
159b775d22 Improve message functions to support message formating in printf style. 2007-12-17 21:12:51 +01:00
Vreixo Formoso
f279676b6b Check file size to ensure file bigger than 4GB are not added to image. 2007-12-17 20:47:53 +01:00
Vreixo Formoso
c8715941e6 Define some functions and responsabilities for image generation.
Still very preliminary work.
2007-12-16 19:10:47 +01:00
Vreixo Formoso
c03d4d9b33 Implementation of name mangling algorithm.
This has to ensure that file names are unique among all files in an iso 
directory. Current implementation can be improved by using a hash table 
to keep the names, instead of iterate over all children. An alternative 
method, keeping children sorted all the time, thus allowing binary 
search, has been considered but discarded.                          

Current implementation support up to 9,999,999 equal files per 
directory.
2007-12-16 17:32:05 +01:00
Vreixo Formoso
56cdd00638 Sorting of nodes in a dir acording to ECMA-119, 9.3. 2007-12-15 18:40:33 +01:00
Vreixo Formoso
411524c330 Handling of iso directory depth restrictions on tree creation time.
Note that this doesn't involve the RR reparent. It just ignore the files 
that break iso restrictions (see ECMA-119, 6.8.2.1).
2007-12-15 18:29:40 +01:00
Vreixo Formoso
0a340c53d5 Fix bug in open() function for local file srcs, to deal with symlinks. 2007-12-15 17:12:21 +01:00
Vreixo Formoso
40b27dbacc Initial support for low level ECMA-119 tree.
This only adds the tree creation functions, no sorting and name mangling 
yet. Only plain ECMA-119 supported for now, nor RR, relaxed 
restrictions, etc..

This also adds a little test program.
2007-12-15 16:55:44 +01:00
Vreixo Formoso
aa312cf7d7 Fix bug in IsoFileSrc implementation, related to a wrogn usage of tsearch.
It happens that tsearch seems to not return a pointer to the inserted element,
but a pointer to a pointer to the inserted element (that makes sense, as we
are inserted pointers...). This bug, thus, was related to a wrong 
understanding of the tsearch API!
2007-12-15 16:48:50 +01:00
Vreixo Formoso
7b241176fb Init implementation of IsoFileSrc.
Ecma119Image, defined for first time in this commit, is the context for image 
written. It keeps the low level objects needed during image written.

IsoFileSrc is the low level object that takes care about the info needed to
write file contents to image. It takes care about reading from Stream in 2K
block chunks. To prevent the same file be written twice to image, we keep in
Ecma119Image a search tree, indexed by the triple key (fs, device, inode) that
uniquelly identifies a source.
2007-12-15 13:13:49 +01:00
Vreixo Formoso
dd83f85d09 Support for identification of source Streams.
We identify uniquelly a given source Stream by a triple of numbers: the
filesystem id, the device id inside the filesystem, and the inode id.
2007-12-15 12:51:48 +01:00
Vreixo Formoso
8f7222609e Add support for generating ISO identifiers from ASCII strings. 2007-12-14 22:13:00 +01:00
Vreixo Formoso
315f1a1717 Support for charset conversion from any encoding to ASCII. 2007-12-14 21:42:55 +01:00
Vreixo Formoso
115da82c9e First util functions, with corresponding unit test. 2007-12-13 21:02:36 +01:00
Vreixo Formoso
60d68df84c Expose iso_node_set_hidden(), to let a node be hidden in RR/ISO or Joliet tree. 2007-12-13 20:27:58 +01:00
Vreixo Formoso
d10ed353e2 Implement function to recursively add a dir to an iso tree.
This commit also to the following changes:
- create_node() on builder never frees the IsoFileSource, it is responsability 
  of the caller to free it.
- Recursive addition options added to IsoImage (not exposed to public API yet)
- create_node() takes care about follow_symlinks
- Added little demo program to test it.
2007-12-11 22:47:04 +01:00
Vreixo Formoso
0306bb5daf Redefine readdir() on IsoFileSource, to skip "." and ".." dirs. 2007-12-11 22:41:18 +01:00
Vreixo Formoso
008871cfd8 Additon of nodes based on Builder. Pass Image as a parameter to builder methods. 2007-12-09 18:47:29 +01:00
Vreixo Formoso
e28f924913 Ensure local filesystem is deleted when needed. 2007-12-08 02:49:27 +01:00
Vreixo Formoso
b03fbf0ee0 Implement function to get node from path on image. Little unit test too. 2007-12-08 01:39:31 +01:00
Vreixo Formoso
f04ddb4435 Add getter and setter for sort_weight. 2007-12-07 22:36:26 +01:00
Vreixo Formoso
70b9b87150 Expose iso_node_get_type(). 2007-12-07 22:25:31 +01:00
Vreixo Formoso
45f4d0a29e Add function to add an exiting file to the iso tree.
Node is created using a builder. Default builder and filesystem is added 
to IsoImage. Later we should expose setters for this atts.
2007-12-07 03:02:46 +01:00
Vreixo Formoso
c93fa154d5 Getters and setters for time attributes on IsoNode. 2007-12-06 22:52:01 +01:00
Vreixo Formoso
7f9c5c9065 Unit test for tree functions. Little fixes. 2007-12-06 22:45:16 +01:00
Vreixo Formoso
5df6b2c3d2 Fix bug in tree functions. 2007-12-06 16:44:52 +01:00
Vreixo Formoso
dad43d9ede Add some unit tests related to IsoNode. 2007-12-06 16:19:14 +01:00
Vreixo Formoso
5abb569e0c Keep children sorted when renaming a node. 2007-12-06 16:18:51 +01:00
Vreixo Formoso
b2d41de603 Allow adding of special files to iso tree node. 2007-12-06 02:43:24 +01:00
Vreixo Formoso
007be29c6d Fix little bug: ensure number of children is incremented when adding a
new node to a dir.
2007-12-06 02:38:19 +01:00
Vreixo Formoso
d4deb4866f Take care about duplicate node names in iso_node_set_name(). 2007-12-06 02:22:11 +01:00
Vreixo Formoso
06db9a3c73 Free destination on IsoSymlinks. 2007-12-06 02:13:01 +01:00
Vreixo Formoso
f62c34776f Begin implementation of tree operations. 2007-12-06 02:11:05 +01:00
Vreixo Formoso
8e7fe9b5a5 Add replace flag to iso_dir_add_node(). 2007-12-05 22:37:57 +01:00
Vreixo Formoso
14f4aa7d07 Init builder implementation. 2007-12-04 22:33:40 +01:00
Vreixo Formoso
6616eae76b Unref Stream when freeing a IsoFile. 2007-12-03 21:53:20 +01:00
Vreixo Formoso
8edc9f2639 Implementation of IsoStream for IsoFileSources. 2007-12-02 22:04:26 +01:00
Vreixo Formoso
b35e090c1b Add stat() function to IsoFileSource interface. 2007-12-02 22:03:29 +01:00
Vreixo Formoso
0ba8a7a85e Add message queue facilities. Each IsoImage will have its own msg queue. 2007-12-02 20:11:44 +01:00
Vreixo Formoso
d916b60172 Add getters and setters for image properties, together with unit tests. 2007-12-02 19:49:11 +01:00
Vreixo Formoso
c83bac7d9e Add IsoImage, equivalent to old libisofs volume and volset.
IsoImage will be a context for image creation and modification.
2007-12-02 19:10:30 +01:00
Vreixo Formoso
f2deae8503 Set parent of a root node to point to itself.
This way we can ensure a root node is not added to another dir.
2007-12-02 19:08:51 +01:00
Vreixo Formoso
c587c79220 Ensure parent is set to NULL on children of a deleted directory. 2007-12-02 19:02:56 +01:00
Vreixo Formoso
0c03ad051b Add function to create a new root. 2007-12-02 18:54:55 +01:00
Vreixo Formoso
79c37ff193 Little changes. 2007-12-02 17:59:36 +01:00
Vreixo Formoso
5fa2490a48 Take and remove functions based on iterator. 2007-12-02 17:17:04 +01:00
Vreixo Formoso
78fba4c14f Add unit test for dir iteration. Implementation of iso_dir_iter_free(). 2007-12-02 16:39:58 +01:00
Vreixo Formoso
5ec93b50f4 Add functions to remove nodes from a dir. Handle deletion of dirs
propertly.
2007-12-01 02:43:37 +01:00
Vreixo Formoso
051538b5c2 Add functions to iterate over directory children. 2007-12-01 02:22:00 +01:00
Vreixo Formoso
e068fd1cf6 Getter for number of children in a dir. 2007-12-01 01:45:35 +01:00
Vreixo Formoso
a4f283fac6 Functions to add and get a node inside a dir. 2007-12-01 01:42:21 +01:00
Vreixo Formoso
efff783602 Added getters/setters from IsoNode permissions and owners. 2007-11-27 20:41:09 +01:00
Vreixo Formoso
b9152421f3 Define and document IsoStream interface. 2007-11-27 00:27:57 +01:00
Vreixo Formoso
100919a5cb Fix little bug, close() must mark a file as closed! 2007-11-26 21:46:26 +01:00
Vreixo Formoso
1478904aaf Implement get_name in FileSource, and add a little test program. 2007-11-26 21:16:38 +01:00
Vreixo Formoso
e034f287bf Implement IsoFilesystem to deal with local filesystem. 2007-11-25 19:54:13 +01:00
Vreixo Formoso
1bda81869b Add IsoFileSource implementation for local filesystem. 2007-11-25 16:46:21 +01:00
Vreixo Formoso
6c090c9a7b Added more files, mainly beginning of filesystem sources implementation. 2007-11-24 16:58:36 +01:00
Vreixo Formoso
9ee4e39899 Added build files and first code stub. 2007-11-24 13:14:45 +01:00