if: redirect messages of external threads to resource channels

This commit is contained in:
Thomas Schoebel-Theuer 2012-11-15 13:53:26 +01:00 committed by Thomas Schoebel-Theuer
parent f88c3c12ad
commit ea9068e992
3 changed files with 8 additions and 1 deletions

View File

@ -29,7 +29,7 @@
#define SAY_ORDER 0 #define SAY_ORDER 0
#define SAY_BUFMAX (PAGE_SIZE << SAY_ORDER) #define SAY_BUFMAX (PAGE_SIZE << SAY_ORDER)
#define MAX_FILELEN 16 #define MAX_FILELEN 16
#define MAX_IDS 64 #define MAX_IDS 1000
char *say_class[MAX_SAY_CLASS] = { char *say_class[MAX_SAY_CLASS] = {
[SAY_DEBUG] = "debug", [SAY_DEBUG] = "debug",

View File

@ -274,6 +274,8 @@ if_make_request(struct request_queue *q, struct bio *bio)
int total_len = bio->bi_size; int total_len = bio->bi_size;
int error = -ENOSYS; int error = -ENOSYS;
bind_to_channel(brick->say_channel, current);
MARS_IO("bio %p " MARS_IO("bio %p "
"size = %d " "size = %d "
"rw = %d " "rw = %d "
@ -576,6 +578,8 @@ err:
#endif #endif
done: done:
remove_binding_from(brick->say_channel, current);
#ifdef BIO_CPU_AFFINE #ifdef BIO_CPU_AFFINE
return error; return error;
#else #else
@ -661,6 +665,8 @@ static int if_switch(struct if_brick *brick)
if (brick->power.button && brick->power.led_off) { if (brick->power.button && brick->power.led_off) {
mars_power_led_off((void*)brick, false); mars_power_led_off((void*)brick, false);
brick->say_channel = get_binding(current);
capacity = compute_capacity(brick); capacity = compute_capacity(brick);
status = -ENOMEM; status = -ENOMEM;
q = blk_alloc_queue(GFP_MARS); q = blk_alloc_queue(GFP_MARS);

View File

@ -80,6 +80,7 @@ struct if_brick {
// inspectable // inspectable
// private // private
struct semaphore switch_sem; struct semaphore switch_sem;
struct say_channel *say_channel;
}; };
MARS_TYPES(if); MARS_TYPES(if);