This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / fs / intermezzo / kml_utils.c
1 #include <linux/list.h>
2 #include <linux/mm.h>
3 #include <linux/slab.h>
4 #include <linux/vmalloc.h>
5
6 #include "intermezzo_fs.h"
7 #include "intermezzo_kml.h"
8
9
10 // dlogit -- oppsite to logit ()
11 //         return the sbuf + size;
12 char *dlogit (void *tbuf, const void *sbuf, int size)
13 {
14         char *ptr = (char *)sbuf;
15         memcpy(tbuf, ptr, size);
16         ptr += size;
17         return ptr;
18 }
19
20 static spinlock_t kml_lock = SPIN_LOCK_UNLOCKED;
21 static char  buf[1024];
22 char * bdup_printf (char *format, ...)
23 {
24         va_list args;
25         int  i;
26         char *path;
27         unsigned long flags;
28
29         spin_lock_irqsave(&kml_lock, flags);
30         va_start(args, format);
31         i = vsprintf(buf, format, args); /* hopefully i < sizeof(buf) */
32         va_end(args);
33
34         PRESTO_ALLOC (path, char *, i + 1);
35         if (path == NULL)
36                 return NULL;
37         strcpy (path, buf);
38
39         spin_unlock_irqrestore(&kml_lock, flags);
40         return path;
41 }
42
43