-static int yaffs_stats_proc_read(char *page,
- char **start,
- off_t offset, int count, int *eof, void *data)
-{
- struct list_head *item;
- char *buf = page;
- int n = 0;
-
- mutex_lock(&yaffs_context_lock);
-
- /* Locate and print the Nth entry. Order N-squared but N is small. */
- list_for_each(item, &yaffs_context_list) {
- struct yaffs_linux_context *dc =
- list_entry(item, struct yaffs_linux_context, context_list);
- struct yaffs_dev *dev = dc->dev;
-
- int erased_chunks;
-
- erased_chunks =
- dev->n_erased_blocks * dev->param.chunks_per_block;
-
- buf += sprintf(buf, "%d, %d, %d, %u, %u, %u, %u\n",
- n, dev->n_free_chunks, erased_chunks,
- dev->bg_gcs, dev->oldest_dirty_gc_count,
- dev->n_obj, dev->n_tnodes);
- }
- mutex_unlock(&yaffs_context_lock);
-
- return buf - page < count ? buf - page : count;
-}