The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/autofs4/autofs_i.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* -*- 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_fs4.h>
   16 #include <linux/list.h>
   17 
   18 /* This is the range of ioctl() numbers we claim as ours */
   19 #define AUTOFS_IOC_FIRST     AUTOFS_IOC_READY
   20 #define AUTOFS_IOC_COUNT     32
   21 
   22 #include <linux/kernel.h>
   23 #include <linux/slab.h>
   24 #include <linux/sched.h>
   25 #include <linux/string.h>
   26 #include <linux/wait.h>
   27 #include <asm/uaccess.h>
   28 
   29 /* #define DEBUG */
   30 
   31 #ifdef DEBUG
   32 #define DPRINTK(D) do{ printk("pid %d: ", current->pid); printk D; } while(0)
   33 #else
   34 #define DPRINTK(D) do {} while(0)
   35 #endif
   36 
   37 #define AUTOFS_SUPER_MAGIC 0x0187
   38 
   39 /*
   40  * If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
   41  * kernel will keep the negative response cached for up to the time given
   42  * here, although the time can be shorter if the kernel throws the dcache
   43  * entry away.  This probably should be settable from user space.
   44  */
   45 #define AUTOFS_NEGATIVE_TIMEOUT (60*HZ) /* 1 minute */
   46 
   47 /* Unified info structure.  This is pointed to by both the dentry and
   48    inode structures.  Each file in the filesystem has an instance of this
   49    structure.  It holds a reference to the dentry, so dentries are never
   50    flushed while the file exists.  All name lookups are dealt with at the
   51    dentry level, although the filesystem can interfere in the validation
   52    process.  Readdir is implemented by traversing the dentry lists. */
   53 struct autofs_info {
   54         struct dentry   *dentry;
   55         struct inode    *inode;
   56 
   57         int             flags;
   58 
   59         struct autofs_sb_info *sbi;
   60         unsigned long last_used;
   61 
   62         mode_t  mode;
   63         size_t  size;
   64 
   65         void (*free)(struct autofs_info *);
   66         union {
   67                 const char *symlink;
   68         } u;
   69 };
   70 
   71 #define AUTOFS_INF_EXPIRING     (1<<0) /* dentry is in the process of expiring */
   72 
   73 struct 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 
   86 #define AUTOFS_SBI_MAGIC 0x6d4a556d
   87 
   88 struct autofs_sb_info {
   89         u32 magic;
   90         struct file *pipe;
   91         pid_t oz_pgrp;
   92         int catatonic;
   93         int version;
   94         unsigned long exp_timeout;
   95         struct super_block *sb;
   96         struct autofs_wait_queue *queues; /* Wait queue pointer */
   97 };
   98 
   99 static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
  100 {
  101         return (struct autofs_sb_info *)(sb->u.generic_sbp);
  102 }
  103 
  104 static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry)
  105 {
  106         return (struct autofs_info *)(dentry->d_fsdata);
  107 }
  108 
  109 /* autofs4_oz_mode(): do we see the man behind the curtain?  (The
  110    processes which do manipulations for us in user space sees the raw
  111    filesystem without "magic".) */
  112 
  113 static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) {
  114         return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
  115 }
  116 
  117 /* Does a dentry have some pending activity? */
  118 static inline int autofs4_ispending(struct dentry *dentry)
  119 {
  120         struct autofs_info *inf = autofs4_dentry_ino(dentry);
  121 
  122         return (dentry->d_flags & DCACHE_AUTOFS_PENDING) ||
  123                 (inf != NULL && inf->flags & AUTOFS_INF_EXPIRING);
  124 }
  125 
  126 struct inode *autofs4_get_inode(struct super_block *, struct autofs_info *);
  127 struct autofs_info *autofs4_init_inf(struct autofs_sb_info *, mode_t mode);
  128 void autofs4_free_ino(struct autofs_info *);
  129 
  130 /* Expiration */
  131 int is_autofs4_dentry(struct dentry *);
  132 int autofs4_expire_run(struct super_block *, struct vfsmount *,
  133                         struct autofs_sb_info *, struct autofs_packet_expire *);
  134 int autofs4_expire_multi(struct super_block *, struct vfsmount *,
  135                         struct autofs_sb_info *, int *);
  136 
  137 /* Operations structures */
  138 
  139 extern struct inode_operations autofs4_symlink_inode_operations;
  140 extern struct inode_operations autofs4_dir_inode_operations;
  141 extern struct inode_operations autofs4_root_inode_operations;
  142 extern struct file_operations autofs4_root_operations;
  143 
  144 /* Initializing function */
  145 
  146 struct super_block *autofs4_read_super(struct super_block *, void *,int);
  147 struct autofs_info *autofs4_init_ino(struct autofs_info *, struct autofs_sb_info *sbi, mode_t mode);
  148 
  149 /* Queue management functions */
  150 
  151 enum autofs_notify
  152 {
  153         NFY_NONE,
  154         NFY_MOUNT,
  155         NFY_EXPIRE
  156 };
  157 
  158 int autofs4_wait(struct autofs_sb_info *,struct qstr *, enum autofs_notify);
  159 int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
  160 void autofs4_catatonic_mode(struct autofs_sb_info *);

Cache object: ac5c02d545aa0618e2d7b72eb6770ad6


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.