OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [minix/] [itree_v1.c] - Blame information for rev 1275

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#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
 
10
static inline unsigned long block_to_cpu(block_t n)
11
{
12
        return n;
13
}
14
 
15
static inline block_t cpu_to_block(unsigned long n)
16
{
17
        return n;
18
}
19
 
20
static inline block_t *i_data(struct inode *inode)
21
{
22
        return (block_t *)inode->u.minix_i.u.i1_data;
23
}
24
 
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
 
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
 
55
void V1_minix_truncate(struct inode * inode)
56
{
57
        truncate(inode);
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.