XXX we could do a better algorithm here... */
| 182 | |
| 183 | /* XXX we could do a better algorithm here... */ |
| 184 | int |
| 185 | cirbuf_align_left(struct cirbuf * cbuf) |
| 186 | { |
| 187 | if (!cbuf) |
| 188 | return -EINVAL; |
| 189 | |
| 190 | if (cbuf->start < cbuf->maxlen/2) { |
| 191 | while (cbuf->start != 0) { |
| 192 | __cirbuf_shift_left(cbuf); |
| 193 | } |
| 194 | } |
| 195 | else { |
| 196 | while (cbuf->start != 0) { |
| 197 | __cirbuf_shift_right(cbuf); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | return 0; |
| 202 | } |
| 203 | |
| 204 | /* XXX we could do a better algorithm here... */ |
| 205 | int |