blobstore.c (eucalyptus-4.4.1) | : | blobstore.c (eucalyptus-4.4.2) | ||
---|---|---|---|---|
skipping to change at line 2967 | skipping to change at line 2967 | |||
blockblob_meta *head = NULL; | blockblob_meta *head = NULL; | |||
blockblob *bbs = NULL; | blockblob *bbs = NULL; | |||
int ret = 0; | int ret = 0; | |||
regex_t re; | regex_t re; | |||
if (regcomp(&re, regex, REG_NOSUB) != 0) { | if (regcomp(&re, regex, REG_NOSUB) != 0) { | |||
ERR(BLOBSTORE_ERROR_UNKNOWN, "failed to parse search regular expression" ); | ERR(BLOBSTORE_ERROR_UNKNOWN, "failed to parse search regular expression" ); | |||
return -1; | return -1; | |||
} | } | |||
int blobstore_locked = 0; | ||||
if (blobstore_lock(bs, BLOBSTORE_LOCK_TIMEOUT_USEC) == -1) { // lock it s o we can traverse blobstore safely | if (blobstore_lock(bs, BLOBSTORE_LOCK_TIMEOUT_USEC) == -1) { // lock it s o we can traverse blobstore safely | |||
ERR(BLOBSTORE_ERROR_UNKNOWN, "failed to lock the blobstore"); | ERR(BLOBSTORE_ERROR_UNKNOWN, "failed to lock the blobstore"); | |||
ret = -1; | ret = -1; | |||
goto free; | goto free; | |||
} else { | ||||
blobstore_locked = 1; | ||||
} | } | |||
// put existing items in the blobstore into a LL | // put existing items in the blobstore into a LL | |||
_blobstore_errno = BLOBSTORE_ERROR_OK; | _blobstore_errno = BLOBSTORE_ERROR_OK; | |||
bbs = scan_blobstore(bs, NULL); | bbs = scan_blobstore(bs, NULL); | |||
if (bbs == NULL) { | if (bbs == NULL) { | |||
if (_blobstore_errno != BLOBSTORE_ERROR_OK) { | if (_blobstore_errno != BLOBSTORE_ERROR_OK) { | |||
ret = -1; | ret = -1; | |||
goto free; | goto free; | |||
} | } | |||
} | } | |||
skipping to change at line 3014 | skipping to change at line 3017 | |||
bm->last_modified = abb->last_modified; | bm->last_modified = abb->last_modified; | |||
if (head == NULL) { | if (head == NULL) { | |||
head = bm; | head = bm; | |||
} else { | } else { | |||
prev->next = bm; | prev->next = bm; | |||
bm->prev = prev; | bm->prev = prev; | |||
} | } | |||
prev = bm; | prev = bm; | |||
} | } | |||
*results = head; | ||||
ret = blobs_matched; | ret = blobs_matched; | |||
free: | free: | |||
regfree(&re); // free the regular expression | regfree(&re); // free the regular expression | |||
if (bbs) | if (bbs) | |||
free_bbs(bbs); // free the blockblobs LL returned by the search function | free_bbs(bbs); // free the blockblobs LL returned by the search function | |||
if (blobstore_unlock(bs) == -1) { | if (blobstore_locked && blobstore_unlock(bs) == -1) { | |||
ERR(BLOBSTORE_ERROR_UNKNOWN, "failed to unlock the blobstore"); | ERR(BLOBSTORE_ERROR_UNKNOWN, "failed to unlock the blobstore"); | |||
ret = -1; | ret = -1; | |||
} | } | |||
if (ret < 0) { // there were problems, so free the parti al linked list, if any | if (ret < 0) { // there were problems, so free the parti al linked list, if any | |||
for (blockblob_meta * bm = head; bm;) { | for (blockblob_meta * bm = head; bm;) { | |||
blockblob_meta *next = bm->next; | blockblob_meta *next = bm->next; | |||
EUCA_FREE(bm); | EUCA_FREE(bm); | |||
bm = next; | bm = next; | |||
} | } | |||
} else { | ||||
*results = head; | ||||
} | } | |||
return ret; | return ret; | |||
} | } | |||
//! | //! | |||
//! | //! | |||
//! | //! | |||
//! @param[in] bs | //! @param[in] bs | |||
//! @param[in] regex | //! @param[in] regex | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added |