"[PATCH] Fix leaks on /proc/{*/sched,sched_debug,timer_list,timer_stats}" and
[mmotm.git] / include / linux / ncp_fs_sb.h
blob6330fc76b00fb481d8580a392425b45a5556d93c
1 /*
2 * ncp_fs_sb.h
4 * Copyright (C) 1995, 1996 by Volker Lendecke
6 */
8 #ifndef _NCP_FS_SB
9 #define _NCP_FS_SB
11 #include <linux/types.h>
12 #include <linux/ncp_mount.h>
13 #include <linux/net.h>
14 #include <linux/mutex.h>
16 #ifdef __KERNEL__
18 #include <linux/workqueue.h>
20 #define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */
22 struct sock;
24 struct ncp_server {
26 struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of
27 interest for us later, so we store
28 it completely. */
30 __u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
32 struct file *ncp_filp; /* File pointer to ncp socket */
33 struct socket *ncp_sock;/* ncp socket */
34 struct file *info_filp;
35 struct socket *info_sock;
37 u8 sequence;
38 u8 task;
39 u16 connection; /* Remote connection number */
41 u8 completion; /* Status message from server */
42 u8 conn_status; /* Bit 4 = 1 ==> Server going down, no
43 requests allowed anymore.
44 Bit 0 = 1 ==> Server is down. */
46 int buffer_size; /* Negotiated bufsize */
48 int reply_size; /* Size of last reply */
50 int packet_size;
51 unsigned char *packet; /* Here we prepare requests and
52 receive replies */
53 unsigned char *txbuf; /* Storage for current request */
54 unsigned char *rxbuf; /* Storage for reply to current request */
56 int lock; /* To prevent mismatch in protocols. */
57 struct mutex mutex;
59 int current_size; /* for packet preparation */
60 int has_subfunction;
61 int ncp_reply_size;
63 int root_setuped;
65 /* info for packet signing */
66 int sign_wanted; /* 1=Server needs signed packets */
67 int sign_active; /* 0=don't do signing, 1=do */
68 char sign_root[8]; /* generated from password and encr. key */
69 char sign_last[16];
71 /* Authentication info: NDS or BINDERY, username */
72 struct {
73 int auth_type;
74 size_t object_name_len;
75 void* object_name;
76 int object_type;
77 } auth;
78 /* Password info */
79 struct {
80 size_t len;
81 void* data;
82 } priv;
84 /* nls info: codepage for volume and charset for I/O */
85 struct nls_table *nls_vol;
86 struct nls_table *nls_io;
88 /* maximum age in jiffies */
89 int dentry_ttl;
91 /* miscellaneous */
92 unsigned int flags;
94 spinlock_t requests_lock; /* Lock accesses to tx.requests, tx.creq and rcv.creq when STREAM mode */
96 void (*data_ready)(struct sock* sk, int len);
97 void (*error_report)(struct sock* sk);
98 void (*write_space)(struct sock* sk); /* STREAM mode only */
99 struct {
100 struct work_struct tq; /* STREAM/DGRAM: data/error ready */
101 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
102 struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */
104 unsigned int state; /* STREAM only: receiver state */
105 struct {
106 __u32 magic __attribute__((packed));
107 __u32 len __attribute__((packed));
108 __u16 type __attribute__((packed));
109 __u16 p1 __attribute__((packed));
110 __u16 p2 __attribute__((packed));
111 __u16 p3 __attribute__((packed));
112 __u16 type2 __attribute__((packed));
113 } buf; /* STREAM only: temporary buffer */
114 unsigned char* ptr; /* STREAM only: pointer to data */
115 size_t len; /* STREAM only: length of data to receive */
116 } rcv;
117 struct {
118 struct list_head requests; /* STREAM only: queued requests */
119 struct work_struct tq; /* STREAM only: transmitter ready */
120 struct ncp_request_reply* creq; /* STREAM only: currently transmitted entry */
121 } tx;
122 struct timer_list timeout_tm; /* DGRAM only: timeout timer */
123 struct work_struct timeout_tq; /* DGRAM only: associated queue, we run timers from process context */
124 int timeout_last; /* DGRAM only: current timeout length */
125 int timeout_retries; /* DGRAM only: retries left */
126 struct {
127 size_t len;
128 __u8 data[128];
129 } unexpected_packet;
132 extern void ncp_tcp_rcv_proc(struct work_struct *work);
133 extern void ncp_tcp_tx_proc(struct work_struct *work);
134 extern void ncpdgram_rcv_proc(struct work_struct *work);
135 extern void ncpdgram_timeout_proc(struct work_struct *work);
136 extern void ncpdgram_timeout_call(unsigned long server);
137 extern void ncp_tcp_data_ready(struct sock* sk, int len);
138 extern void ncp_tcp_write_space(struct sock* sk);
139 extern void ncp_tcp_error_report(struct sock* sk);
141 #define NCP_FLAG_UTF8 1
143 #define NCP_CLR_FLAG(server, flag) ((server)->flags &= ~(flag))
144 #define NCP_SET_FLAG(server, flag) ((server)->flags |= (flag))
145 #define NCP_IS_FLAG(server, flag) ((server)->flags & (flag))
147 static inline int ncp_conn_valid(struct ncp_server *server)
149 return ((server->conn_status & 0x11) == 0);
152 static inline void ncp_invalidate_conn(struct ncp_server *server)
154 server->conn_status |= 0x01;
157 #endif /* __KERNEL__ */
159 #endif