Presentation is loading. Please wait.

Presentation is loading. Please wait.

2009/12/8 Report 報告學生 : 黃健瑋 指導教授 : 李正帆 1. Content seq_file structure proc file Data structure(not completed) 2.

Similar presentations


Presentation on theme: "2009/12/8 Report 報告學生 : 黃健瑋 指導教授 : 李正帆 1. Content seq_file structure proc file Data structure(not completed) 2."— Presentation transcript:

1 2009/12/8 Report 報告學生 : 黃健瑋 指導教授 : 李正帆 1

2 Content seq_file structure proc file Data structure(not completed) 2

3 seq_file 1/4 static void *my_seq_start(struct seq_file *s, loff_t *pos) { if (*pos >= CLIENT_SIZE) { …… return NULL; } …… return (void *)((unsigned long) *pos); } 3

4 seq_file 2/4 static void *my_seq_next(struct seq_file *s, void *v, loff_t *pos) { ++(*pos); if(*pos >= CLIENT_SIZE) { return NULL; } return (void *)((unsigned long)*pos); } 4

5 seq_file 3/4 static void my_seq_stop(struct seq_file *s, void *v) { /* nothing to do, we use a static value in start() */ …… } 5

6 seq_file 4/4 static int my_seq_show(struct seq_file *s, void *v) { …… n = (int)v; if(proc[n].dstIP == 0) return 0; IpAddressToString(proc[n].dstIP, temp); seq_printf(s, "%s %d\n", temp, proc[n].dstPort); seq_printf(s, "%s\n", proc[n].chnName); seq_printf(s, "%d\n", (int)proc[n].tStamp); seq_printf(s, "%d\n", proc[n].num); for(i = 0; i < proc[n].num; i++) { IpAddressToString(proc[n].peer[i].peerIP, temp); seq_printf(s, "%s %d\n", temp, proc[n].peer[i].peerPort); } return 0; } 6

7 7

8 proc file proc file added: deleteClient Delete client –echo IP >> /proc/deleteClient 8

9 Date structure 1/3 struct _proc { unsigned short num; struct _client client[CLIENT_SIZE] char chnName[100]; struct _peer peer[PEER_LIST_SIZE]; }; 9

10 Data structure 2/3 4kb problem –One channel data too big 10

11 Data structure 3/3 Solution: 11

12 Reference http://lwn.net/Articles/159101/ http://blog.xuite.net/johnny.hung543/reminiscence/15462529 http://blog.chinaunix.net/u2/74189/showart_1672153.html http://hi.baidu.com/liuming910/blog/item/fc2840f576295b66dcc4745d.html http://blog.csdn.net/flowingflying/archive/2009/09/18/4566701.aspx http://tldp.org/LDP/lkmpg/2.6/html/x861.html http://daydreamer.idv.tw/rewrite.php/read-50.html 12


Download ppt "2009/12/8 Report 報告學生 : 黃健瑋 指導教授 : 李正帆 1. Content seq_file structure proc file Data structure(not completed) 2."

Similar presentations


Ads by Google