]> git.ozlabs.org Git - ccan/blobdiff - ccan/cpuid/cpuid.h
cpuid: use a sprintf-like function to get cputype as a string
[ccan] / ccan / cpuid / cpuid.h
index ee61da85d5035de4556a43fcf08254929fdf2f43..7bf903a6db397af69c454cd20eab3a061d1b084a 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdint.h>
 
 /**
- * enum cpuid - stuff to get information on from the CPU.
+ * enum cpuid - stuff to get information about from the CPU.
  *
  * This is used as a parameter in cpuid().
  *
@@ -124,14 +124,17 @@ typedef enum cputype {
  *
  * See also: cpuid_get_cpu_type_string()
  */
+#define is_intel_cpu()         cpuid_get_cpu_type() == CT_INTEL
+#define is_amd_cpu()   cpuid_get_cpu_type() == CT_AMDK5 || cpuid_get_cpu_type() == CT_AMD
 cputype_t cpuid_get_cpu_type(void);
 
 /**
- * cpuid_get_cpu_type_string - Get CPU Type string
+ * cpuid_sprintf_cputype - Get CPU Type string
+ * @cputype: a char of atleast 12 bytes in it.
  *
- * Returns the CPU type string based off cputype_t.
+ * Returns true on success, false on failure
  */
-const char *cpuid_get_cpu_type_string(const cputype_t cputype);
+bool cpuid_sprintf_cputype(const cputype_t cputype, char *buf);
 
 /**
  * cpuid_is_supported - test if the CPUID instruction is supported
@@ -275,4 +278,3 @@ bool cpuid_has_feature(int feature, bool extended);
 
 #endif
 #endif
-