library: ensure the consistent handling of 'noop' enum
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
9d1073a22a
commit
53b33a1ab8
12
proc/slab.c
12
proc/slab.c
@ -392,7 +392,9 @@ PROCPS_EXPORT unsigned long procps_slabs_get (
|
|||||||
case PROCPS_SLABS_SIZE_ACTIVE:
|
case PROCPS_SLABS_SIZE_ACTIVE:
|
||||||
return info->stats.active_size;
|
return info->stats.active_size;
|
||||||
case PROCPS_SLABS_noop:
|
case PROCPS_SLABS_noop:
|
||||||
break;
|
return 0;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -442,6 +444,9 @@ PROCPS_EXPORT int procps_slabs_getchain (
|
|||||||
case PROCPS_SLABS_SIZE_ACTIVE:
|
case PROCPS_SLABS_SIZE_ACTIVE:
|
||||||
these->result = info->stats.active_size;
|
these->result = info->stats.active_size;
|
||||||
break;
|
break;
|
||||||
|
case PROCPS_SLABS_noop:
|
||||||
|
these->result = 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -498,9 +503,9 @@ PROCPS_EXPORT unsigned long procps_slabnode_get (
|
|||||||
return info->nodes[nodeid].nr_active_slabs;
|
return info->nodes[nodeid].nr_active_slabs;
|
||||||
case PROCPS_SLABNODE_USE:
|
case PROCPS_SLABNODE_USE:
|
||||||
return info->nodes[nodeid].use;
|
return info->nodes[nodeid].use;
|
||||||
case PROCPS_SLABNODE_NAME:
|
|
||||||
case PROCPS_SLABNODE_noop:
|
case PROCPS_SLABNODE_noop:
|
||||||
return 0;
|
return 0;
|
||||||
|
// PROCPS_SLABNODE_NAME also invalid in this context
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -550,6 +555,7 @@ PROCPS_EXPORT int procps_slabnode_getchain (
|
|||||||
these->result.str = info->nodes[nodeid].name;
|
these->result.str = info->nodes[nodeid].name;
|
||||||
break;
|
break;
|
||||||
case PROCPS_SLABNODE_noop:
|
case PROCPS_SLABNODE_noop:
|
||||||
|
these->result.num = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -805,7 +811,7 @@ PROCPS_EXPORT struct slabnode_chain **procps_slabnode_chains_sort (
|
|||||||
|
|
||||||
if (info == NULL || chains == NULL)
|
if (info == NULL || chains == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (sort < 0 || sort >= PROCPS_SLABNODE_noop)
|
if (sort < 0 || sort > PROCPS_SLABNODE_noop)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (numchained > info->chained->depth)
|
if (numchained > info->chained->depth)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user