1509 else
1510 ino = iunique(configfs_sb, 2);
1511
1512 if (filldir(dirent, name, len, filp->f_pos, ino,
1513 dt_type(next)) < 0)
1514 return 0;
1515
1516 spin_lock(&configfs_dirent_lock);
1517 list_move(q, p);
1518 spin_unlock(&configfs_dirent_lock);
1519 p = q;
1520 filp->f_pos++;
1521 }
1522 }
1523 return 0;
1524}
1525
1526static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
1527{
1528 struct dentry * dentry = file->f_path.dentry;
1529
1530 mutex_lock(&dentry->d_inode->i_mutex);
1531 switch (origin) {
1532 case 1:
1533 offset += file->f_pos;
1534 case 0:
1535 if (offset >= 0)
1536 break;
1537 default:
1538 mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
1539 return -EINVAL;
1540 }
1541 if (offset != file->f_pos) {
1542 file->f_pos = offset;
1543 if (file->f_pos >= 2) {
1544 struct configfs_dirent *sd = dentry->d_fsdata;
1545 struct configfs_dirent *cursor = file->private_data;
1546 struct list_head *p;
1547 loff_t n = file->f_pos - 2;
1548
1549 spin_lock(&configfs_dirent_lock);