iso9660: ~Check signature
[meinos.git] / apps / iso9660 / file.c
blob86c636d4b389b73ae3f7579b4c26e42cd85bc098
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 "cdi/fs.h"
20 #include "cdi/cache.h"
22 #include "iso9660_cdi.h"
24 /**
25 * Reads from file
26 * @param stream CDI FS stream
27 * @param start Offset in flie
28 * @param size How many bytes to read
29 * @param buffer Buffer to store data in
30 * @return How many bytes read
32 size_t iso9660_fs_file_read(struct cdi_fs_stream *stream,uint64_t start,size_t size,void *buffer) {
33 struct iso9660_fs_res *res = (struct iso9660_fs_res*)stream->res;
34 debug("iso9660_fs_file_read(%s,0x%x,0x%x,0x%x,0x%x)\n",res->res.name,start,size,buffer);
36 if (start>res->data_size) return 0;
37 if (start+size>res->data_size) size = res->data_size-start;
39 iso9660_read(res,start,size,buffer);
40 return size;