aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpumask.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-12-13 05:50:25 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-12-13 05:50:25 -0500
commit29c0177e6a4ac094302bed54a1d4bbb6b740a9ef (patch)
treed8ee57c5b40baa3f53d607b719344dd20f8c85a0 /include/linux/cpumask.h
parent98a79d6a50181ca1ecf7400eda01d5dc1bc0dbf0 (diff)
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
Diffstat (limited to 'include/linux/cpumask.h')
-rw-r--r--include/linux/cpumask.h87
1 files changed, 57 insertions, 30 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 21e1dd43e52..94a2ab88ae8 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -339,36 +339,6 @@ extern cpumask_t cpu_mask_all;
339#endif 339#endif
340#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v) 340#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v)
341 341
342#define cpumask_scnprintf(buf, len, src) \
343 __cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
344static inline int __cpumask_scnprintf(char *buf, int len,
345 const cpumask_t *srcp, int nbits)
346{
347 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
348}
349
350#define cpumask_parse_user(ubuf, ulen, dst) \
351 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
352static inline int __cpumask_parse_user(const char __user *buf, int len,
353 cpumask_t *dstp, int nbits)
354{
355 return bitmap_parse_user(buf, len, dstp->bits, nbits);
356}
357
358#define cpulist_scnprintf(buf, len, src) \
359 __cpulist_scnprintf((buf), (len), &(src), NR_CPUS)
360static inline int __cpulist_scnprintf(char *buf, int len,
361 const cpumask_t *srcp, int nbits)
362{
363 return bitmap_scnlistprintf(buf, len, srcp->bits, nbits);
364}
365
366#define cpulist_parse(buf, dst) __cpulist_parse((buf), &(dst), NR_CPUS)
367static inline int __cpulist_parse(const char *buf, cpumask_t *dstp, int nbits)
368{
369 return bitmap_parselist(buf, dstp->bits, nbits);
370}
371
372#define cpu_remap(oldbit, old, new) \ 342#define cpu_remap(oldbit, old, new) \
373 __cpu_remap((oldbit), &(old), &(new), NR_CPUS) 343 __cpu_remap((oldbit), &(old), &(new), NR_CPUS)
374static inline int __cpu_remap(int oldbit, 344static inline int __cpu_remap(int oldbit,
@@ -946,6 +916,63 @@ static inline void cpumask_copy(struct cpumask *dstp,
946#define cpumask_of(cpu) (get_cpu_mask(cpu)) 916#define cpumask_of(cpu) (get_cpu_mask(cpu))
947 917
948/** 918/**
919 * cpumask_scnprintf - print a cpumask into a string as comma-separated hex
920 * @buf: the buffer to sprintf into
921 * @len: the length of the buffer
922 * @srcp: the cpumask to print
923 *
924 * If len is zero, returns zero. Otherwise returns the length of the
925 * (nul-terminated) @buf string.
926 */
927static inline int cpumask_scnprintf(char *buf, int len,
928 const struct cpumask *srcp)
929{
930 return bitmap_scnprintf(buf, len, srcp->bits, nr_cpumask_bits);
931}
932
933/**
934 * cpumask_parse_user - extract a cpumask from a user string
935 * @buf: the buffer to extract from
936 * @len: the length of the buffer
937 * @dstp: the cpumask to set.
938 *
939 * Returns -errno, or 0 for success.
940 */
941static inline int cpumask_parse_user(const char __user *buf, int len,
942 struct cpumask *dstp)
943{
944 return bitmap_parse_user(buf, len, dstp->bits, nr_cpumask_bits);
945}
946
947/**
948 * cpulist_scnprintf - print a cpumask into a string as comma-separated list
949 * @buf: the buffer to sprintf into
950 * @len: the length of the buffer
951 * @srcp: the cpumask to print
952 *
953 * If len is zero, returns zero. Otherwise returns the length of the
954 * (nul-terminated) @buf string.
955 */
956static inline int cpulist_scnprintf(char *buf, int len,
957 const struct cpumask *srcp)
958{
959 return bitmap_scnlistprintf(buf, len, srcp->bits, nr_cpumask_bits);
960}
961
962/**
963 * cpulist_parse_user - extract a cpumask from a user string of ranges
964 * @buf: the buffer to extract from
965 * @len: the length of the buffer
966 * @dstp: the cpumask to set.
967 *
968 * Returns -errno, or 0 for success.
969 */
970static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
971{
972 return bitmap_parselist(buf, dstp->bits, nr_cpumask_bits);
973}
974
975/**
949 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * 976 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
950 * @bitmap: the bitmap 977 * @bitmap: the bitmap
951 * 978 *