1 #include <linux/fs.h>
2 #include <linux/minix_fs.h>
3 #include <linux/locks.h>
4 #include <linux/smp_lock.h>
5 
6 enum {DEPTH = 3, DIRECT = 7};	/* Only double indirect */
7 
8 typedef u16 block_t;	/* 16 bit, host order */
9 
block_to_cpu(block_t n)10 static inline unsigned long block_to_cpu(block_t n)
11 {
12 	return n;
13 }
14 
cpu_to_block(unsigned long n)15 static inline block_t cpu_to_block(unsigned long n)
16 {
17 	return n;
18 }
19 
i_data(struct inode * inode)20 static inline block_t *i_data(struct inode *inode)
21 {
22 	return (block_t *)inode->u.minix_i.u.i1_data;
23 }
24 
block_to_path(struct inode * inode,long block,int offsets[DEPTH])25 static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
26 {
27 	int n = 0;
28 
29 	if (block < 0) {
30 		printk("minix_bmap: block<0");
31 	} else if (block >= (inode->i_sb->u.minix_sb.s_max_size/BLOCK_SIZE)) {
32 		printk("minix_bmap: block>big");
33 	} else if (block < 7) {
34 		offsets[n++] = block;
35 	} else if ((block -= 7) < 512) {
36 		offsets[n++] = 7;
37 		offsets[n++] = block;
38 	} else {
39 		block -= 512;
40 		offsets[n++] = 8;
41 		offsets[n++] = block>>9;
42 		offsets[n++] = block & 511;
43 	}
44 	return n;
45 }
46 
47 #include "itree_common.c"
48 
V1_minix_get_block(struct inode * inode,long block,struct buffer_head * bh_result,int create)49 int V1_minix_get_block(struct inode * inode, long block,
50 			struct buffer_head *bh_result, int create)
51 {
52 	return get_block(inode, block, bh_result, create);
53 }
54 
V1_minix_truncate(struct inode * inode)55 void V1_minix_truncate(struct inode * inode)
56 {
57 	truncate(inode);
58 }
59