fw_cfg: add fw_cfg_modify_i16 (update) method
Allow the ability to modify the value of an existing 16-bit integer fw_cfg item. Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
		
							parent
							
								
									1ceaefbd0d
								
							
						
					
					
						commit
						1edd34b638
					
				@ -484,6 +484,16 @@ void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value)
 | 
				
			|||||||
    fw_cfg_add_bytes(s, key, copy, sizeof(value));
 | 
					    fw_cfg_add_bytes(s, key, copy, sizeof(value));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void fw_cfg_modify_i16(FWCfgState *s, uint16_t key, uint16_t value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    uint16_t *copy, *old;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    copy = g_malloc(sizeof(value));
 | 
				
			||||||
 | 
					    *copy = cpu_to_le16(value);
 | 
				
			||||||
 | 
					    old = fw_cfg_modify_bytes_read(s, key, copy, sizeof(value));
 | 
				
			||||||
 | 
					    g_free(old);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value)
 | 
					void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint32_t *copy;
 | 
					    uint32_t *copy;
 | 
				
			||||||
 | 
				
			|||||||
@ -67,6 +67,7 @@ typedef void (*FWCfgReadCallback)(void *opaque, uint32_t offset);
 | 
				
			|||||||
void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len);
 | 
					void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len);
 | 
				
			||||||
void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value);
 | 
					void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value);
 | 
				
			||||||
void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value);
 | 
					void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value);
 | 
				
			||||||
 | 
					void fw_cfg_modify_i16(FWCfgState *s, uint16_t key, uint16_t value);
 | 
				
			||||||
void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value);
 | 
					void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value);
 | 
				
			||||||
void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value);
 | 
					void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value);
 | 
				
			||||||
void fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
 | 
					void fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user