cpumask: change cpumask_scnprintf, cpumask_parse_user, cpulist_parse, and cpulist_scnprintf to take pointers.
Impact: change calling convention of existing cpumask APIs Most cpumask functions started with cpus_: these have been replaced by cpumask_ ones which take struct cpumask pointers as expected. These four functions don't have good replacement names; fortunately they're rarely used, so we just change them over. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Mike Travis <travis@sgi.com> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: paulus@samba.org Cc: mingo@redhat.com Cc: tony.luck@intel.com Cc: ralf@linux-mips.org Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: cl@linux-foundation.org Cc: srostedt@redhat.com
This commit is contained in:
@@ -339,36 +339,6 @@ extern cpumask_t cpu_mask_all;
|
||||
#endif
|
||||
#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v)
|
||||
|
||||
#define cpumask_scnprintf(buf, len, src) \
|
||||
__cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
|
||||
static inline int __cpumask_scnprintf(char *buf, int len,
|
||||
const cpumask_t *srcp, int nbits)
|
||||
{
|
||||
return bitmap_scnprintf(buf, len, srcp->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpumask_parse_user(ubuf, ulen, dst) \
|
||||
__cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
|
||||
static inline int __cpumask_parse_user(const char __user *buf, int len,
|
||||
cpumask_t *dstp, int nbits)
|
||||
{
|
||||
return bitmap_parse_user(buf, len, dstp->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpulist_scnprintf(buf, len, src) \
|
||||
__cpulist_scnprintf((buf), (len), &(src), NR_CPUS)
|
||||
static inline int __cpulist_scnprintf(char *buf, int len,
|
||||
const cpumask_t *srcp, int nbits)
|
||||
{
|
||||
return bitmap_scnlistprintf(buf, len, srcp->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpulist_parse(buf, dst) __cpulist_parse((buf), &(dst), NR_CPUS)
|
||||
static inline int __cpulist_parse(const char *buf, cpumask_t *dstp, int nbits)
|
||||
{
|
||||
return bitmap_parselist(buf, dstp->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpu_remap(oldbit, old, new) \
|
||||
__cpu_remap((oldbit), &(old), &(new), NR_CPUS)
|
||||
static inline int __cpu_remap(int oldbit,
|
||||
@@ -945,6 +915,63 @@ static inline void cpumask_copy(struct cpumask *dstp,
|
||||
*/
|
||||
#define cpumask_of(cpu) (get_cpu_mask(cpu))
|
||||
|
||||
/**
|
||||
* cpumask_scnprintf - print a cpumask into a string as comma-separated hex
|
||||
* @buf: the buffer to sprintf into
|
||||
* @len: the length of the buffer
|
||||
* @srcp: the cpumask to print
|
||||
*
|
||||
* If len is zero, returns zero. Otherwise returns the length of the
|
||||
* (nul-terminated) @buf string.
|
||||
*/
|
||||
static inline int cpumask_scnprintf(char *buf, int len,
|
||||
const struct cpumask *srcp)
|
||||
{
|
||||
return bitmap_scnprintf(buf, len, srcp->bits, nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* cpumask_parse_user - extract a cpumask from a user string
|
||||
* @buf: the buffer to extract from
|
||||
* @len: the length of the buffer
|
||||
* @dstp: the cpumask to set.
|
||||
*
|
||||
* Returns -errno, or 0 for success.
|
||||
*/
|
||||
static inline int cpumask_parse_user(const char __user *buf, int len,
|
||||
struct cpumask *dstp)
|
||||
{
|
||||
return bitmap_parse_user(buf, len, dstp->bits, nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* cpulist_scnprintf - print a cpumask into a string as comma-separated list
|
||||
* @buf: the buffer to sprintf into
|
||||
* @len: the length of the buffer
|
||||
* @srcp: the cpumask to print
|
||||
*
|
||||
* If len is zero, returns zero. Otherwise returns the length of the
|
||||
* (nul-terminated) @buf string.
|
||||
*/
|
||||
static inline int cpulist_scnprintf(char *buf, int len,
|
||||
const struct cpumask *srcp)
|
||||
{
|
||||
return bitmap_scnlistprintf(buf, len, srcp->bits, nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* cpulist_parse_user - extract a cpumask from a user string of ranges
|
||||
* @buf: the buffer to extract from
|
||||
* @len: the length of the buffer
|
||||
* @dstp: the cpumask to set.
|
||||
*
|
||||
* Returns -errno, or 0 for success.
|
||||
*/
|
||||
static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
|
||||
{
|
||||
return bitmap_parselist(buf, dstp->bits, nr_cpumask_bits);
|
||||
}
|
||||
|
||||
/**
|
||||
* to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
|
||||
* @bitmap: the bitmap
|
||||
|
Reference in New Issue
Block a user