2011-02-23 20:48:06 +00:00
|
|
|
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
|
|
|
|
#ifndef MARS_CLIENT_H
|
|
|
|
#define MARS_CLIENT_H
|
|
|
|
|
|
|
|
#include "mars_net.h"
|
2012-08-07 12:07:12 +00:00
|
|
|
#include "lib_limiter.h"
|
|
|
|
|
|
|
|
extern struct mars_limiter client_limiter;
|
2012-08-14 14:12:59 +00:00
|
|
|
extern int global_net_io_timeout;
|
2011-02-23 20:48:06 +00:00
|
|
|
|
|
|
|
struct client_mref_aspect {
|
|
|
|
GENERIC_ASPECT(mref);
|
|
|
|
struct list_head io_head;
|
2011-03-30 12:02:50 +00:00
|
|
|
struct list_head hash_head;
|
2012-12-19 11:40:52 +00:00
|
|
|
struct list_head tmp_head;
|
2012-01-23 12:39:08 +00:00
|
|
|
unsigned long submit_jiffies;
|
2011-11-14 17:52:05 +00:00
|
|
|
int alloc_len;
|
2011-02-23 20:48:06 +00:00
|
|
|
bool do_dealloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct client_brick {
|
|
|
|
MARS_BRICK(client);
|
2011-03-29 14:40:40 +00:00
|
|
|
// tunables
|
|
|
|
int max_flying; // limit on parallelism
|
2012-01-23 12:39:08 +00:00
|
|
|
int io_timeout; // > 0: report IO errors after timeout (in seconds)
|
2012-08-07 12:07:12 +00:00
|
|
|
bool limit_mode;
|
2013-04-11 12:58:36 +00:00
|
|
|
// readonly from outside
|
|
|
|
int connection_state; // 0 = switched off, 1 = not connected, 2 = connected
|
2011-02-23 20:48:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct client_input {
|
|
|
|
MARS_INPUT(client);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct client_threadinfo {
|
|
|
|
struct task_struct *thread;
|
2011-03-03 18:23:34 +00:00
|
|
|
wait_queue_head_t run_event;
|
2011-05-26 14:32:32 +00:00
|
|
|
int restart_count;
|
2011-02-23 20:48:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct client_output {
|
|
|
|
MARS_OUTPUT(client);
|
2011-03-29 14:40:40 +00:00
|
|
|
atomic_t fly_count;
|
2012-01-23 12:39:08 +00:00
|
|
|
atomic_t timeout_count;
|
2011-02-23 20:48:06 +00:00
|
|
|
spinlock_t lock;
|
|
|
|
struct list_head mref_list;
|
|
|
|
struct list_head wait_list;
|
|
|
|
wait_queue_head_t event;
|
|
|
|
int last_id;
|
2012-12-21 11:35:43 +00:00
|
|
|
int recv_error;
|
2012-01-11 11:35:09 +00:00
|
|
|
struct mars_socket socket;
|
2011-02-23 20:48:06 +00:00
|
|
|
char *host;
|
|
|
|
char *path;
|
|
|
|
struct client_threadinfo sender;
|
|
|
|
struct client_threadinfo receiver;
|
|
|
|
struct mars_info info;
|
|
|
|
wait_queue_head_t info_event;
|
2011-03-07 05:55:10 +00:00
|
|
|
bool get_info;
|
2011-02-23 20:48:06 +00:00
|
|
|
bool got_info;
|
2013-04-12 12:13:21 +00:00
|
|
|
struct list_head *hash_table;
|
2011-02-23 20:48:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
MARS_TYPES(client);
|
|
|
|
|
|
|
|
#endif
|