FreeBSD/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
/*
 * Set-up and validate the members of an cpu fmri according to:
 *
 *	Member name		Type		Value
 *	====================================================
 *	version			uint8_t		0
 *	auth			nvlist_t	<auth>
 *	cpuid			uint32_t	<cpu_id>
 *	cpumask			uint8_t		<cpu_mask>
 *	serial			uint64_t	<serial_id>
 *
 * Note that auth, cpumask, serial are optional members.
 *
 */
Set-up and validate the members of an cpu fmri according to:
Member name             Type            Value



Note that auth, cpumask, serial are optional members.
Set - up and validate the members of an cpu fmri according to : Member name Type Value Note that auth cpumask serial are optional members .
void
fm_fmri_cpu_set(nvlist_t *fmri_cpu, int version, const nvlist_t *auth,
    uint32_t cpu_id, uint8_t *cpu_maskp, const char *serial_idp)
{
	uint64_t *failedp = &erpt_kstat_data.fmri_set_failed.value.ui64;
	if (version < CPU_SCHEME_VERSION1) {
		atomic_inc_64(failedp);
		return;
	}
	if (nvlist_add_uint8(fmri_cpu, FM_VERSION, version) != 0) {
		atomic_inc_64(failedp);
		return;
	}
	if (nvlist_add_string(fmri_cpu, FM_FMRI_SCHEME,
	    FM_FMRI_SCHEME_CPU) != 0) {
		atomic_inc_64(failedp);
		return;
	}
	if (auth != NULL && nvlist_add_nvlist(fmri_cpu, FM_FMRI_AUTHORITY,
	    (nvlist_t *)auth) != 0)
		atomic_inc_64(failedp);
	if (nvlist_add_uint32(fmri_cpu, FM_FMRI_CPU_ID, cpu_id) != 0)
		atomic_inc_64(failedp);
	if (cpu_maskp != NULL && nvlist_add_uint8(fmri_cpu, FM_FMRI_CPU_MASK,
	    *cpu_maskp) != 0)
		atomic_inc_64(failedp);
	if (serial_idp == NULL || nvlist_add_string(fmri_cpu,
	    FM_FMRI_CPU_SERIAL_ID, (char *)serial_idp) != 0)
			atomic_inc_64(failedp);
}
void fm_fmri_cpu_set ( nvlist_t * fmri_cpu , int version , const nvlist_t * auth , uint32_t cpu_id , uint8_t * cpu_maskp , const char * serial_idp ) { uint64_t * failedp = & erpt_kstat_data . fmri_set_failed . value . ui64 ; if ( version < CPU_SCHEME_VERSION1 ) { atomic_inc_64 ( failedp ) ; return ; } if ( nvlist_add_uint8 ( fmri_cpu , FM_VERSION , version ) != 0 ) { atomic_inc_64 ( failedp ) ; return ; } if ( nvlist_add_string ( fmri_cpu , FM_FMRI_SCHEME , FM_FMRI_SCHEME_CPU ) != 0 ) { atomic_inc_64 ( failedp ) ; return ; } if ( auth != NULL && nvlist_add_nvlist ( fmri_cpu , FM_FMRI_AUTHORITY , ( nvlist_t * ) auth ) != 0 ) atomic_inc_64 ( failedp ) ; if ( nvlist_add_uint32 ( fmri_cpu , FM_FMRI_CPU_ID , cpu_id ) != 0 ) atomic_inc_64 ( failedp ) ; if ( cpu_maskp != NULL && nvlist_add_uint8 ( fmri_cpu , FM_FMRI_CPU_MASK , * cpu_maskp ) != 0 ) atomic_inc_64 ( failedp ) ; if ( serial_idp == NULL || nvlist_add_string ( fmri_cpu , FM_FMRI_CPU_SERIAL_ID , ( char * ) serial_idp ) != 0 ) atomic_inc_64 ( failedp ) ; }
Set-up and validate the members of an cpu fmri according to:
      Member name             Type            Value
Set - up and validate the members of an cpu fmri according to : Member name Type Value