Ejemplo n.º 1
0
Archivo: prints.c Proyecto: 7799/linux
static void prepare_error_buf(const char *fmt, va_list args)
{
	char *fmt1 = fmt_buf;
	char *k;
	char *p = error_buf;
	int what;

	spin_lock(&error_lock);

	strcpy(fmt1, fmt);

	while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
		*k = 0;

		p += vsprintf(p, fmt1, args);

		switch (what) {
		case 'k':
			sprintf_le_key(p, va_arg(args, struct reiserfs_key *));
			break;
		case 'K':
			sprintf_cpu_key(p, va_arg(args, struct cpu_key *));
			break;
		case 'h':
			sprintf_item_head(p, va_arg(args, struct item_head *));
			break;
		case 't':
			sprintf_direntry(p,
					 va_arg(args,
						struct reiserfs_dir_entry *));
			break;
		case 'y':
			sprintf_disk_child(p,
					   va_arg(args, struct disk_child *));
			break;
		case 'z':
			sprintf_block_head(p,
					   va_arg(args, struct buffer_head *));
			break;
		case 'b':
			sprintf_buffer_head(p,
					    va_arg(args, struct buffer_head *));
			break;
		case 'a':
			sprintf_de_head(p,
					va_arg(args,
					       struct reiserfs_de_head *));
			break;
		}

		p += strlen(p);
		fmt1 = k + 2;
	}
	vsprintf(p, fmt1, args);
	spin_unlock(&error_lock);

}
Ejemplo n.º 2
0
static void
prepare_error_buf(const char *fmt, va_list args)
{
	char *fmt1, *k, *p;
	int i, j, what, skip;

	fmt1 = fmt_buf;
	p = error_buf;
	strcpy (fmt1, fmt);

	while ((k = is_there_reiserfs_struct(fmt1, &what, &skip)) != NULL) {
		*k = 0;

		p += vsprintf (p, fmt1, args);

		for (i = 0; i < skip; i ++)
			j = va_arg(args, int);

		switch (what) {
		case 'k':
			sprintf_le_key(p, va_arg(args, struct key *));
			break;
		case 'K':
			sprintf_cpu_key(p, va_arg(args, struct cpu_key *));
			break;
		case 'h':
			sprintf_item_head(p, va_arg(args, struct item_head *));
			break;
		case 't':
			sprintf_direntry(p,
			    va_arg(args, struct reiserfs_dir_entry *));
			break;
		case 'y':
			sprintf_disk_child(p,
			    va_arg(args, struct disk_child *));
			break;
		case 'z':
			sprintf_block_head(p,
			    va_arg(args, struct buffer_head *));
			break;
		case 'a':
			sprintf_de_head(p,
			    va_arg(args, struct reiserfs_de_head *));
			break;
		}

		p   += strlen(p);
		fmt1 = k + 2;
	}

	vsprintf(p, fmt1, args);
}