{
xen_sysctl_cputopo_t cputopo = { 0 };
- if ( ti->num_cpus < num_cpus )
- {
- ret = -ENOBUFS;
- i = num_cpus;
- }
- else
- i = 0;
-
- for ( ; i < num_cpus; i++ )
+ if ( num_cpus > ti->num_cpus )
+ num_cpus = ti->num_cpus;
+ for ( i = 0; i < num_cpus; ++i )
{
if ( cpu_present(i) )
{
else
i = num_cpus;
- if ( (!ret || (ret == -ENOBUFS)) && (ti->num_cpus != i) )
+ if ( !ret && (ti->num_cpus != i) )
{
ti->num_cpus = i;
if ( __copy_field_to_guest(u_sysctl, op,
* - otherwise it's the number of entries in 'cputopo'
*
* OUT:
- * - If 'num_cpus' is less than the number Xen needs to write, -ENOBUFS shall
- * be returned and 'num_cpus' updated to reflect the intended number.
- * - On success, 'num_cpus' shall indicate the number of entries written, which
- * may be less than the maximum.
+ * - If 'num_cpus' is less than the number Xen wants to write but the handle
+ * handle is not a NULL one, partial data gets returned and 'num_cpus' gets
+ * updated to reflect the intended number.
+ * - Otherwise, 'num_cpus' shall indicate the number of entries written, which
+ * may be less than the input value.
*/
struct xen_sysctl_cputopoinfo {
uint32_t num_cpus;