aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs/autofs_i.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/autofs/autofs_i.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/autofs/autofs_i.h')
-rw-r--r--fs/autofs/autofs_i.h164
1 files changed, 164 insertions, 0 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
new file mode 100644
index 000000000000..6171431272dc
--- /dev/null
+++ b/fs/autofs/autofs_i.h
@@ -0,0 +1,164 @@
1/* -*- linux-c -*- ------------------------------------------------------- *
2 *
3 * linux/fs/autofs/autofs_i.h
4 *
5 * Copyright 1997-1998 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/* Internal header file for autofs */
14
15#include <linux/auto_fs.h>
16
17/* This is the range of ioctl() numbers we claim as ours */
18#define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
19#define AUTOFS_IOC_COUNT 32
20
21#include <linux/kernel.h>
22#include <linux/slab.h>
23#include <linux/time.h>
24#include <linux/string.h>
25#include <linux/wait.h>
26#include <linux/dcache.h>
27#include <linux/namei.h>
28#include <linux/mount.h>
29#include <linux/sched.h>
30
31#include <asm/current.h>
32#include <asm/uaccess.h>
33
34#ifdef DEBUG
35#define DPRINTK(D) (printk D)
36#else
37#define DPRINTK(D) ((void)0)
38#endif
39
40#define AUTOFS_SUPER_MAGIC 0x0187
41
42/*
43 * If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
44 * kernel will keep the negative response cached for up to the time given
45 * here, although the time can be shorter if the kernel throws the dcache
46 * entry away. This probably should be settable from user space.
47 */
48#define AUTOFS_NEGATIVE_TIMEOUT (60*HZ) /* 1 minute */
49
50/* Structures associated with the root directory hash table */
51
52#define AUTOFS_HASH_SIZE 67
53
54struct autofs_dir_ent {
55 int hash;
56 char *name;
57 int len;
58 ino_t ino;
59 struct dentry *dentry;
60 /* Linked list of entries */
61 struct autofs_dir_ent *next;
62 struct autofs_dir_ent **back;
63 /* The following entries are for the expiry system */
64 unsigned long last_usage;
65 struct list_head exp;
66};
67
68struct autofs_dirhash {
69 struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
70 struct list_head expiry_head;
71};
72
73struct autofs_wait_queue {
74 wait_queue_head_t queue;
75 struct autofs_wait_queue *next;
76 autofs_wqt_t wait_queue_token;
77 /* We use the following to see what we are waiting for */
78 int hash;
79 int len;
80 char *name;
81 /* This is for status reporting upon return */
82 int status;
83 int wait_ctr;
84};
85
86struct autofs_symlink {
87 char *data;
88 int len;
89 time_t mtime;
90};
91
92#define AUTOFS_MAX_SYMLINKS 256
93
94#define AUTOFS_ROOT_INO 1
95#define AUTOFS_FIRST_SYMLINK 2
96#define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS)
97
98#define AUTOFS_SYMLINK_BITMAP_LEN \
99 ((AUTOFS_MAX_SYMLINKS+((sizeof(long)*1)-1))/(sizeof(long)*8))
100
101#define AUTOFS_SBI_MAGIC 0x6d4a556d
102
103struct autofs_sb_info {
104 u32 magic;
105 struct file *pipe;
106 pid_t oz_pgrp;
107 int catatonic;
108 unsigned long exp_timeout;
109 ino_t next_dir_ino;
110 struct autofs_wait_queue *queues; /* Wait queue pointer */
111 struct autofs_dirhash dirhash; /* Root directory hash */
112 struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS];
113 unsigned long symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN];
114};
115
116static inline struct autofs_sb_info *autofs_sbi(struct super_block *sb)
117{
118 return (struct autofs_sb_info *)(sb->s_fs_info);
119}
120
121/* autofs_oz_mode(): do we see the man behind the curtain? (The
122 processes which do manipulations for us in user space sees the raw
123 filesystem without "magic".) */
124
125static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
126 return sbi->catatonic || process_group(current) == sbi->oz_pgrp;
127}
128
129/* Hash operations */
130
131void autofs_initialize_hash(struct autofs_dirhash *);
132struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,struct qstr *);
133void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
134void autofs_hash_delete(struct autofs_dir_ent *);
135struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *,struct autofs_dir_ent *);
136void autofs_hash_dputall(struct autofs_dirhash *);
137void autofs_hash_nuke(struct autofs_dirhash *);
138
139/* Expiration-handling functions */
140
141void autofs_update_usage(struct autofs_dirhash *,struct autofs_dir_ent *);
142struct autofs_dir_ent *autofs_expire(struct super_block *,struct autofs_sb_info *, struct vfsmount *mnt);
143
144/* Operations structures */
145
146extern struct inode_operations autofs_root_inode_operations;
147extern struct inode_operations autofs_symlink_inode_operations;
148extern struct file_operations autofs_root_operations;
149
150/* Initializing function */
151
152int autofs_fill_super(struct super_block *, void *, int);
153
154/* Queue management functions */
155
156int autofs_wait(struct autofs_sb_info *,struct qstr *);
157int autofs_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
158void autofs_catatonic_mode(struct autofs_sb_info *);
159
160#ifdef DEBUG
161void autofs_say(const char *name, int len);
162#else
163#define autofs_say(n,l) ((void)0)
164#endif