summaryrefslogtreecommitdiff
path: root/fs/intermezzo/kml_utils.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:33:15 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:33:15 -0800
commitd40d1af9f0aebf7e108f1dfb66ac5af671bc9719 (patch)
tree7a2518e82986a8eb5b4eb76553df04d8ba6e4642 /fs/intermezzo/kml_utils.c
parenta8a2069f432c5597bdf9c83ab3045b9ef32ab5e3 (diff)
v2.4.14.2 -> v2.4.14.3
- Alan Cox: more driver merging - Al Viro: make ext2 group allocation more readable
Diffstat (limited to 'fs/intermezzo/kml_utils.c')
-rw-r--r--fs/intermezzo/kml_utils.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/intermezzo/kml_utils.c b/fs/intermezzo/kml_utils.c
new file mode 100644
index 000000000000..b1c60f90deab
--- /dev/null
+++ b/fs/intermezzo/kml_utils.c
@@ -0,0 +1,44 @@
+#include <linux/list.h>
+#include <linux/mm.h>
+#include <linux/smp_lock.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+
+#include <linux/intermezzo_fs.h>
+#include <linux/intermezzo_kml.h>
+
+
+// dlogit -- oppsite to logit ()
+// return the sbuf + size;
+char *dlogit (void *tbuf, const void *sbuf, int size)
+{
+ char *ptr = (char *)sbuf;
+ memcpy(tbuf, ptr, size);
+ ptr += size;
+ return ptr;
+}
+
+static spinlock_t kml_lock = SPIN_LOCK_UNLOCKED;
+static char buf[1024];
+char * bdup_printf (char *format, ...)
+{
+ va_list args;
+ int i;
+ char *path;
+ long flags;
+
+ spin_lock_irqsave(&kml_lock, flags);
+ va_start(args, format);
+ i = vsprintf(buf, format, args); /* hopefully i < sizeof(buf) */
+ va_end(args);
+
+ PRESTO_ALLOC (path, char *, i + 1);
+ if (path == NULL)
+ return NULL;
+ strcpy (path, buf);
+
+ spin_unlock_irqrestore(&kml_lock, flags);
+ return path;
+}
+
+