~ubuntu-branches/ubuntu/utopic/numactl/utopic-proposed

« back to all changes in this revision

Viewing changes to affinity.c

  • Committer: Package Import Robot
  • Author(s): Ian Wienand
  • Date: 2012-11-15 12:20:29 UTC
  • mfrom: (1.3.9)
  • Revision ID: package-import@ubuntu.com-20121115122029-df53pmew2v1ydcsg
Tags: 2.0.8-1
New upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include "affinity.h"
50
50
#include "rtnetlink.h"
51
51
 
52
 
static int badchar(char *s)
 
52
static int badchar(const char *s)
53
53
{
54
54
        if (strpbrk(s, "/."))
55
55
                return 1;
56
56
        return 0;
57
57
}
58
58
 
59
 
static int node_parse_failure(int ret, char *cls, char *dev)
 
59
static int node_parse_failure(int ret, char *cls, const char *dev)
60
60
{
61
61
        if (!cls)
62
62
                cls = "";
72
72
}
73
73
 
74
74
/* Generic sysfs class lookup */
75
 
static int affinity_class(struct bitmask *mask, char *cls, char *dev)
 
75
static int
 
76
affinity_class(struct bitmask *mask, char *cls, const const char *dev)
76
77
{
77
78
        int ret;
78
79
        while (isspace(*dev))
121
122
 
122
123
 
123
124
/* Turn file (or device node) into class name */
124
 
static int affinity_file(struct bitmask *mask, char *cls, char *file)
 
125
static int affinity_file(struct bitmask *mask, char *cls, const char *file)
125
126
{
126
127
        struct stat st;
127
128
        DIR *dir;
249
250
   This generally only attempts to handle simple cases:
250
251
   no multi-path, no bounding etc. In these cases only
251
252
   the first interface or none is chosen. */
252
 
static int affinity_ip(struct bitmask *mask, char *cls, char *id)
 
253
static int affinity_ip(struct bitmask *mask, char *cls, const char *id)
253
254
{
254
255
        struct addrinfo *ai;
255
256
        int n;
279
280
}
280
281
 
281
282
/* Look up affinity for a PCI device */
282
 
static int affinity_pci(struct bitmask *mask, char *cls, char *id)
 
283
static int affinity_pci(struct bitmask *mask, char *cls, const char *id)
283
284
{
284
285
        unsigned seg, bus, dev, func;
285
286
        int n, ret;
310
311
        char first;
311
312
        char *name;
312
313
        char *cls;
313
 
        int (*handler)(struct bitmask *mask, char *cls, char *desc);
 
314
        int (*handler)(struct bitmask *mask, char *cls, const char *desc);
314
315
} handlers[] = {
315
316
        { 'n', "netdev:", "net",   affinity_class },
316
317
        { 'i', "ip:",     NULL,    affinity_ip    },
320
321
        {}
321
322
};
322
323
 
323
 
hidden int resolve_affinity(char *id, struct bitmask *mask)
 
324
hidden int resolve_affinity(const char *id, struct bitmask *mask)
324
325
{
325
326
        struct handler *h;
326
327