more changes on original files
[linux-2.4.git] / fs / befs / attribute.c
1 /*
2  * linux/fs/befs/attribute.c
3  *
4  * Copyright (C) 2002 Will Dyson <will_dyson@pobox.com>
5  *
6  * Many thanks to Dominic Giampaolo, author of "Practical File System
7  * Design with the Be File System", for such a helpful book.
8  *
9  */
10
11 #include <linux/fs.h>
12 #include <linux/kernel.h>
13 #include <linux/string.h>
14
15 #include "befs.h"
16 #include "endian.h"
17
18 #define SD_DATA(sd)\
19         (void*)((char*)sd + sizeof(*sd) + (sd->name_size - sizeof(sd->name)))
20
21 #define SD_NEXT(sd)\
22         (befs_small_data*)((char*)sd + sizeof(*sd) + (sd->name_size - \
23         sizeof(sd->name) + sd->data_size))
24
25 int
26  list_small_data(struct super_block *sb, befs_inode * inode, filldir_t filldir);
27
28 befs_small_data *find_small_data(struct super_block *sb, befs_inode * inode,
29                                  const char *name);
30 int
31  read_small_data(struct super_block *sb, befs_inode * inode,
32                  befs_small_data * sdata, void *buf, size_t bufsize);
33
34 /**
35  *
36  *
37  *
38  *
39  *
40  */
41 befs_small_data *
42 find_small_data(struct super_block *sb, befs_inode * inode, const char *name)
43 {
44         befs_small_data *sdata = inode->small_data;
45
46         while (sdata->type != 0) {
47                 if (strcmp(name, sdata->name) != 0) {
48                         return sdata;
49                 }
50                 sdata = SD_NEXT(sdata);
51         }
52         return NULL;
53 }
54
55 /**
56  *
57  *
58  *
59  *
60  *
61  */
62 int
63 read_small_data(struct super_block *sb, befs_inode * inode,
64                 const char *name, void *buf, size_t bufsize)
65 {
66         befs_small_data *sdata;
67
68         sdata = find_small_data(sb, inode, name);
69         if (sdata == NULL)
70                 return BEFS_ERR;
71         else if (sdata->data_size > bufsize)
72                 return BEFS_ERR;
73
74         memcpy(buf, SD_DATA(sdata), sdata->data_size);
75
76         return BEFS_OK;
77 }
78
79 /**
80  *
81  *
82  *
83  *
84  *
85  */
86 int
87 list_small_data(struct super_block *sb, befs_inode * inode)
88 {
89
90 }
91
92 /**
93  *
94  *
95  *
96  *
97  *
98  */
99 int
100 list_attr(struct super_block *sb, befs_inode * inode)
101 {
102
103 }
104
105 /**
106  *
107  *
108  *
109  *
110  *
111  */
112 int
113 read_attr(struct super_block *sb, befs_inode * inode)
114 {
115
116 }