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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*
Copyright (C) 1996,98,2002 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
The GNU Hurd is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
The GNU Hurd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
#include <pthread.h>
#include <rpc/types.h>
#include "../nfs/nfs-spec.h" /* XXX */
#include <hurd/fs.h>
/* These should be configuration options */
#define ID_KEEP_TIMEOUT 3600 /* one hour */
#define FH_KEEP_TIMEOUT 600 /* ten minutes */
#define REPLY_KEEP_TIMEOUT 120 /* two minutes */
#define MAXIOSIZE 10240
struct idspec
{
struct idspec *next, **prevp;
int nuids, ngids;
uid_t *uids, *gids;
time_t lastuse;
int references;
};
struct cache_handle
{
struct cache_handle *next, **prevp;
char handle[NFS2_FHSIZE];
struct idspec *ids;
file_t port;
time_t lastuse;
int references;
};
struct cached_reply
{
struct cached_reply *next, **prevp;
pthread_mutex_t lock;
struct sockaddr_in source;
int xid;
time_t lastuse;
int references;
size_t len;
char *data;
};
struct procedure
{
error_t (*func) (struct cache_handle *, int *, int **, int);
size_t (*alloc_reply) (int *, int);
int need_handle;
int process_error;
};
struct proctable
{
int min;
int max;
struct procedure procs[];
};
volatile struct mapped_time_value *mapped_time;
#define INTSIZE(n) (((n) + 3) >> 2)
/* We don't actually distinguish between these two sockets, but
we have to listen on two different ports, so that's why they're here. */
extern int main_udp_socket, pmap_udp_socket;
extern struct sockaddr_in main_address, pmap_address;
/* Name of the file on disk containing the filesystem index table */
extern char *index_file_name;
/* Our auth server */
auth_t authserver;
/* cache.c */
int *process_cred (int *, struct idspec **);
void cred_rele (struct idspec *);
void cred_ref (struct idspec *);
void scan_creds (void);
int *lookup_cache_handle (int *, struct cache_handle **, struct idspec *);
void cache_handle_rele (struct cache_handle *);
void scan_fhs (void);
struct cache_handle *create_cached_handle (int, struct cache_handle *, file_t);
struct cached_reply *check_cached_replies (int, struct sockaddr_in *);
void release_cached_reply (struct cached_reply *cr);
void scan_replies (void);
/* loop.c */
void * server_loop (void *);
/* ops.c */
extern struct proctable nfs2table, mounttable, pmaptable;
/* xdr.c */
int nfs_error_trans (error_t, int);
int *encode_fattr (int *, struct stat *, int version);
int *decode_name (int *, char **);
int *encode_fhandle (int *, char *);
int *encode_string (int *, char *);
int *encode_data (int *, char *, size_t);
int *encode_statfs (int *, struct statfs *);
/* fsys.c */
fsys_t lookup_filesystem (int);
int enter_filesystem (char *, file_t);
void init_filesystems (void);
|