+ /* create a dynamic working set to match file size */
+
+ /* start with total size of the data we got from app_profile */
+ ele_count = cache_size;
+ /* skip the startup header */
+ ele_count -= sizeof(struct tws_startup);
+ /*
+ * For each startup cache entry, we have one of these:
+ * tws_startup_ptr_t startup->table[];
+ * struct tws_startup_ptr startup->ele[];
+ * struct tws_startup_ele startup->array[];
+ */
+ ele_count /= (sizeof (tws_startup_ptr_t) +
+ sizeof (struct tws_startup_ptr) +
+ sizeof (struct tws_startup_ele));
+
+ /*
+ * Sanity check: make sure the value for startup->array_size
+ * that we read from the app_profile file matches the size
+ * of the data we read from disk. If it doesn't match, we
+ * can't trust the data and we just drop it all.
+ */
+ if (cache_size < sizeof(struct tws_startup) ||
+ startup->array_size != ele_count) {
+ tws_read_startup_file_rejects++;