summaryrefslogtreecommitdiff
path: root/accel-pppd/triton
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-11-22 08:56:40 +0300
committerDmitry Kozlov <xeb@mail.ru>2014-11-22 08:56:40 +0300
commit81ca3923a29ea9b67f7291be23b210019546aa5f (patch)
treefcebf0d426665b4f06e01168f27cd8f9ab8c50d8 /accel-pppd/triton
parent830c399cf126f6bf1e8dfa1ad919a3ce8e346c5d (diff)
downloadaccel-ppp-81ca3923a29ea9b67f7291be23b210019546aa5f.tar.gz
accel-ppp-81ca3923a29ea9b67f7291be23b210019546aa5f.zip
remove trailing whitespaces
Diffstat (limited to 'accel-pppd/triton')
-rw-r--r--accel-pppd/triton/conf_file.c20
-rw-r--r--accel-pppd/triton/event.c4
-rw-r--r--accel-pppd/triton/list.h8
-rw-r--r--accel-pppd/triton/loader.c2
-rw-r--r--accel-pppd/triton/log.c4
-rw-r--r--accel-pppd/triton/md.c22
-rw-r--r--accel-pppd/triton/mempool.c6
-rw-r--r--accel-pppd/triton/mempool.h2
-rw-r--r--accel-pppd/triton/options.c12
-rw-r--r--accel-pppd/triton/timer.c16
-rw-r--r--accel-pppd/triton/triton.c22
-rw-r--r--accel-pppd/triton/triton.h2
-rw-r--r--accel-pppd/triton/triton_p.h4
13 files changed, 62 insertions, 62 deletions
diff --git a/accel-pppd/triton/conf_file.c b/accel-pppd/triton/conf_file.c
index 0ca481cb..ebde6af2 100644
--- a/accel-pppd/triton/conf_file.c
+++ b/accel-pppd/triton/conf_file.c
@@ -10,7 +10,7 @@
struct sect_t {
struct list_head entry;
-
+
struct conf_sect_t *sect;
};
@@ -51,7 +51,7 @@ static int __conf_load(struct conf_ctx *ctx, const char *fname)
}
r = load_file(&ctx1);
-
+
fclose(ctx1.file);
return r;
@@ -92,7 +92,7 @@ static int load_file(struct conf_ctx *ctx)
fprintf(stderr, "conf_file:%s:%i: sintax error\n", ctx->fname, ctx->line);
return -1;
}
-
+
if (cur_sect && ctx->items != &cur_sect->items) {
fprintf(stderr, "conf_file:%s:%i: cann't open section inside option\n", ctx->fname, ctx->line);
return -1;
@@ -145,7 +145,7 @@ static int load_file(struct conf_ctx *ctx)
if (sect_add_item(ctx, str, str2, raw))
return -1;
}
-
+
return 0;
}
@@ -261,13 +261,13 @@ static struct conf_sect_t *find_sect(const char *name)
static struct conf_sect_t *create_sect(const char *name)
{
struct sect_t *s = _malloc(sizeof(struct sect_t));
-
+
s->sect = _malloc(sizeof(struct conf_sect_t));
s->sect->name = (char*)_strdup(name);
INIT_LIST_HEAD(&s->sect->items);
-
+
list_add_tail(&s->entry, &sections);
-
+
return s->sect;
}
@@ -293,7 +293,7 @@ static int sect_add_item(struct conf_ctx *ctx, const char *name, char *val, char
opt->val = val ? _strdup(val) : NULL;
opt->raw = raw;
INIT_LIST_HEAD(&opt->items);
-
+
list_add_tail(&opt->entry, ctx->items);
if (len) {
@@ -313,7 +313,7 @@ static struct conf_option_t *find_item(struct conf_sect_t *sect, const char *nam
if (strcmp(opt->name, name) == 0)
return opt;
}
-
+
return NULL;
}
@@ -329,7 +329,7 @@ __export char * conf_get_opt(const char *sect, const char *name)
if (!s)
return NULL;
-
+
opt = find_item(s, name);
if (!opt)
return NULL;
diff --git a/accel-pppd/triton/event.c b/accel-pppd/triton/event.c
index 56472c1c..c8a7c431 100644
--- a/accel-pppd/triton/event.c
+++ b/accel-pppd/triton/event.c
@@ -66,7 +66,7 @@ int __export triton_event_register_handler(int ev_id, triton_event_func func)
if (ev_id >= max_events)
return -1;
-
+
ev = events[ev_id];
if (!ev) {
return -1;
@@ -94,7 +94,7 @@ void __export triton_event_fire(int ev_id, void *arg)
if (ev_id >= max_events)
return;
-
+
ev = events[ev_id];
if (!ev)
return;
diff --git a/accel-pppd/triton/list.h b/accel-pppd/triton/list.h
index b17afab7..a650037f 100644
--- a/accel-pppd/triton/list.h
+++ b/accel-pppd/triton/list.h
@@ -29,14 +29,14 @@ typedef struct list_head {
} while (0)
/*
- * Insert a new entry between two known consecutive entries.
+ * Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static void inline prefetch(void *p){}
-
+
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
@@ -105,7 +105,7 @@ static inline void list_del(struct list_head *entry)
static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
+ INIT_LIST_HEAD(entry);
}
/**
@@ -231,7 +231,7 @@ static inline void list_splice_init(struct list_head *list,
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
pos = pos->prev, prefetch(pos->prev))
-
+
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
diff --git a/accel-pppd/triton/loader.c b/accel-pppd/triton/loader.c
index 6eb43734..73e767fc 100644
--- a/accel-pppd/triton/loader.c
+++ b/accel-pppd/triton/loader.c
@@ -96,7 +96,7 @@ int load_modules(const char *name)
int __export triton_module_loaded(const char *name)
{
struct module_t *m;
-
+
list_for_each_entry(m, &modules, entry) {
if (strcmp(m->name, name))
continue;
diff --git a/accel-pppd/triton/log.c b/accel-pppd/triton/log.c
index 668d9e92..f34650f1 100644
--- a/accel-pppd/triton/log.c
+++ b/accel-pppd/triton/log.c
@@ -66,10 +66,10 @@ void triton_log_error(const char *fmt,...)
void triton_log_debug(const char *fmt,...)
{
va_list ap;
-
+
if (!f_debug)
return;
-
+
va_start(ap, fmt);
do_log(f_debug, fmt, ap);
va_end(ap);
diff --git a/accel-pppd/triton/md.c b/accel-pppd/triton/md.c
index 6067ff2e..b490d0c0 100644
--- a/accel-pppd/triton/md.c
+++ b/accel-pppd/triton/md.c
@@ -55,8 +55,8 @@ void md_run(void)
void md_terminate(void)
{
- pthread_cancel(md_thr);
- pthread_join(md_thr, NULL);
+ pthread_cancel(md_thr);
+ pthread_join(md_thr, NULL);
}
static void *md_thread(void *arg)
@@ -78,7 +78,7 @@ static void *md_thread(void *arg)
triton_log_error("md:epoll_wait: %s", strerror(errno));
_exit(-1);
}
-
+
for(i = 0; i < n; i++) {
h = (struct _triton_md_handler_t *)epoll_events[i].data.ptr;
if (!h->ud)
@@ -99,7 +99,7 @@ static void *md_thread(void *arg)
if (r)
triton_thread_wakeup(h->ctx->thread);
}
-
+
while (!list_empty(&freed_list2)) {
h = list_entry(freed_list2.next, typeof(*h), entry);
list_del(&h->entry);
@@ -144,7 +144,7 @@ void __export triton_md_unregister_handler(struct triton_md_handler_t *ud, int c
close(ud->fd);
ud->fd = -1;
}
-
+
spin_lock(&h->ctx->lock);
h->ud = NULL;
list_del(&h->entry);
@@ -173,15 +173,15 @@ int __export triton_md_enable_handler(struct triton_md_handler_t *ud, int mode)
h->epoll_event.events |= EPOLLIN;
if (mode & MD_MODE_WRITE)
h->epoll_event.events |= EPOLLOUT;
-
+
if (h->trig_level)
h->epoll_event.events |= EPOLLONESHOT;
else
h->epoll_event.events |= EPOLLET;
-
+
if (events == h->epoll_event.events)
return 0;
-
+
if (events) {
if (h->armed)
r = epoll_ctl(epoll_fd, EPOLL_CTL_MOD, h->ud->fd, &h->epoll_event);
@@ -208,15 +208,15 @@ int __export triton_md_disable_handler(struct triton_md_handler_t *ud,int mode)
if (!h->epoll_event.events)
return 0;
-
+
if (mode & MD_MODE_READ)
h->epoll_event.events &= ~EPOLLIN;
if (mode & MD_MODE_WRITE)
h->epoll_event.events &= ~EPOLLOUT;
-
+
if (!(h->epoll_event.events & (EPOLLIN | EPOLLOUT)))
h->epoll_event.events = 0;
-
+
if (events == h->epoll_event.events)
return 0;
diff --git a/accel-pppd/triton/mempool.c b/accel-pppd/triton/mempool.c
index 7c8c56c9..ecc91f34 100644
--- a/accel-pppd/triton/mempool.c
+++ b/accel-pppd/triton/mempool.c
@@ -84,7 +84,7 @@ mempool_t __export *mempool_create(int size)
mempool_t __export *mempool_create2(int size)
{
struct _mempool_t *p = (struct _mempool_t *)mempool_create(size);
-
+
p->mmap = 1;
return (mempool_t *)p;
@@ -105,7 +105,7 @@ void __export *mempool_alloc(mempool_t *pool)
--p->objects;
__sync_sub_and_fetch(&triton_stat.mempool_available, size);
-
+
return it->ptr;
#ifdef VALGRIND
}
@@ -275,7 +275,7 @@ static int mmap_grow(void)
}
mmap_endptr = ptr + size;
-
+
__sync_add_and_fetch(&triton_stat.mempool_allocated, size);
__sync_add_and_fetch(&triton_stat.mempool_available, size);
diff --git a/accel-pppd/triton/mempool.h b/accel-pppd/triton/mempool.h
index 53eebfb7..9b95af09 100644
--- a/accel-pppd/triton/mempool.h
+++ b/accel-pppd/triton/mempool.h
@@ -5,7 +5,7 @@
struct mempool_stat_t
{
- uint32_t allocated;
+ uint32_t allocated;
uint32_t available;
};
diff --git a/accel-pppd/triton/options.c b/accel-pppd/triton/options.c
index a5214e21..8ff617cf 100644
--- a/accel-pppd/triton/options.c
+++ b/accel-pppd/triton/options.c
@@ -11,38 +11,38 @@ static struct conf_file_sect_t *sect=NULL;
static const char* find_option(const char *name)
{
struct option_t *opt;
-
+
if (!sect)
{
sect=conf_file_get_section("options");
if (!sect) return 0;
}
-
+
list_for_each_entry(opt,&sect->items,entry)
{
if (strcmp(opt->name,name)==0)
return opt->val;
}
-
+
return NULL;
}
int triton_get_int_option(const char *str)
{
const char *val=find_option(str);
if (!val) return 0;
-
+
return atoi(val);
}
const char* triton_get_str_option(const char *str)
{
const char *val=find_option(str);
-
+
return val;
}
double triton_get_double_option(const char *str)
{
const char *val=find_option(str);
if (!val) return 0;
-
+
return atof(val);
}
diff --git a/accel-pppd/triton/timer.c b/accel-pppd/triton/timer.c
index 1e4f0612..18599ef3 100644
--- a/accel-pppd/triton/timer.c
+++ b/accel-pppd/triton/timer.c
@@ -85,7 +85,7 @@ void *timer_thread(void *arg)
triton_log_error("timer:epoll_wait: %s", strerror(errno));
_exit(-1);
}
-
+
for(i = 0; i < n; i++) {
t = (struct _triton_timer_t *)epoll_events[i].data.ptr;
if (!t->ud)
@@ -141,21 +141,21 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_
return -1;
}
- if (fcntl(t->fd, F_SETFL, O_NONBLOCK)) {
+ if (fcntl(t->fd, F_SETFL, O_NONBLOCK)) {
triton_log_error("timer: failed to set nonblocking mode: %s", strerror(errno));
goto out_err;
}
-
+
__sync_add_and_fetch(&t->ctx->refs, 1);
ud->tpd = t;
if (triton_timer_mod(ud, abs_time))
goto out_err;
-
+
spin_lock(&t->ctx->lock);
list_add_tail(&t->entry, &t->ctx->timers);
spin_unlock(&t->ctx->lock);
-
+
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, t->fd, &t->epoll_event)) {
triton_log_error("timer:epoll_ctl: %s", strerror(errno));
spin_lock(&t->ctx->lock);
@@ -166,7 +166,7 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_
}
triton_stat.timer_count++;
-
+
return 0;
out_err:
@@ -214,9 +214,9 @@ void __export triton_timer_del(struct triton_timer_t *ud)
pthread_mutex_lock(&freed_list_lock);
list_add_tail(&t->entry, &freed_list);
pthread_mutex_unlock(&freed_list_lock);
-
+
ud->tpd = NULL;
-
+
triton_stat.timer_count--;
}
diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c
index b190187d..7a494a5a 100644
--- a/accel-pppd/triton/triton.c
+++ b/accel-pppd/triton/triton.c
@@ -121,13 +121,13 @@ static void* triton_thread(struct _triton_thread_t *thread)
log_debug2("thread: %p: sleeping\n", thread);
if (!terminate)
list_add(&thread->entry2, &sleep_threads);
-
+
if (__sync_sub_and_fetch(&triton_stat.thread_active, 1) == 0 && need_config_reload) {
spin_unlock(&threads_lock);
__config_reload(config_reload_notify);
} else
spin_unlock(&threads_lock);
-
+
if (terminate) {
spin_lock(&threads_lock);
list_del(&thread->entry);
@@ -209,7 +209,7 @@ static void ctx_thread(struct _triton_context_t *ctx)
spin_unlock(&ctx->lock);
__sync_sub_and_fetch(&triton_stat.md_handler_pending, 1);
-
+
h->armed = 0;
if ((events & (EPOLLIN | EPOLLERR | EPOLLHUP)) && (h->epoll_event.events & EPOLLIN)) {
@@ -242,7 +242,7 @@ static void ctx_thread(struct _triton_context_t *ctx)
ctx->pending = 0;
spin_unlock(&ctx->lock);
- break;
+ break;
}
spin_lock(&ctx->lock);
@@ -293,7 +293,7 @@ int triton_queue_ctx(struct _triton_context_t *ctx)
return 0;
}
- if (list_empty(&sleep_threads) || need_config_reload || triton_stat.thread_active > thread_count ||
+ if (list_empty(&sleep_threads) || need_config_reload || triton_stat.thread_active > thread_count ||
(ctx->priority == 0 && triton_stat.thread_count > thread_count_max)) {
if (ctx->priority)
list_add(&ctx->entry2, &ctx_queue);
@@ -403,7 +403,7 @@ void __export triton_context_unregister(struct triton_context_t *ud)
terminate = 1;
}
spin_unlock(&ctx_list_lock);
-
+
if (terminate) {
spin_lock(&threads_lock);
list_for_each_entry(t, &threads, entry)
@@ -415,7 +415,7 @@ void __export triton_context_unregister(struct triton_context_t *ud)
void __export triton_context_set_priority(struct triton_context_t *ud, int prio)
{
struct _triton_context_t *ctx = (struct _triton_context_t *)ud->tpd;
-
+
ctx->priority = prio > 0;
}
@@ -423,7 +423,7 @@ void __export triton_context_schedule()
{
struct _triton_context_t *ctx = (struct _triton_context_t *)this_ctx->tpd;
struct _triton_thread_t *t = NULL;
-
+
log_debug2("ctx %p: enter schedule\n", ctx);
__sync_add_and_fetch(&triton_stat.context_sleeping, 1);
__sync_sub_and_fetch(&triton_stat.thread_active, 1);
@@ -568,7 +568,7 @@ static void ru_update(struct triton_timer_t *t)
clock_gettime(CLOCK_MONOTONIC, &ts);
dt = (ts.tv_sec - ru_timestamp.tv_sec) * 1000000 + (ts.tv_nsec - ru_timestamp.tv_nsec) / 1000000;
- val = (double)((rusage.ru_utime.tv_sec - ru_utime.tv_sec) * 1000000 + (rusage.ru_utime.tv_usec - ru_utime.tv_usec) +
+ val = (double)((rusage.ru_utime.tv_sec - ru_utime.tv_sec) * 1000000 + (rusage.ru_utime.tv_usec - ru_utime.tv_usec) +
(rusage.ru_stime.tv_sec - ru_stime.tv_sec) * 1000000 + (rusage.ru_stime.tv_usec - ru_stime.tv_usec)) / dt * 100;
triton_stat.cpu = val;
@@ -637,7 +637,7 @@ int __export triton_load_modules(const char *mod_sect)
list_del(&i->entry);
free(i);
}
-
+
return 0;
}
@@ -721,7 +721,7 @@ void __export triton_terminate()
spin_unlock(&threads_lock);
sleep(1);
}
-
+
md_terminate();
timer_terminate();
}
diff --git a/accel-pppd/triton/triton.h b/accel-pppd/triton/triton.h
index 89e8577c..b66737cf 100644
--- a/accel-pppd/triton/triton.h
+++ b/accel-pppd/triton/triton.h
@@ -49,7 +49,7 @@ struct conf_option_t
struct conf_sect_t
{
- const char *name;
+ const char *name;
struct list_head items;
};
diff --git a/accel-pppd/triton/triton_p.h b/accel-pppd/triton/triton_p.h
index 2bbccbd1..6c9f884d 100644
--- a/accel-pppd/triton/triton_p.h
+++ b/accel-pppd/triton/triton_p.h
@@ -24,10 +24,10 @@ struct _triton_context_t
{
struct list_head entry;
struct list_head entry2;
-
+
spinlock_t lock;
struct _triton_thread_t *thread;
-
+
struct list_head handlers;
struct list_head timers;
struct list_head pending_handlers;