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