RE: [PATCH v3 3/4] rsockets: distribute completion queue vectors

Hefty, Sean
2014-09-08T15:54:48Z

> @@ -548,6 +550,37 @@ void rs_configure(void)
> (void) fscanf(f, "%hu", &restart_onintr);
> fclose(f);
> }
> +
> + if ((f = fopen(RS_CONF_DIR "/comp_vector", "r"))) {
> + char vbuf[256];
> + char *vptr;
> + vptr = fgets(vbuf, sizeof(vbuf), f);
> + fclose(f);
> + if (vptr) {
> + char *tok, *save, *tmp, *str, *tok2;
> + int lvect, uvect, vect;
> +
> + for (str = vptr; ; str = NULL) {
> + tok = strtok_r(str, ",", &save);
> + if (tok == NULL) {
> + break;
> + }
> + if (!(tmp = strpbrk(tok, "-"))) {
> + lvect = uvect = atoi(tok);
> + } else {
> + tok2 = tmp + 1;
> + *tmp = '\0';
> + lvect = atoi(tok);
> + uvect = atoi(tok2);
> + }
> + lvect = (lvect < 0) ? 0 : ((lvect > 63) ? 63 :
> lvect);
> + uvect = (uvect < 0) ? 0 : ((uvect > 63) ? 63 :
> uvect);
> + for (vect = lvect; vect <= uvect; vect++) {
> + comp_vector_mask |= ((uint64_t)1 << vect);
> + }
> + }
> + }
> + }

Please isolate this functionality into its own function.

- Sean