Linux 2.2.0
[davej-history.git] / fs / autofs / dir.c
blob63efe9b870257d98061413b9a48f495768e54622
1 /* -*- linux-c -*- --------------------------------------------------------- *
3 * linux/fs/autofs/dir.c
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
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.
11 * ------------------------------------------------------------------------- */
13 #include "autofs_i.h"
15 static int autofs_dir_readdir(struct file *filp,
16 void *dirent, filldir_t filldir)
18 struct inode *inode=filp->f_dentry->d_inode;
19 if (!inode || !S_ISDIR(inode->i_mode))
20 return -ENOTDIR;
22 switch((unsigned long) filp->f_pos)
24 case 0:
25 if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0)
26 return 0;
27 filp->f_pos++;
28 /* fall through */
29 case 1:
30 if (filldir(dirent, "..", 2, 1, AUTOFS_ROOT_INO) < 0)
31 return 0;
32 filp->f_pos++;
33 /* fall through */
35 return 1;
39 * No entries except for "." and "..", both of which are handled by the VFS layer
41 static int autofs_dir_lookup(struct inode *dir, struct dentry * dentry)
43 d_add(dentry, NULL);
44 return 0;
47 static struct file_operations autofs_dir_operations = {
48 NULL, /* llseek */
49 NULL, /* read */
50 NULL, /* write */
51 autofs_dir_readdir, /* readdir */
52 NULL, /* poll */
53 NULL, /* ioctl */
54 NULL, /* mmap */
55 NULL, /* open */
56 NULL, /* flush */
57 NULL, /* release */
58 NULL, /* fsync */
59 NULL, /* fasync */
60 NULL, /* check_media_change */
61 NULL, /* revalidate */
62 NULL /* lock */
65 struct inode_operations autofs_dir_inode_operations = {
66 &autofs_dir_operations, /* file operations */
67 NULL, /* create */
68 autofs_dir_lookup, /* lookup */
69 NULL, /* link */
70 NULL, /* unlink */
71 NULL, /* symlink */
72 NULL, /* mkdir */
73 NULL, /* rmdir */
74 NULL, /* mknod */
75 NULL, /* rename */
76 NULL, /* readlink */
77 NULL, /* follow_link */
78 NULL, /* readpage */
79 NULL, /* writepage */
80 NULL, /* bmap */
81 NULL, /* truncate */
82 NULL, /* permission */
83 NULL, /* smap */
84 NULL, /* updatepage */
85 NULL /* revalidate */