On Thursday 24 September 2009 08:55, Leonid Lisovskiy wrote:
> >Has anyone done any initial work on that? I would be interested in making
> >it happen...
>
> >Matt
>
> We done partial repair of e2fsprogs for busybox in our project. You
> can take a look at patch
> http://code.google.com/p/wl500g/source/browse/trunk/busybox/105-e2fsprogs.patch
Just re-enabling e2fsprogs/old_e2fsprogs/* is not good enough.
e2fsprogs/old_e2fsprogs/* is a graveyard. It is not meant
to be compiled.
I think the best course of action if to take a specific utility,
say, mke2fs, copy e2fsprogs/old_e2fsprogs/mke2fs.c one directory up,
wire it up to build system, and then go through it and shrink
at least some of the bloat. This means: use sanes and smaller
alternatives instead of the "e2fs library" which lives in
e2fsprogs/old_e2fsprogs/*. Scavenge it to pick up needed bits,
but do not just hook it up without looking at the code.
There is some funny code. For example:
retval = io_channel_write_blk(fs->io, blk, count, buf);
#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
...
(try to track how many more levels of indirection is there...)
...
static errcode_t unix_write_blk(io_channel channel, unsigned long block,
int count, const void *buf)
static errcode_t raw_write_blk(io_channel channel,
struct unix_private_data *data,
unsigned long block,
int count, const void *buf)
God, all this only to do a lseek+write?
For comparison: fsck_minix.c does something like that
with just one small function:
static void write_block(unsigned nr, void *addr)
{
if (!nr)
return;
if (nr < FIRSTZONE || nr >= ZONES) {
printf("Internal error: trying to write bad block\n"
"Write request ignored\n");
errors_uncorrected = 1;
return;
}
xlseek(dev_fd, BLOCK_SIZE * nr, SEEK_SET);
if (BLOCK_SIZE != full_write(dev_fd, addr, BLOCK_SIZE)) {
printf("%s: bad block %u in file '%s'\n",
bb_msg_write_error, nr, current_name);
errors_uncorrected = 1;
}
}
Or this:
uuid_generate(fs->super->s_uuid);
explodes into:
void uuid_generate_time(uuid_t out)
{
static unsigned char node_id[6];
static int has_init = 0;
struct uuid uu;
uint32_t clock_mid;
if (!has_init) {
Note ===> if (get_node_id(node_id) <= 0) {
get_random_bytes(node_id, 6);
/*
* Set multicast bit, to prevent conflicts
* with IEEE 802 addresses obtained from
* network cards
*/
node_id[0] |= 0x01;
}
has_init = 1;
}
get_clock(&clock_mid, &uu.time_low, &uu.clock_seq);
uu.clock_seq |= 0x8000;
uu.time_mid = (uint16_t) clock_mid;
uu.time_hi_and_version = ((clock_mid >> 16) & 0x0FFF) | 0x1000;
memcpy(uu.node, node_id, 6);
uuid_pack(&uu, out);
}
and I dare not look into get_node_id()... it apparently finds
my network card and reads its MAC - !!!!??? sorry??!
I thought I asked to make a FILESYSTEM, what it has to do with my MAC?
and I do not want to have 5k of code to do it!
We already have mkswap_generate_uuid() which is only
183 bytes long, and is perfectly capable of replacing
uuid_generate().
And so on...
It's not THAT much work, but it must be done before mke2fs
is back in busybox.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox