affs.h (cf9ce948f47640797bd19980e1d99c6d17d0bdc3) affs.h (8ca577223f75230a746a06f4566c53943f78d5d0)
1#include <linux/types.h>
2#include <linux/fs.h>
3#include <linux/buffer_head.h>
4#include <linux/amigaffs.h>
5#include <linux/mutex.h>
6#include <linux/workqueue.h>
7
1#include <linux/types.h>
2#include <linux/fs.h>
3#include <linux/buffer_head.h>
4#include <linux/amigaffs.h>
5#include <linux/mutex.h>
6#include <linux/workqueue.h>
7
8/* AmigaOS allows file names with up to 30 characters length.
9 * Names longer than that will be silently truncated. If you
10 * want to disallow this, comment out the following #define.
11 * Creating filesystem objects with longer names will then
12 * result in an error (ENAMETOOLONG).
13 */
14/*#define AFFS_NO_TRUNCATE */
15
16/* Ugly macros make the code more pretty. */
17
18#define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st))))
19#define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey])
20#define AFFS_BLOCK(sb, bh, blk) (AFFS_HEAD(bh)->table[AFFS_SB(sb)->s_hashsize-1-(blk)])
21
22#define AFFS_HEAD(bh) ((struct affs_head *)(bh)->b_data)
23#define AFFS_TAIL(sb, bh) ((struct affs_tail *)((bh)->b_data+(sb)->s_blocksize-sizeof(struct affs_tail)))
24#define AFFS_ROOT_HEAD(bh) ((struct affs_root_head *)(bh)->b_data)
25#define AFFS_ROOT_TAIL(sb, bh) ((struct affs_root_tail *)((bh)->b_data+(sb)->s_blocksize-sizeof(struct affs_root_tail)))
26#define AFFS_DATA_HEAD(bh) ((struct affs_data_head *)(bh)->b_data)
27#define AFFS_DATA(bh) (((struct affs_data_head *)(bh)->b_data)->data)
28
29#define AFFS_CACHE_SIZE PAGE_SIZE
30
8/* Ugly macros make the code more pretty. */
9
10#define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st))))
11#define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey])
12#define AFFS_BLOCK(sb, bh, blk) (AFFS_HEAD(bh)->table[AFFS_SB(sb)->s_hashsize-1-(blk)])
13
14#define AFFS_HEAD(bh) ((struct affs_head *)(bh)->b_data)
15#define AFFS_TAIL(sb, bh) ((struct affs_tail *)((bh)->b_data+(sb)->s_blocksize-sizeof(struct affs_tail)))
16#define AFFS_ROOT_HEAD(bh) ((struct affs_root_head *)(bh)->b_data)
17#define AFFS_ROOT_TAIL(sb, bh) ((struct affs_root_tail *)((bh)->b_data+(sb)->s_blocksize-sizeof(struct affs_root_tail)))
18#define AFFS_DATA_HEAD(bh) ((struct affs_data_head *)(bh)->b_data)
19#define AFFS_DATA(bh) (((struct affs_data_head *)(bh)->b_data)->data)
20
21#define AFFS_CACHE_SIZE PAGE_SIZE
22
31#define AFFS_MAX_PREALLOC 32
32#define AFFS_LC_SIZE (AFFS_CACHE_SIZE/sizeof(u32)/2)
33#define AFFS_AC_SIZE (AFFS_CACHE_SIZE/sizeof(struct affs_ext_key)/2)
34#define AFFS_AC_MASK (AFFS_AC_SIZE-1)
35
36struct affs_ext_key {
37 u32 ext; /* idx of the extended block */
38 u32 key; /* block number */
39};

--- 73 unchanged lines hidden (view full) ---

113#define SF_QUIET 0x0008 /* chmod errors will be not reported */
114#define SF_SETUID 0x0010 /* Ignore Amiga uid */
115#define SF_SETGID 0x0020 /* Ignore Amiga gid */
116#define SF_SETMODE 0x0040 /* Ignore Amiga protection bits */
117#define SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */
118#define SF_OFS 0x0200 /* Old filesystem */
119#define SF_PREFIX 0x0400 /* Buffer for prefix is allocated */
120#define SF_VERBOSE 0x0800 /* Talk about fs when mounting */
23#define AFFS_LC_SIZE (AFFS_CACHE_SIZE/sizeof(u32)/2)
24#define AFFS_AC_SIZE (AFFS_CACHE_SIZE/sizeof(struct affs_ext_key)/2)
25#define AFFS_AC_MASK (AFFS_AC_SIZE-1)
26
27struct affs_ext_key {
28 u32 ext; /* idx of the extended block */
29 u32 key; /* block number */
30};

--- 73 unchanged lines hidden (view full) ---

104#define SF_QUIET 0x0008 /* chmod errors will be not reported */
105#define SF_SETUID 0x0010 /* Ignore Amiga uid */
106#define SF_SETGID 0x0020 /* Ignore Amiga gid */
107#define SF_SETMODE 0x0040 /* Ignore Amiga protection bits */
108#define SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */
109#define SF_OFS 0x0200 /* Old filesystem */
110#define SF_PREFIX 0x0400 /* Buffer for prefix is allocated */
111#define SF_VERBOSE 0x0800 /* Talk about fs when mounting */
112#define SF_NO_TRUNCATE 0x1000 /* Don't truncate filenames */
121
122/* short cut to get to the affs specific sb data */
123static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
124{
125 return sb->s_fs_info;
126}
127
128void affs_mark_sb_dirty(struct super_block *sb);
129
130/* amigaffs.c */
131
132extern int affs_insert_hash(struct inode *inode, struct buffer_head *bh);
133extern int affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh);
134extern int affs_remove_header(struct dentry *dentry);
135extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
136extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
137extern void secs_to_datestamp(time_t secs, struct affs_date *ds);
138extern umode_t prot_to_mode(u32 prot);
139extern void mode_to_prot(struct inode *inode);
113
114/* short cut to get to the affs specific sb data */
115static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
116{
117 return sb->s_fs_info;
118}
119
120void affs_mark_sb_dirty(struct super_block *sb);
121
122/* amigaffs.c */
123
124extern int affs_insert_hash(struct inode *inode, struct buffer_head *bh);
125extern int affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh);
126extern int affs_remove_header(struct dentry *dentry);
127extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
128extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
129extern void secs_to_datestamp(time_t secs, struct affs_date *ds);
130extern umode_t prot_to_mode(u32 prot);
131extern void mode_to_prot(struct inode *inode);
140extern void affs_error(struct super_block *sb, const char *function, const char *fmt, ...);
141extern void affs_warning(struct super_block *sb, const char *function, const char *fmt, ...);
142extern int affs_check_name(const unsigned char *name, int len);
132extern void affs_error(struct super_block *sb, const char *function,
133 const char *fmt, ...);
134extern void affs_warning(struct super_block *sb, const char *function,
135 const char *fmt, ...);
136extern bool affs_nofilenametruncate(const struct dentry *dentry);
137extern int affs_check_name(const unsigned char *name, int len,
138 bool notruncate);
143extern int affs_copy_name(unsigned char *bstr, struct dentry *dentry);
144
145/* bitmap. c */
146
147extern u32 affs_count_free_blocks(struct super_block *s);
148extern void affs_free_block(struct super_block *sb, u32 block);
149extern u32 affs_alloc_block(struct inode *inode, u32 goal);
150extern int affs_init_bitmap(struct super_block *sb, int *flags);

--- 154 unchanged lines hidden ---
139extern int affs_copy_name(unsigned char *bstr, struct dentry *dentry);
140
141/* bitmap. c */
142
143extern u32 affs_count_free_blocks(struct super_block *s);
144extern void affs_free_block(struct super_block *sb, u32 block);
145extern u32 affs_alloc_block(struct inode *inode, u32 goal);
146extern int affs_init_bitmap(struct super_block *sb, int *flags);

--- 154 unchanged lines hidden ---