This source file includes following definitions.
- affs_get_key_entry
- affs_find_next_hash_entry
- affs_get_fh_hash_link
- affs_get_file_name
- affs_get_extension
- affs_checksum_block
- init_affs_fs
- init_module
- cleanup_module
1
2
3
4
5
6
7
8
9
10
11 #include <linux/module.h>
12
13 #include <linux/fs.h>
14 #include <linux/affs_fs.h>
15 #include <linux/mm.h>
16
17 #include "amigaffs.h"
18
19
20
21
22
23
24
25
26
27
28
29
30 int affs_get_key_entry (int bsize, void *data, int entry_pos)
31 {
32 struct dir_front *dir_front = (struct dir_front *)data;
33 int key, hash_table_size;
34
35 hash_table_size = MIDBLOCK_LONGS (bsize);
36 key = 0;
37 if (entry_pos >= 0 && entry_pos < hash_table_size)
38 key = swap_long (dir_front->hash_table[entry_pos]);
39
40 return key;
41 }
42
43
44
45
46
47
48
49 int affs_find_next_hash_entry (int bsize, void *dir_data, int *hash_pos)
50 {
51 struct dir_front *dir_front = (struct dir_front *)dir_data;
52 int i, hash_table_size;
53
54 hash_table_size = MIDBLOCK_LONGS (bsize);
55 if (*hash_pos < 0 || *hash_pos >= hash_table_size)
56 return -1;
57 for (i = *hash_pos; i < hash_table_size; i++)
58 if (dir_front->hash_table[i] != 0)
59 break;
60 if (i == hash_table_size)
61 return 0;
62 *hash_pos = i;
63 return swap_long (dir_front->hash_table[i]);
64 }
65
66
67
68
69 int affs_get_fh_hash_link (int bsize, void *fh_data)
70 {
71 struct file_end *file_end;
72 int key;
73
74 file_end = GET_END_PTR (struct file_end, fh_data, bsize);
75 key = swap_long (file_end->hash_chain);
76 return key;
77 }
78
79
80
81
82 int affs_get_file_name (int bsize, void *fh_data, char **name)
83 {
84 struct file_end *file_end;
85
86 file_end = GET_END_PTR (struct file_end, fh_data, bsize);
87 if (file_end->file_name[0] == 0
88 || file_end->file_name[0] > 30) {
89 printk ("affs_get_file_name: OOPS! bad filename\n");
90 printk (" file_end->file_name[0] = %d\n",
91 file_end->file_name[0]);
92 *name = "***BAD_FILE***";
93 return 14;
94 }
95 *name = (char *) &file_end->file_name[1];
96 return file_end->file_name[0];
97 }
98
99
100
101
102 int affs_get_extension (int bsize, void *fh_data)
103 {
104 struct file_end *file_end;
105 int key;
106
107 file_end = GET_END_PTR (struct file_end, fh_data, bsize);
108 key = swap_long (file_end->extension);
109 return key;
110 }
111
112
113
114
115
116
117
118 int affs_checksum_block (int bsize, void *data, int *ptype, int *stype)
119 {
120 if (ptype)
121 *ptype = swap_long (((long *) data)[0]);
122 if (stype)
123 *stype = swap_long (((long *) data)[bsize / 4 - 1]);
124 return 0;
125 }
126
127 static struct file_system_type affs_fs_type = {
128 affs_read_super, "affs", 1, NULL
129 };
130
131 int init_affs_fs(void)
132 {
133 return register_filesystem(&affs_fs_type);
134 }
135
136 #ifdef MODULE
137 int init_module(void)
138 {
139 int status;
140
141 if ((status = init_affs_fs()) == 0)
142 register_symtab(0);
143 return status;
144 }
145
146 void cleanup_module(void)
147 {
148 unregister_filesystem(&affs_fs_type);
149 }
150
151 #endif
152