OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [fs/] [autofs/] [autofs_i.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* -*- linux-c -*- ------------------------------------------------------- *
2
 *
3
 * linux/fs/autofs/autofs_i.h
4
 *
5
 *   Copyright 1997 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
 
27
#define kver(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 
28
 
29
#if LINUX_VERSION_CODE < kver(2,1,0)
30
 
31
/* Segmentation stuff for pre-2.1 kernels */
32
#include <asm/segment.h>
33
 
34
static inline int copy_to_user(void *dst, void *src, unsigned long len)
35
{
36
        int rv = verify_area(VERIFY_WRITE, dst, len);
37
        if ( rv )
38
                return -1;
39
        memcpy_tofs(dst,src,len);
40
        return 0;
41
}
42
 
43
static inline int copy_from_user(void *dst, void *src, unsigned long len)
44
{
45
        int rv = verify_area(VERIFY_READ, src, len);
46
        if ( rv )
47
                return -1;
48
        memcpy_fromfs(dst,src,len);
49
        return 0;
50
}
51
 
52
#else
53
 
54
/* Segmentation stuff for post-2.1 kernels */
55
#include <asm/uaccess.h>
56
#define register_symtab(x)      ((void)0)
57
 
58
#endif
59
 
60
#ifdef DEBUG
61
#define DPRINTK(D) printk D;
62
#else
63
#define DPRINTK(D)
64
#endif
65
 
66
#define AUTOFS_SUPER_MAGIC 0x0187
67
 
68
/* Structures associated with the root directory hash */
69
 
70
#define AUTOFS_HASH_SIZE 67
71
 
72
typedef u32 autofs_hash_t;      /* Type returned by autofs_hash() */
73
 
74
struct autofs_dir_ent {
75
        autofs_hash_t hash;
76
        struct autofs_dir_ent *next;
77
        struct autofs_dir_ent **back;
78
        char *name;
79
        int len;
80
        ino_t ino;
81
        /* The following entries are for the expiry system */
82
        unsigned long last_usage;
83
        struct autofs_dir_ent *exp_next;
84
        struct autofs_dir_ent *exp_prev;
85
};
86
 
87
struct autofs_dirhash {
88
        struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
89
        struct autofs_dir_ent expiry_head;
90
};
91
 
92
struct autofs_wait_queue {
93
        unsigned long wait_queue_token;
94
        struct wait_queue *queue;
95
        struct autofs_wait_queue *next;
96
        /* We use the following to see what we are waiting for */
97
        autofs_hash_t hash;
98
        int len;
99
        char *name;
100
        /* This is for status reporting upon return */
101
        int status;
102
        int wait_ctr;
103
};
104
 
105
struct autofs_symlink {
106
        int len;
107
        char *data;
108
        time_t mtime;
109
};
110
 
111
#define AUTOFS_MAX_SYMLINKS 256
112
 
113
#define AUTOFS_ROOT_INO      1
114
#define AUTOFS_FIRST_SYMLINK 2
115
#define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS)
116
 
117
#define AUTOFS_SYMLINK_BITMAP_LEN ((AUTOFS_MAX_SYMLINKS+31)/32)
118
 
119
#ifndef END_OF_TIME
120
#define END_OF_TIME ((time_t)((unsigned long)((time_t)(~0UL)) >> 1))
121
#endif
122
 
123
#define AUTOFS_SBI_MAGIC 0x6d4a556d
124
 
125
struct autofs_sb_info {
126
        u32 magic;
127
        struct file *pipe;
128
        pid_t oz_pgrp;
129
        int catatonic;
130
        unsigned long exp_timeout;
131
        ino_t next_dir_ino;
132
        struct autofs_wait_queue *queues; /* Wait queue pointer */
133
        struct autofs_dirhash dirhash; /* Root directory hash */
134
        struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS];
135
        u32 symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN];
136
};
137
 
138
/* autofs_oz_mode(): do we see the man behind the curtain? */
139
static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
140
        return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
141
}
142
 
143
/* Debug the mysteriously disappearing wait list */
144
 
145
#ifdef DEBUG_WAITLIST
146
#define CHECK_WAITLIST(S,O) autofs_check_waitlist_integrity(S,O)
147
void autofs_check_waitlist_integrity(struct autofs_sb_info *,char *);
148
#else
149
#define CHECK_WAITLIST(S,O)
150
#endif
151
 
152
/* Hash operations */
153
 
154
autofs_hash_t autofs_hash(const char *,int);
155
void autofs_initialize_hash(struct autofs_dirhash *);
156
struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,autofs_hash_t,const char *,int);
157
void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
158
void autofs_hash_delete(struct autofs_dir_ent *);
159
struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *);
160
void autofs_hash_nuke(struct autofs_dirhash *);
161
 
162
/* Expiration-handling functions */
163
 
164
void autofs_update_usage(struct autofs_dirhash *,struct autofs_dir_ent *);
165
struct autofs_dir_ent *autofs_expire(struct autofs_dirhash *,unsigned long);
166
 
167
/* Operations structures */
168
 
169
extern struct inode_operations autofs_root_inode_operations;
170
extern struct inode_operations autofs_symlink_inode_operations;
171
extern struct inode_operations autofs_dir_inode_operations;
172
 
173
/* Initializing function */
174
 
175
struct super_block *autofs_read_super(struct super_block *, void *,int);
176
 
177
/* Queue management functions */
178
 
179
int autofs_wait(struct autofs_sb_info *,autofs_hash_t,const char *,int);
180
int autofs_wait_release(struct autofs_sb_info *,unsigned long,int);
181
void autofs_catatonic_mode(struct autofs_sb_info *);
182
 
183
#ifdef DEBUG
184
void autofs_say(const char *name, int len);
185
#else
186
#define autofs_say(n,l)
187
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.