LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * Mirror one arena partition onto another.·· | 2 * Mirror one arena partition onto another.·· |
3 * Be careful to copy only new data. | 3 * Be careful to copy only new data. |
4 */ | 4 */ |
5 | 5 |
6 #include "stdinc.h" | 6 #include "stdinc.h" |
7 #include "dat.h" | 7 #include "dat.h" |
8 #include "fns.h" | 8 #include "fns.h" |
9 | 9 |
10 Channel *writechan; | 10 Channel *writechan; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 enum· | 56 enum· |
57 { | 57 { |
58 Sealed = 1, | 58 Sealed = 1, |
59 Mirrored = 2, | 59 Mirrored = 2, |
60 Empty = 4, | 60 Empty = 4, |
61 }; | 61 }; |
62 | 62 |
63 void | 63 void |
64 setstatus(int bits) | 64 setstatus(int bits) |
65 { | 65 { |
66 » static int startindx = -1, endindx; | 66 » static int startindx = -1; |
67 static char *startname, *endname; | 67 static char *startname, *endname; |
68 static int lastbits; | 68 static int lastbits; |
69 char buf[100]; | 69 char buf[100]; |
70 | 70 |
71 if(bits != lastbits) { | 71 if(bits != lastbits) { |
72 if(startindx >= 0) { | 72 if(startindx >= 0) { |
73 switch(lastbits) { | 73 switch(lastbits) { |
74 case Sealed: | 74 case Sealed: |
75 snprint(buf, sizeof buf, "sealed"); | 75 snprint(buf, sizeof buf, "sealed"); |
76 break; | 76 break; |
77 case Mirrored: | 77 case Mirrored: |
78 snprint(buf, sizeof buf, "mirrored"); | 78 snprint(buf, sizeof buf, "mirrored"); |
79 break; | 79 break; |
80 case Sealed+Mirrored: | 80 case Sealed+Mirrored: |
81 snprint(buf, sizeof buf, "mirrored sealed"); | 81 snprint(buf, sizeof buf, "mirrored sealed"); |
82 break; | 82 break; |
83 case Empty: | 83 case Empty: |
84 snprint(buf, sizeof buf, "empty"); | 84 snprint(buf, sizeof buf, "empty"); |
85 break; | 85 break; |
86 default: | 86 default: |
87 snprint(buf, sizeof buf, "%d", bits); | 87 snprint(buf, sizeof buf, "%d", bits); |
88 break; | 88 break; |
89 } | 89 } |
90 print("%T %s-%s %s\n", startname, endname, buf); | 90 print("%T %s-%s %s\n", startname, endname, buf); |
91 } | 91 } |
92 lastbits = bits; | 92 lastbits = bits; |
93 startindx = tagindx; | 93 startindx = tagindx; |
94 endindx = tagindx; | |
95 startname = tagname; | 94 startname = tagname; |
96 endname = tagname; | 95 endname = tagname; |
97 } else { | 96 } else { |
98 endindx = tagindx; | |
99 endname = tagname; | 97 endname = tagname; |
100 } | 98 } |
101 if(bits < 0) { | 99 if(bits < 0) { |
102 startindx = -1; | 100 startindx = -1; |
103 endindx = -1; | |
104 return; | 101 return; |
105 }······· | 102 }······· |
106 } | 103 } |
107 | 104 |
108 void | 105 void |
109 chat(char *fmt, ...) | 106 chat(char *fmt, ...) |
110 { | 107 { |
111 va_list arg; | 108 va_list arg; |
112 | 109 |
113 setstatus(-1); | 110 setstatus(-1); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 ········ | 592 ········ |
596 /* | 593 /* |
597 * Mirror one arena at a time. | 594 * Mirror one arena at a time. |
598 */ | 595 */ |
599 writechan = chancreate(sizeof(void*), 0); | 596 writechan = chancreate(sizeof(void*), 0); |
600 vtproc(writeproc, nil); | 597 vtproc(writeproc, nil); |
601 mirrormany(s, d, ranges); | 598 mirrormany(s, d, ranges); |
602 sendp(writechan, nil); | 599 sendp(writechan, nil); |
603 threadexitsall(status); | 600 threadexitsall(status); |
604 } | 601 } |
LEFT | RIGHT |