mirror of
				https://github.com/xcat2/xNBA.git
				synced 2025-11-03 21:02:36 +00:00 
			
		
		
		
	[settings] Add "version" builtin setting
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
		
				
					committed by
					
						
						Michael Brown
					
				
			
			
				
	
			
			
			
						parent
						
							eba6bb38f2
						
					
				
				
					commit
					7016164056
				
			@@ -35,6 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 | 
			
		||||
#include <ipxe/base16.h>
 | 
			
		||||
#include <ipxe/pci.h>
 | 
			
		||||
#include <ipxe/init.h>
 | 
			
		||||
#include <ipxe/version.h>
 | 
			
		||||
#include <ipxe/settings.h>
 | 
			
		||||
 | 
			
		||||
/** @file
 | 
			
		||||
@@ -2176,11 +2177,32 @@ static int platform_fetch ( void *data, size_t len ) {
 | 
			
		||||
	return ( sizeof ( platform ) - 1 /* NUL */ );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Version setting */
 | 
			
		||||
struct setting version_setting __setting ( SETTING_MISC ) = {
 | 
			
		||||
	.name = "version",
 | 
			
		||||
	.description = "Version",
 | 
			
		||||
	.type = &setting_type_string,
 | 
			
		||||
	.scope = &builtin_scope,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fetch version setting
 | 
			
		||||
 *
 | 
			
		||||
 * @v data		Buffer to fill with setting data
 | 
			
		||||
 * @v len		Length of buffer
 | 
			
		||||
 * @ret len		Length of setting data, or negative error
 | 
			
		||||
 */
 | 
			
		||||
static int version_fetch ( void *data, size_t len ) {
 | 
			
		||||
	strncpy ( data, product_version, len );
 | 
			
		||||
	return ( strlen ( product_version ) );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** List of built-in setting operations */
 | 
			
		||||
static struct builtin_setting_operation builtin_setting_operations[] = {
 | 
			
		||||
	{ &errno_setting, errno_fetch },
 | 
			
		||||
	{ &buildarch_setting, buildarch_fetch },
 | 
			
		||||
	{ &platform_setting, platform_fetch },
 | 
			
		||||
	{ &version_setting, version_fetch },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user