Blame view

fs/ncpfs/ncp_fs_sb.h 5.03 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
  /*
   *  ncp_fs_sb.h
   *
   *  Copyright (C) 1995, 1996 by Volker Lendecke
   *
   */
  
  #ifndef _NCP_FS_SB
  #define _NCP_FS_SB
  
  #include <linux/types.h>
  #include <linux/ncp_mount.h>
  #include <linux/net.h>
8e3f90459   Ingo Molnar   [PATCH] sem2mutex...
14
  #include <linux/mutex.h>
f1970c73c   Jens Axboe   ncpfs: add bdi ba...
15
  #include <linux/backing-dev.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
17
18
19
20
  #include <linux/workqueue.h>
  
  #define NCP_DEFAULT_OPTIONS 0		/* 2 for packet signatures */
  
  struct sock;
32c419d95   Al Viro   move internal-onl...
21
22
23
24
  struct ncp_mount_data_kernel {
  	unsigned long    flags;		/* NCP_MOUNT_* flags */
  	unsigned int	 int_flags;	/* internal flags */
  #define NCP_IMOUNT_LOGGEDIN_POSSIBLE	0x0001
1ac7fd819   Eric W. Biederman   ncpfs: Support in...
25
  	kuid_t		 mounted_uid;	/* Who may umount() this filesystem? */
32c419d95   Al Viro   move internal-onl...
26
27
28
29
30
31
  	struct pid      *wdog_pid;	/* Who cares for our watchdog packets? */
  	unsigned int     ncp_fd;	/* The socket to the ncp port */
  	unsigned int     time_out;	/* How long should I wait after
  					   sending a NCP request? */
  	unsigned int     retry_count;	/* And how often should I retry? */
  	unsigned char	 mounted_vol[NCP_VOLNAME_LEN + 1];
1ac7fd819   Eric W. Biederman   ncpfs: Support in...
32
33
  	kuid_t		 uid;
  	kgid_t		 gid;
167676523   Al Viro   get rid of idioti...
34
35
  	umode_t		 file_mode;
  	umode_t		 dir_mode;
32c419d95   Al Viro   move internal-onl...
36
37
  	int		 info_fd;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
  struct ncp_server {
1dcddd4ab   Al Viro   ncpfs: rcu-delay ...
39
  	struct rcu_head rcu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
42
43
44
  	struct ncp_mount_data_kernel m;	/* Nearly all of the mount data is of
  					   interest for us later, so we store
  					   it completely. */
  
  	__u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
  	struct socket *ncp_sock;/* ncp socket */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  	struct socket *info_sock;
  
  	u8 sequence;
  	u8 task;
  	u16 connection;		/* Remote connection number */
  
  	u8 completion;		/* Status message from server */
  	u8 conn_status;		/* Bit 4 = 1 ==> Server going down, no
  				   requests allowed anymore.
  				   Bit 0 = 1 ==> Server is down. */
  
  	int buffer_size;	/* Negotiated bufsize */
  
  	int reply_size;		/* Size of last reply */
  
  	int packet_size;
  	unsigned char *packet;	/* Here we prepare requests and
  				   receive replies */
c5f93cf19   Pierre Ossman   ncpfs: make sure ...
64
65
  	unsigned char *txbuf;	/* Storage for current request */
  	unsigned char *rxbuf;	/* Storage for reply to current request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
67
  
  	int lock;		/* To prevent mismatch in protocols. */
8e3f90459   Ingo Molnar   [PATCH] sem2mutex...
68
  	struct mutex mutex;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
69
70
71
72
73
74
  
  	int current_size;	/* for packet preparation */
  	int has_subfunction;
  	int ncp_reply_size;
  
  	int root_setuped;
2e54eb96e   Petr Vandrovec   BKL: Remove BKL f...
75
  	struct mutex root_setup_lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  
  	/* info for packet signing */
  	int sign_wanted;	/* 1=Server needs signed packets */
  	int sign_active;	/* 0=don't do signing, 1=do */
  	char sign_root[8];	/* generated from password and encr. key */
  	char sign_last[16];	
  
  	/* Authentication info: NDS or BINDERY, username */
  	struct {
  		int	auth_type;
  		size_t	object_name_len;
  		void*	object_name;
  		int	object_type;
  	} auth;
  	/* Password info */
  	struct {
  		size_t	len;
  		void*	data;
  	} priv;
2e54eb96e   Petr Vandrovec   BKL: Remove BKL f...
95
  	struct rw_semaphore auth_rwsem;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
96
97
98
99
100
101
  
  	/* nls info: codepage for volume and charset for I/O */
  	struct nls_table *nls_vol;
  	struct nls_table *nls_io;
  
  	/* maximum age in jiffies */
2e54eb96e   Petr Vandrovec   BKL: Remove BKL f...
102
  	atomic_t dentry_ttl;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
103
104
105
106
107
  
  	/* miscellaneous */
  	unsigned int flags;
  
  	spinlock_t requests_lock;	/* Lock accesses to tx.requests, tx.creq and rcv.creq when STREAM mode */
676d23690   David S. Miller   net: Fix use afte...
108
  	void (*data_ready)(struct sock* sk);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
109
110
111
112
113
  	void (*error_report)(struct sock* sk);
  	void (*write_space)(struct sock* sk);	/* STREAM mode only */
  	struct {
  		struct work_struct tq;		/* STREAM/DGRAM: data/error ready */
  		struct ncp_request_reply* creq;	/* STREAM/DGRAM: awaiting reply from this request */
8e3f90459   Ingo Molnar   [PATCH] sem2mutex...
114
  		struct mutex creq_mutex;	/* DGRAM only: lock accesses to rcv.creq */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
115
116
117
  
  		unsigned int state;		/* STREAM only: receiver state */
  		struct {
bc10502db   Eric Dumazet   net: use __packed...
118
119
120
121
122
123
124
  			__u32 magic __packed;
  			__u32 len __packed;
  			__u16 type __packed;
  			__u16 p1 __packed;
  			__u16 p2 __packed;
  			__u16 p3 __packed;
  			__u16 type2 __packed;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  		} buf;				/* STREAM only: temporary buffer */
  		unsigned char* ptr;		/* STREAM only: pointer to data */
  		size_t len;			/* STREAM only: length of data to receive */
  	} rcv;
  	struct {
  		struct list_head requests;	/* STREAM only: queued requests */
  		struct work_struct tq;		/* STREAM only: transmitter ready */
  		struct ncp_request_reply* creq;	/* STREAM only: currently transmitted entry */
  	} tx;
  	struct timer_list timeout_tm;		/* DGRAM only: timeout timer */
  	struct work_struct timeout_tq;		/* DGRAM only: associated queue, we run timers from process context */
  	int timeout_last;			/* DGRAM only: current timeout length */
  	int timeout_retries;			/* DGRAM only: retries left */
  	struct {
  		size_t len;
  		__u8 data[128];
  	} unexpected_packet;
f1970c73c   Jens Axboe   ncpfs: add bdi ba...
142
  	struct backing_dev_info bdi;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
143
  };
c4028958b   David Howells   WorkStruct: make ...
144
145
146
147
  extern void ncp_tcp_rcv_proc(struct work_struct *work);
  extern void ncp_tcp_tx_proc(struct work_struct *work);
  extern void ncpdgram_rcv_proc(struct work_struct *work);
  extern void ncpdgram_timeout_proc(struct work_struct *work);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
148
  extern void ncpdgram_timeout_call(unsigned long server);
676d23690   David S. Miller   net: Fix use afte...
149
  extern void ncp_tcp_data_ready(struct sock* sk);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
  extern void ncp_tcp_write_space(struct sock* sk);
  extern void ncp_tcp_error_report(struct sock* sk);
  
  #define NCP_FLAG_UTF8	1
  
  #define NCP_CLR_FLAG(server, flag)	((server)->flags &= ~(flag))
  #define NCP_SET_FLAG(server, flag)	((server)->flags |= (flag))
  #define NCP_IS_FLAG(server, flag)	((server)->flags & (flag))
  
  static inline int ncp_conn_valid(struct ncp_server *server)
  {
  	return ((server->conn_status & 0x11) == 0);
  }
  
  static inline void ncp_invalidate_conn(struct ncp_server *server)
  {
  	server->conn_status |= 0x01;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
168
  #endif