ia64/xen-unstable

view tools/vnet/libxutil/sys_string.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents 06d84bf87159
children
line source
1 /*
2 * Copyright (C) 2001 - 2004 Mike Wray <mike.wray@hp.com>
3 *
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #ifndef _XUTIL_SYS_STRING_H_
20 #define _XUTIL_SYS_STRING_H_
21 /** @file
22 * Replacement for standard string includes.
23 * Works in user or kernel code.
24 */
25 /*============================================================================*/
26 #ifdef __KERNEL__
28 #include <linux/config.h>
29 #include <linux/kernel.h>
30 #include <linux/string.h>
31 #include <linux/types.h>
32 #include <stdarg.h>
33 #include "allocate.h"
35 extern char *strerror(int err);
37 #if 0
38 static inline int tolower(int c){
39 return (c>='A' && c<='Z' ? (c-'A')+'a' : c);
40 }
41 #endif
43 static inline int isalpha(int c){
44 return (c>='A' && c<='Z') || (c>='a' && c<='z');
45 }
47 static inline int isdigit(int c){
48 return (c>='0' && c<='9');
49 }
51 #if 0
52 static inline int strcasecmp(const char *s1, const char *s2){
53 int c1, c2;
55 do {
56 c1 = tolower(*s1++);
57 c2 = tolower(*s2++);
58 } while (c1 && c1 == c2);
59 return c1 - c2;
60 }
61 #endif
63 static inline char * strdup(const char *s){
64 int n = (s ? 1+strlen(s) : 0);
65 char *copy = (n ? allocate(n) : NULL);
66 if(copy){
67 strcpy(copy, s);
68 }
69 return copy;
70 }
72 /*============================================================================*/
73 #else
74 #include <string.h>
75 #include <stdio.h>
77 #ifndef _GNU_SOURCE
78 static inline size_t strnlen(const char *s, size_t n){
79 int k = 0;
80 if(s){
81 for(k=0; *s && k<n; s++, k++){}
82 }
83 return k;
84 }
85 #endif
87 #endif
88 /*============================================================================*/
90 extern int convert_atoul(const char *s, unsigned long *v);
91 extern int convert_atol(const char *s, long *v);
92 extern int path_concat(char *s, char *t, char **val);
94 #endif /* !_XUTIL_SYS_STRING_H_ */