ia64/xen-unstable

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