aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/dir.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>1997-10-06 21:27:09 +0000
committerH. Peter Anvin <hpa@zytor.com>1997-10-06 21:27:09 +0000
commit93aa1d55b4ffe513fb10d897dd52a09165484e4e (patch)
treeb7c45bd4579a285261ab11c0557e99e4b3f8037d /kernel/dir.c
parent6919185c2ea948793620b5acc57721a65c631710 (diff)
downloadautofs3-93aa1d55b4ffe513fb10d897dd52a09165484e4e.tar.gz
autofs3-93aa1d55b4ffe513fb10d897dd52a09165484e4e.tar.xz
autofs3-93aa1d55b4ffe513fb10d897dd52a09165484e4e.zip
Added kernel code to CVS repository
Diffstat (limited to 'kernel/dir.c')
-rw-r--r--kernel/dir.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/kernel/dir.c b/kernel/dir.c
new file mode 100644
index 0000000..9264806
--- /dev/null
+++ b/kernel/dir.c
@@ -0,0 +1,86 @@
+/* -*- linux-c -*- --------------------------------------------------------- *
+ *
+ * linux/fs/autofs/dir.c
+ *
+ * Copyright 1997 Transmeta Corporation -- All Rights Reserved
+ *
+ * This file is part of the Linux kernel and is made available under
+ * the terms of the GNU General Public License, version 2, or at your
+ * option, any later version, incorporated herein by reference.
+ *
+ * ------------------------------------------------------------------------- */
+
+#include "autofs_i.h"
+
+static int autofs_dir_readdir(struct file *filp,
+ void *dirent, filldir_t filldir)
+{
+ struct inode *inode=filp->f_dentry->d_inode;
+ if (!inode || !S_ISDIR(inode->i_mode))
+ return -ENOTDIR;
+
+ switch((unsigned long) filp->f_pos)
+ {
+ case 0:
+ if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0)
+ return 0;
+ filp->f_pos++;
+ /* fall through */
+ case 1:
+ if (filldir(dirent, "..", 2, 1, AUTOFS_ROOT_INO) < 0)
+ return 0;
+ filp->f_pos++;
+ /* fall through */
+ }
+ return 1;
+}
+
+/*
+ * No entries except for "." and "..", both of which are handled by the VFS layer
+ */
+static int autofs_dir_lookup(struct inode *dir, struct dentry * dentry)
+{
+ d_add(dentry, NULL);
+ return 0;
+}
+
+static struct file_operations autofs_dir_operations = {
+ NULL, /* llseek */
+ NULL, /* read */
+ NULL, /* write */
+ autofs_dir_readdir, /* readdir */
+ NULL, /* poll */
+ NULL, /* ioctl */
+ NULL, /* mmap */
+ NULL, /* open */
+ NULL, /* release */
+ NULL, /* fsync */
+ NULL, /* fasync */
+ NULL, /* check_media_change */
+ NULL, /* revalidate */
+ NULL /* lock */
+};
+
+struct inode_operations autofs_dir_inode_operations = {
+ &autofs_dir_operations, /* file operations */
+ NULL, /* create */
+ autofs_dir_lookup, /* lookup */
+ NULL, /* link */
+ NULL, /* unlink */
+ NULL, /* symlink */
+ NULL, /* mkdir */
+ NULL, /* rmdir */
+ NULL, /* mknod */
+ NULL, /* rename */
+ NULL, /* readlink */
+ NULL, /* follow_link */
+ NULL, /* readpage */
+ NULL, /* writepage */
+ NULL, /* bmap */
+ NULL, /* truncate */
+ NULL, /* permission */
+ NULL, /* smap */
+ NULL, /* updatepage */
+ NULL /* revalidate */
+};
+