This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / fs / intermezzo / kml_setup.c
1 #include <linux/errno.h>
2 #include <linux/slab.h>
3 #include <linux/vmalloc.h>
4 #include <linux/module.h>
5 #include <asm/uaccess.h>
6
7 #include "intermezzo_fs.h"
8 #include "intermezzo_upcall.h"
9 #include "intermezzo_psdev.h"
10 #include "intermezzo_kml.h"
11
12 int kml_init (struct presto_file_set *fset)
13 {
14         struct kml_fsdata *data;
15
16         ENTRY;
17         PRESTO_ALLOC (data, struct kml_fsdata *, sizeof (struct kml_fsdata));
18         if (data == NULL) {
19                 EXIT;
20                 return -ENOMEM;
21         }
22         INIT_LIST_HEAD (&data->kml_reint_cache);
23         INIT_LIST_HEAD (&data->kml_kop_cache);
24
25         PRESTO_ALLOC (data->kml_buf, char *, KML_REINT_MAXBUF);
26         if (data->kml_buf == NULL) {
27                 PRESTO_FREE (data, sizeof (struct kml_fsdata));
28                 EXIT;
29                 return -ENOMEM;
30         }
31
32         data->kml_maxsize = KML_REINT_MAXBUF;
33         data->kml_len = 0;
34         data->kml_reintpos = 0;
35         data->kml_count = 0;
36         fset->fset_kmldata = data;
37         EXIT;
38         return 0;
39 }
40
41 int kml_cleanup (struct presto_file_set *fset)
42 {
43         struct kml_fsdata *data = fset->fset_kmldata;
44
45         if (data == NULL)
46                 return 0;
47
48         fset->fset_kmldata = NULL;
49 #if 0
50         kml_sop_cleanup (&data->kml_reint_cache);
51         kml_kop_cleanup (&data->kml_kop_cache);
52 #endif
53         PRESTO_FREE (data->kml_buf, KML_REINT_MAXBUF);
54         PRESTO_FREE (data, sizeof (struct kml_fsdata));
55         return 0;
56 }
57
58