usbloadergx/libcustomext2fs/source/io_manager.c
dimok321 0f17471b27 *Removed ntfs/fat source and added them as custom libs (makes them easier to update later)
*Added sources of the custom libs to the branches
*Fixed crash when switching from list layout to grid/carousel layout
*Removed 1:1 copy option because its meaningless and almost the same as installing all partitions
*Fixed install partition selection. This option needs a reset. Go to settings and reselect your option for this.
*Fixed schinese and tchinese language modes (filename bugs. has to be schinese.lang and tchinese.lang like on SVN)
*Fixed bug in sound buffer circle
*Fixed incorrect behaviour of x-flip when selecting system like (thx Cyan for the patch)
*Accept ios revision 65535 for Waninkokos IOSes (thx to PPSainity for pointing it out)
*Merged the new theming style branch into trunk. Just as a reminder: ALL old themes will not work until the themers did port it to the new style!
*Removed old theme style completely

Theme example:
The example file of the theme is the Default.them file. It can be found in the SVN trunk.

Change in loading of themes:
When selecting a theme now a list of all .them files in a folder is displayed. The image folder of that theme has to be in the same folder as the .them file. The image path is defined in the head of the .them file in the line with "Image-Folder: Example\n".
2010-12-26 17:02:14 +00:00

113 lines
2.4 KiB
C

/*
* io_manager.c --- the I/O manager abstraction
*/
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "ext2_fs.h"
#include "ext2fs.h"
errcode_t io_channel_set_options(io_channel channel, const char *opts)
{
errcode_t retval = 0;
char *next, *ptr, *options, *arg;
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
if (!opts)
return 0;
if (!channel->manager->set_option)
return EXT2_ET_INVALID_ARGUMENT;
options = malloc(strlen(opts)+1);
if (!options)
return EXT2_ET_NO_MEMORY;
strcpy(options, opts);
ptr = options;
while (ptr && *ptr) {
next = strchr(ptr, '&');
if (next)
*next++ = 0;
arg = strchr(ptr, '=');
if (arg)
*arg++ = 0;
retval = (channel->manager->set_option)(channel, ptr, arg);
if (retval)
break;
ptr = next;
}
free(options);
return retval;
}
errcode_t io_channel_write_byte(io_channel channel, unsigned long offset,
int count, const void *data)
{
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
if (channel->manager->write_byte)
return channel->manager->write_byte(channel, offset,
count, data);
return EXT2_ET_UNIMPLEMENTED;
}
errcode_t io_channel_read_blk64(io_channel channel, unsigned long long block,
int count, void *data)
{
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
if (channel->manager->read_blk64)
return (channel->manager->read_blk64)(channel, block,
count, data);
if ((block >> 32) != 0)
return EXT2_ET_IO_CHANNEL_NO_SUPPORT_64;
return (channel->manager->read_blk)(channel, (unsigned long) block,
count, data);
}
errcode_t io_channel_write_blk64(io_channel channel, unsigned long long block,
int count, const void *data)
{
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
if (channel->manager->write_blk64)
return (channel->manager->write_blk64)(channel, block,
count, data);
if ((block >> 32) != 0)
return EXT2_ET_IO_CHANNEL_NO_SUPPORT_64;
return (channel->manager->write_blk)(channel, (unsigned long) block,
count, data);
}
errcode_t io_channel_discard(io_channel channel, unsigned long long block,
unsigned long long count)
{
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
if (channel->manager->discard)
return (channel->manager->discard)(channel, block, count);
return EXT2_ET_UNIMPLEMENTED;
}