~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/fs/autofs/autofs_i.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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/malloc.h>
 23 #include <linux/sched.h>
 24 #include <linux/string.h>
 25 #include <linux/wait.h>
 26 #include <asm/uaccess.h>
 27 
 28 #ifdef DEBUG
 29 #define DPRINTK(D) (printk D)
 30 #else
 31 #define DPRINTK(D) ((void)0)
 32 #endif
 33 
 34 #define AUTOFS_SUPER_MAGIC 0x0187
 35 
 36 /*
 37  * If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
 38  * kernel will keep the negative response cached for up to the time given
 39  * here, although the time can be shorter if the kernel throws the dcache
 40  * entry away.  This probably should be settable from user space.
 41  */
 42 #define AUTOFS_NEGATIVE_TIMEOUT (60*HZ) /* 1 minute */
 43 
 44 /* Structures associated with the root directory hash table */
 45 
 46 #define AUTOFS_HASH_SIZE 67
 47 
 48 struct autofs_dir_ent {
 49         int hash;
 50         char *name;
 51         int len;
 52         ino_t ino;
 53         struct dentry *dentry;
 54         /* Linked list of entries */
 55         struct autofs_dir_ent *next;
 56         struct autofs_dir_ent **back;
 57         /* The following entries are for the expiry system */
 58         unsigned long last_usage;
 59         struct list_head exp;
 60 };
 61 
 62 struct autofs_dirhash {
 63         struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
 64         struct list_head expiry_head;
 65 };
 66 
 67 struct autofs_wait_queue {
 68         wait_queue_head_t queue;
 69         struct autofs_wait_queue *next;
 70         autofs_wqt_t wait_queue_token;
 71         /* We use the following to see what we are waiting for */
 72         int hash;
 73         int len;
 74         char *name;
 75         /* This is for status reporting upon return */
 76         int status;
 77         int wait_ctr;
 78 };
 79 
 80 struct autofs_symlink {
 81         char *data;
 82         int len;
 83         time_t mtime;
 84 };
 85 
 86 #define AUTOFS_MAX_SYMLINKS 256
 87 
 88 #define AUTOFS_ROOT_INO      1
 89 #define AUTOFS_FIRST_SYMLINK 2
 90 #define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS)
 91 
 92 #define AUTOFS_SYMLINK_BITMAP_LEN ((AUTOFS_MAX_SYMLINKS+31)/32)
 93 
 94 #define AUTOFS_SBI_MAGIC 0x6d4a556d
 95 
 96 struct autofs_sb_info {
 97         u32 magic;
 98         struct file *pipe;
 99         pid_t oz_pgrp;
100         int catatonic;
101         unsigned long exp_timeout;
102         ino_t next_dir_ino;
103         struct autofs_wait_queue *queues; /* Wait queue pointer */
104         struct autofs_dirhash dirhash; /* Root directory hash */
105         struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS];
106         u32 symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN];
107 };
108 
109 extern inline struct autofs_sb_info *autofs_sbi(struct super_block *sb)
110 {
111         return (struct autofs_sb_info *)(sb->u.generic_sbp);
112 }
113 
114 /* autofs_oz_mode(): do we see the man behind the curtain?  (The
115    processes which do manipulations for us in user space sees the raw
116    filesystem without "magic".) */
117 
118 static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
119         return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
120 }
121 
122 /* Hash operations */
123 
124 void autofs_initialize_hash(struct autofs_dirhash *);
125 struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,struct qstr *);
126 void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
127 void autofs_hash_delete(struct autofs_dir_ent *);
128 struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *,struct autofs_dir_ent *);
129 void autofs_hash_dputall(struct autofs_dirhash *);
130 void autofs_hash_nuke(struct autofs_dirhash *);
131 
132 /* Expiration-handling functions */
133 
134 void autofs_update_usage(struct autofs_dirhash *,struct autofs_dir_ent *);
135 struct autofs_dir_ent *autofs_expire(struct super_block *,struct autofs_sb_info *, struct vfsmount *mnt);
136 
137 /* Operations structures */
138 
139 extern struct inode_operations autofs_root_inode_operations;
140 extern struct inode_operations autofs_symlink_inode_operations;
141 extern struct inode_operations autofs_dir_inode_operations;
142 extern struct file_operations autofs_root_operations;
143 extern struct file_operations autofs_dir_operations;
144 
145 /* Initializing function */
146 
147 struct super_block *autofs_read_super(struct super_block *, void *,int);
148 
149 /* Queue management functions */
150 
151 int autofs_wait(struct autofs_sb_info *,struct qstr *);
152 int autofs_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
153 void autofs_catatonic_mode(struct autofs_sb_info *);
154 
155 #ifdef DEBUG
156 void autofs_say(const char *name, int len);
157 #else
158 #define autofs_say(n,l) ((void)0)
159 #endif
160 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.