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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1628 jcastillo
/* -*- linux-c -*- --------------------------------------------------------- *
2
 *
3
 * linux/fs/autofs/dir.c
4
 *
5
 *  Copyright 1997 Transmeta Corporation -- All Rights Reserved
6
 *
7
 * This file is part of the Linux kernel and is made available under
8
 * the terms of the GNU General Public License, version 2, or at your
9
 * option, any later version, incorporated herein by reference.
10
 *
11
 * ------------------------------------------------------------------------- */
12
 
13
#include "autofs_i.h"
14
 
15
static int autofs_dir_readdir(struct inode *inode, struct file *filp,
16
                               void *dirent, filldir_t filldir)
17
{
18
        if (!inode || !S_ISDIR(inode->i_mode))
19
                return -ENOTDIR;
20
 
21
        switch((unsigned long) filp->f_pos)
22
        {
23
        case 0:
24
                if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0)
25
                        return 0;
26
                filp->f_pos++;
27
                /* fall through */
28
        case 1:
29
                if (filldir(dirent, "..", 2, 1, AUTOFS_ROOT_INO) < 0)
30
                        return 0;
31
                filp->f_pos++;
32
                /* fall through */
33
        }
34
        return 1;
35
}
36
 
37
static int autofs_dir_lookup(struct inode *dir, const char *name, int len,
38
                              struct inode **result)
39
{
40
        *result = dir;
41
        if (!len)
42
                return 0;
43
        if (name[0] == '.') {
44
                if (len == 1)
45
                        return 0;
46
                if (name[1] == '.' && len == 2) {
47
                        /* Return the root directory */
48
                        *result = iget(dir->i_sb,AUTOFS_ROOT_INO);
49
                        iput(dir);
50
                        return 0;
51
                }
52
        }
53
        *result = NULL;
54
        iput(dir);
55
        return -ENOENT;         /* No other entries */
56
}
57
 
58
static struct file_operations autofs_dir_operations = {
59
        NULL,                   /* lseek */
60
        NULL,                   /* read */
61
        NULL,                   /* write */
62
        autofs_dir_readdir,     /* readdir */
63
        NULL,                   /* select */
64
        NULL,                   /* ioctl */
65
        NULL,                   /* mmap */
66
        NULL,                   /* open */
67
        NULL,                   /* release */
68
        NULL                    /* fsync */
69
};
70
 
71
struct inode_operations autofs_dir_inode_operations = {
72
        &autofs_dir_operations, /* file operations */
73
        NULL,                   /* create */
74
        autofs_dir_lookup,      /* lookup */
75
        NULL,                   /* link */
76
        NULL,                   /* unlink */
77
        NULL,                   /* symlink */
78
        NULL,                   /* mkdir */
79
        NULL,                   /* rmdir */
80
        NULL,                   /* mknod */
81
        NULL,                   /* rename */
82
        NULL,                   /* readlink */
83
        NULL,                   /* follow_link */
84
        NULL,                   /* read_page */
85
        NULL,                   /* writepage */
86
        NULL,                   /* bmap */
87
        NULL,                   /* truncate */
88
        NULL                    /* permission */
89
};
90
 

powered by: WebSVN 2.1.0

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