futility/vb1_helper.c
/*
 * Read the kernel command line from a file. Get rid of \n characters along
 * the way and verify that the line fits into a 4K buffer.
 *
 * Return the buffer contaning the line on success (and set the line length
 * using the passed in parameter), or NULL in case something goes wrong.
 */
Read the kernel command line from a file. Get rid of \n characters along
the way and verify that the line fits into a 4K buffer.

Return the buffer contaning the line on success (and set the line length
using the passed in parameter), or NULL in case something goes wrong.
Read the kernel command line from a file . Get rid of \ n characters along the way and verify that the line fits into a 4K buffer . Return the buffer contaning the line on success ( and set the line length using the passed in parameter ) or NULL in case something goes wrong .
uint8_t *ReadConfigFile(const char *config_file, uint32_t *config_size)
{
	uint8_t *config_buf;
	int i;
	if (VB2_SUCCESS != vb2_read_file(config_file, &config_buf, config_size))
		return NULL;
	VB2_DEBUG(" config file size=%#x\n", *config_size);
	if (CROS_CONFIG_SIZE <= *config_size) {	
		fprintf(stderr, "Config file %s is too large (>= %d bytes)\n",
			config_file, CROS_CONFIG_SIZE);
		free(config_buf);
		return NULL;
	}
	for (i = 0; i < *config_size; i++)
		if ('\n' == config_buf[i])
			config_buf[i] = ' ';
	return config_buf;
}
uint8_t * ReadConfigFile ( const char * config_file , uint32_t * config_size ) { uint8_t * config_buf ; int i ; if ( VB2_SUCCESS != vb2_read_file ( config_file , & config_buf , config_size ) ) return NULL ; VB2_DEBUG ( " \n " , * config_size ) ; if ( CROS_CONFIG_SIZE <= * config_size ) { fprintf ( stderr , " \n " , config_file , CROS_CONFIG_SIZE ) ; free ( config_buf ) ; return NULL ; } for ( i = 0 ; i < * config_size ; i ++ ) if ( ' \n ' == config_buf [ i ] ) config_buf [ i ] = ' ' ; return config_buf ; }
Read the kernel command line from a file.
Read the kernel command line from a file .
/* room for trailing '\0' */ /* Replace newlines with spaces */