view target-utils/libtiffs/init.c @ 619:f82551c77e58

libserial-newlnx: ASYNC_LOW_LATENCY patch reverted Reports from Das Signal indicate that loadtools performance on Debian is about the same as on Slackware, and that including or omitting the ASYNC_LOW_LATENCY patch from Serg makes no difference. Because the patch in question does not appear to be necessary, it is being reverted until and unless someone other than Serg reports an actual real-world system on which loadtools operation times are slowed compared to the Mother's Slackware reference and on which Slackware-like performance can be restored by setting the ASYNC_LOW_LATENCY flag.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 27 Feb 2020 01:09:48 +0000
parents c10a65f7563e
children
line wrap: on
line source

#include "types.h"
#include "struct.h"
#include "globals.h"
#include "macros.h"

static const u8 ffs_sector_signature[6] = {'F', 'f', 's', '#', 0x10, 0x02};

static
find_indexblk()
{
	u32 sector_addr;
	u8 *sector_ptr;
	int i;

	printf("Looking for TIFFS active index block\n");
	sector_addr = tiffs_base_addr;
	for (i = 0; i < tiffs_nsectors; i++) {
		sector_ptr = (u8 *) sector_addr;
		if (!bcmp(sector_ptr, ffs_sector_signature, 6) &&
		    sector_ptr[8] == 0xAB) {
			printf("Found at %08X\n", sector_addr);
			tiffs_active_index = (struct inode *) sector_ptr;
			return(0);
		}
		sector_addr += tiffs_sector_size;
	}
	printf("Error: Not found in any of the %d candidate sectors\n",
		tiffs_nsectors);
	return(-1);
}

static
find_rootino()
{
	int ino;
	struct inode *irec;

	printf("Looking for the root inode\n");
	for (ino = 1; ; ino++) {
		if (ino >= tiffs_sector_size >> 4) {
		    printf("Error: Hit end of sector, no root inode found\n");
			return(-1);
		}
		irec = tiffs_active_index + ino;
		if (irec->type == OBJTYPE_DIR && *inode_to_dataptr(irec) == '/')
			break;
	}
	printf("Found at inode #%x\n", ino);
	tiffs_root_ino = ino;
	return(0);
}

tiffs_init()
{
	int stat;

	if (tiffs_init_done)
		return(0);
	stat = find_indexblk();
	if (stat < 0)
		return(stat);
	stat = find_rootino();
	if (stat < 0)
		return(stat);
	tiffs_init_done = 1;
	return(0);
}