/* This function is called when mounting to erase orphans from the previous session. If UBIFS was not unmounted cleanly, then the inodes recorded as orphans are deleted.  */
int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only)
/* This function is called when mounting to erase orphans from the previous session. If UBIFS was not unmounted cleanly, then the inodes recorded as orphans are deleted.  */
int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only)
{
	int err = 0;
	c->max_orphans = tot_avail_orphs(c);
	if (!read_only) {
		c->orph_buf = vmalloc(c->leb_size);
		if (!c->orph_buf)
			return -ENOMEM;
	}
	if (unclean)
		err = kill_orphans(c);
	else if (!read_only)
		err = ubifs_clear_orphans(c);
	return err;
}