- if (i == cifs_nr) {
- /*
- * This is a new filesystem: Look for an unused entry to store it.
- */
- for (i = 0; i < cifs_nr; i++) {
- st_hdr_cifs_i = st_hdr_cifs + i;
- if (!st_hdr_cifs_i->used) {
- /* Unused entry found... */
- st_hdr_cifs_i->used = TRUE; /* Indicate it is now used */
- st_hdr_cifs_i->active = TRUE;
- strncpy(st_hdr_cifs_i->name, name, MAX_NAME_LEN - 1);
- st_hdr_cifs_i->name[MAX_NAME_LEN - 1] = '\0';
- st_cifs_i = st_cifs[curr] + i;
- *st_cifs_i = *((struct cifs_stats *) st_io);
- break;
- }
- }
- if (i == cifs_nr) {
- /*
- * It is a new CIFS directory
- * but there is no free structure to store it.
- */
-
- /* All entries are used: The number has to be increased */
- cifs_nr = cifs_nr + 5;
-
- /* Increase the size of st_hdr_ionfs buffer */
- if ((st_hdr_cifs = (struct io_hdr_stats *)
- realloc(st_hdr_cifs, cifs_nr * IO_HDR_STATS_SIZE)) == NULL) {
- perror("malloc");
- exit(4);
- }
-
- /* Set the new entries inactive */
- for (j = 0; j < 5; j++) {
- st_hdr_cifs_i = st_hdr_cifs + i + j;
- st_hdr_cifs_i->used = FALSE;
- st_hdr_cifs_i->active = FALSE;
- }
-
- /* Increase the size of st_hdr_ionfs buffer */
- for (j = 0; j < 2; j++) {
- if ((st_cifs[j] = (struct cifs_stats *)
- realloc(st_cifs[j], cifs_nr * CIFS_STATS_SIZE)) == NULL) {
- perror("malloc");
- exit(4);
- }
- memset(st_cifs[j] + i, 0, 5 * CIFS_STATS_SIZE);
- }
- /* Now i shows the first unused entry of the new block */
- st_hdr_cifs_i = st_hdr_cifs + i;
- st_hdr_cifs_i->used = TRUE; /* Indicate it is now used */
- st_hdr_cifs_i->active = TRUE;
- strncpy(st_hdr_cifs_i->name, name, MAX_NAME_LEN - 1);
- st_hdr_cifs_i->name[MAX_NAME_LEN - 1] = '\0';
- st_cifs_i = st_cifs[curr] + i;
- *st_cifs_i = *st_io;
- }
- } else {
- st_hdr_cifs_i = st_hdr_cifs + i;
- st_hdr_cifs_i->active = TRUE;
- st_hdr_cifs_i->used = TRUE;
- st_cifs_i = st_cifs[curr] + i;
- *st_cifs_i = *st_io;
- }
- /*
- * else it was a new CIFS directory
- * but there was no free structure to store it.
- */