++static int iam_uapi_it(int cmd, struct inode *inode,
++ struct file *filp, struct iam_uapi_it *itop)
++{
++ struct iam_private_info *ipi;
++ struct iam_iterator *it;
++ enum iam_it_state st;
++ int result = 0;
++
++ ipi = get_ipi(filp);
++ it = &ipi->ipi_it;
++ st = it->ii_state;
++ switch (cmd) {
++ case IAM_IOC_IT_START:
++ result = iam_it_init(it, &ipi->ipi_bag,
++ IAM_IT_MOVE, ipi->ipi_ipd);
++ if (result == 0)
++ result = iam_it_get(it, itop->iui_op.iul_key);
++ break;
++ case IAM_IOC_IT_NEXT:
++ if (st == IAM_IT_ATTACHED ||
++ st == IAM_IT_BEFORE || st == IAM_IT_EMPTY)
++ result = iam_it_next(it);
++ else
++ result = -EBUSY;
++ break;
++ case IAM_IOC_IT_STOP:
++ iam_it_put(it);
++ iam_it_fini(it);
++ result = 0;
++ break;
++ }
++ st = it->ii_state;
++ if (st == IAM_IT_ATTACHED || st == IAM_IT_BEFORE)
++ iam_keycpy0(&ipi->ipi_bag, itop->iui_op.iul_key,
++ iam_it_key_get(it, itop->iui_op.iul_key));
++ if (st == IAM_IT_ATTACHED)
++ iam_reccpy(&it->ii_path,
++ itop->iui_op.iul_rec, iam_it_rec_get(it));
++ itop->iui_state = st;
++ return result;
++}
++