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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [fs/] [bad_inode.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1627 jcastillo
/*
2
 *  linux/fs/bad_inode.c
3
 *
4
 *  Copyright (C) 1997, Stephen Tweedie
5
 *
6
 *  Provide stub functions for unreadable inodes
7
 */
8
 
9
#include <linux/fs.h>
10
#include <linux/stat.h>
11
#include <linux/sched.h>
12
 
13
static int return_EIO(void)
14
{
15
        return -EIO;
16
}
17
 
18
#define EIO_ERROR ((void *) (return_EIO))
19
 
20
static struct file_operations bad_file_ops =
21
{
22
        EIO_ERROR,              /* lseek */
23
        EIO_ERROR,              /* read */
24
        EIO_ERROR,              /* write */
25
        EIO_ERROR,              /* readdir */
26
        EIO_ERROR,              /* select */
27
        EIO_ERROR,              /* ioctl */
28
        EIO_ERROR,              /* mmap */
29
        EIO_ERROR,              /* open */
30
        EIO_ERROR,              /* release */
31
        EIO_ERROR,              /* fsync */
32
        EIO_ERROR,              /* fasync */
33
        EIO_ERROR,              /* check_media_change */
34
        EIO_ERROR               /* revalidate */
35
#ifdef MAGIC_ROM_PTR
36
        ,EIO_ERROR              /* romptr */
37
#endif /* MAGIC_ROM_PTR */
38
};
39
 
40
static struct inode_operations bad_inode_ops =
41
{
42
        &bad_file_ops,          /* default file operations */
43
        EIO_ERROR,              /* create */
44
        EIO_ERROR,              /* lookup */
45
        EIO_ERROR,              /* link */
46
        EIO_ERROR,              /* unlink */
47
        EIO_ERROR,              /* symlink */
48
        EIO_ERROR,              /* mkdir */
49
        EIO_ERROR,              /* rmdir */
50
        EIO_ERROR,              /* mknod */
51
        EIO_ERROR,              /* rename */
52
        EIO_ERROR,              /* readlink */
53
        EIO_ERROR,              /* follow_link */
54
        EIO_ERROR,              /* readpage */
55
        EIO_ERROR,              /* writepage */
56
        EIO_ERROR,              /* bmap */
57
        EIO_ERROR,              /* truncate */
58
        EIO_ERROR,              /* permission */
59
        EIO_ERROR               /* smap */
60
};
61
 
62
 
63
/*
64
 * When a filesystem is unable to read an inode due to an I/O error in
65
 * its read_inode() function, it can call make_bad_inode() to return a
66
 * set of stubs which will return EIO errors as required.
67
 *
68
 * We only need to do limited initialisation: all other fields are
69
 * preinitialised to zero automatically.
70
 */
71
void make_bad_inode(struct inode * inode)
72
{
73
        inode->i_mode = S_IFREG;
74
        inode->i_flags = S_BAD_INODE;
75
        inode->i_atime = CURRENT_TIME;
76
        inode->i_mtime = CURRENT_TIME;
77
        inode->i_ctime = CURRENT_TIME;
78
        inode->i_op = &bad_inode_ops;
79
}
80
 

powered by: WebSVN 2.1.0

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