aboutsummaryrefslogtreecommitdiffstats
path: root/kernel4/autofs_i.h
blob: 763b5b763ab514f7e53e5a4b450849dc7f2a4cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* -*- linux-c -*- ------------------------------------------------------- *
 *   
 * linux/fs/autofs/autofs_i.h
 *
 *   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.
 *
 * ----------------------------------------------------------------------- */

/* Internal header file for autofs */

#include <linux/auto_fs.h>
#include <linux/auto_fs_i.h>

/* This is the range of ioctl() numbers we claim as ours */
#define AUTOFS_IOC_FIRST     AUTOFS_IOC_READY
#define AUTOFS_IOC_COUNT     32

#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/wait.h>
#include <asm/uaccess.h>

#ifdef DEBUG
#define DPRINTK(D) (printk D)
#else
#define DPRINTK(D) ((void)0)
#endif

#define AUTOFS_SUPER_MAGIC 0x0187

/*
 * If the daemon returns a negative response (AUTOFS_IOC_FAIL) then the
 * kernel will keep the negative response cached for up to the time given
 * here, although the time can be shorter if the kernel throws the dcache
 * entry away.  This probably should be settable from user space.
 */
#define AUTOFS_NEGATIVE_TIMEOUT (60*HZ)	/* 1 minute */


/* Magic directory wait queue structure */

struct autofs_wait_queue {
	unsigned long wait_queue_token;
	struct wait_queue *queue;
	struct autofs_wait_queue *next;
	/* We use the following to see what we are waiting for */
	int hash;
	int len;
	char *name;
	/* This is for status reporting upon return */
	int status;
	int wait_ctr;
};

#define AUTOFS_ROOT_INO        1
#define AUTOFS_FIRST_FREE_INO  2

#ifndef END_OF_TIME
#define END_OF_TIME ((time_t)((unsigned long)((time_t)(~0UL)) >> 1))
#endif

/* autofs_oz_mode(): do we see the man behind the curtain?  (The
   processes which do manipulations for us in user space sees the raw
   filesystem without "magic".) */
extern inline int autofs_oz_mode(struct super_block *sb) {
	return ((sb->u.autofs_sb.oz_pgrp == current->pgrp) ||
		(sb->u.autofs_sb.oz_pgrp == 0));
}

/* Expiration-handling functions */

void autofs_update_usage(struct inode *);
struct autofs_dir_ent *autofs_expire(struct super_block *, unsigned long);

/* Initializing function */

struct super_block *autofs_read_super(struct super_block *, void *, int);

/* Queue management functions */

int autofs_wait(struct super_block *, struct qstr *);
int autofs_wait_release(struct super_block *, unsigned long, int);
void autofs_catatonic_mode(struct super_block *);

#ifdef DEBUG
void autofs_say(const char *name, int len);
#else
#define autofs_say(n,l) ((void)0)
#endif