aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/compat_ioctl.c337
1 files changed, 0 insertions, 337 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 24c743571127..b9e3357bcc2e 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -32,7 +32,6 @@
32#include <linux/vt.h> 32#include <linux/vt.h>
33#include <linux/fs.h> 33#include <linux/fs.h>
34#include <linux/file.h> 34#include <linux/file.h>
35#include <linux/fd.h>
36#include <linux/ppp_defs.h> 35#include <linux/ppp_defs.h>
37#include <linux/if_ppp.h> 36#include <linux/if_ppp.h>
38#include <linux/if_pppox.h> 37#include <linux/if_pppox.h>
@@ -1407,333 +1406,6 @@ static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg)
1407#define HIDPGETCONNLIST _IOR('H', 210, int) 1406#define HIDPGETCONNLIST _IOR('H', 210, int)
1408#define HIDPGETCONNINFO _IOR('H', 211, int) 1407#define HIDPGETCONNINFO _IOR('H', 211, int)
1409 1408
1410#ifdef CONFIG_BLOCK
1411struct floppy_struct32 {
1412 compat_uint_t size;
1413 compat_uint_t sect;
1414 compat_uint_t head;
1415 compat_uint_t track;
1416 compat_uint_t stretch;
1417 unsigned char gap;
1418 unsigned char rate;
1419 unsigned char spec1;
1420 unsigned char fmt_gap;
1421 const compat_caddr_t name;
1422};
1423
1424struct floppy_drive_params32 {
1425 char cmos;
1426 compat_ulong_t max_dtr;
1427 compat_ulong_t hlt;
1428 compat_ulong_t hut;
1429 compat_ulong_t srt;
1430 compat_ulong_t spinup;
1431 compat_ulong_t spindown;
1432 unsigned char spindown_offset;
1433 unsigned char select_delay;
1434 unsigned char rps;
1435 unsigned char tracks;
1436 compat_ulong_t timeout;
1437 unsigned char interleave_sect;
1438 struct floppy_max_errors max_errors;
1439 char flags;
1440 char read_track;
1441 short autodetect[8];
1442 compat_int_t checkfreq;
1443 compat_int_t native_format;
1444};
1445
1446struct floppy_drive_struct32 {
1447 signed char flags;
1448 compat_ulong_t spinup_date;
1449 compat_ulong_t select_date;
1450 compat_ulong_t first_read_date;
1451 short probed_format;
1452 short track;
1453 short maxblock;
1454 short maxtrack;
1455 compat_int_t generation;
1456 compat_int_t keep_data;
1457 compat_int_t fd_ref;
1458 compat_int_t fd_device;
1459 compat_int_t last_checked;
1460 compat_caddr_t dmabuf;
1461 compat_int_t bufblocks;
1462};
1463
1464struct floppy_fdc_state32 {
1465 compat_int_t spec1;
1466 compat_int_t spec2;
1467 compat_int_t dtr;
1468 unsigned char version;
1469 unsigned char dor;
1470 compat_ulong_t address;
1471 unsigned int rawcmd:2;
1472 unsigned int reset:1;
1473 unsigned int need_configure:1;
1474 unsigned int perp_mode:2;
1475 unsigned int has_fifo:1;
1476 unsigned int driver_version;
1477 unsigned char track[4];
1478};
1479
1480struct floppy_write_errors32 {
1481 unsigned int write_errors;
1482 compat_ulong_t first_error_sector;
1483 compat_int_t first_error_generation;
1484 compat_ulong_t last_error_sector;
1485 compat_int_t last_error_generation;
1486 compat_uint_t badness;
1487};
1488
1489#define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32)
1490#define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32)
1491#define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32)
1492#define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32)
1493#define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32)
1494#define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32)
1495#define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32)
1496#define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32)
1497#define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32)
1498
1499static struct {
1500 unsigned int cmd32;
1501 unsigned int cmd;
1502} fd_ioctl_trans_table[] = {
1503 { FDSETPRM32, FDSETPRM },
1504 { FDDEFPRM32, FDDEFPRM },
1505 { FDGETPRM32, FDGETPRM },
1506 { FDSETDRVPRM32, FDSETDRVPRM },
1507 { FDGETDRVPRM32, FDGETDRVPRM },
1508 { FDGETDRVSTAT32, FDGETDRVSTAT },
1509 { FDPOLLDRVSTAT32, FDPOLLDRVSTAT },
1510 { FDGETFDCSTAT32, FDGETFDCSTAT },
1511 { FDWERRORGET32, FDWERRORGET }
1512};
1513
1514#define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table)
1515
1516static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1517{
1518 mm_segment_t old_fs = get_fs();
1519 void *karg = NULL;
1520 unsigned int kcmd = 0;
1521 int i, err;
1522
1523 for (i = 0; i < NR_FD_IOCTL_TRANS; i++)
1524 if (cmd == fd_ioctl_trans_table[i].cmd32) {
1525 kcmd = fd_ioctl_trans_table[i].cmd;
1526 break;
1527 }
1528 if (!kcmd)
1529 return -EINVAL;
1530
1531 switch (cmd) {
1532 case FDSETPRM32:
1533 case FDDEFPRM32:
1534 case FDGETPRM32:
1535 {
1536 compat_uptr_t name;
1537 struct floppy_struct32 __user *uf;
1538 struct floppy_struct *f;
1539
1540 uf = compat_ptr(arg);
1541 f = karg = kmalloc(sizeof(struct floppy_struct), GFP_KERNEL);
1542 if (!karg)
1543 return -ENOMEM;
1544 if (cmd == FDGETPRM32)
1545 break;
1546 err = __get_user(f->size, &uf->size);
1547 err |= __get_user(f->sect, &uf->sect);
1548 err |= __get_user(f->head, &uf->head);
1549 err |= __get_user(f->track, &uf->track);
1550 err |= __get_user(f->stretch, &uf->stretch);
1551 err |= __get_user(f->gap, &uf->gap);
1552 err |= __get_user(f->rate, &uf->rate);
1553 err |= __get_user(f->spec1, &uf->spec1);
1554 err |= __get_user(f->fmt_gap, &uf->fmt_gap);
1555 err |= __get_user(name, &uf->name);
1556 f->name = compat_ptr(name);
1557 if (err) {
1558 err = -EFAULT;
1559 goto out;
1560 }
1561 break;
1562 }
1563 case FDSETDRVPRM32:
1564 case FDGETDRVPRM32:
1565 {
1566 struct floppy_drive_params32 __user *uf;
1567 struct floppy_drive_params *f;
1568
1569 uf = compat_ptr(arg);
1570 f = karg = kmalloc(sizeof(struct floppy_drive_params), GFP_KERNEL);
1571 if (!karg)
1572 return -ENOMEM;
1573 if (cmd == FDGETDRVPRM32)
1574 break;
1575 err = __get_user(f->cmos, &uf->cmos);
1576 err |= __get_user(f->max_dtr, &uf->max_dtr);
1577 err |= __get_user(f->hlt, &uf->hlt);
1578 err |= __get_user(f->hut, &uf->hut);
1579 err |= __get_user(f->srt, &uf->srt);
1580 err |= __get_user(f->spinup, &uf->spinup);
1581 err |= __get_user(f->spindown, &uf->spindown);
1582 err |= __get_user(f->spindown_offset, &uf->spindown_offset);
1583 err |= __get_user(f->select_delay, &uf->select_delay);
1584 err |= __get_user(f->rps, &uf->rps);
1585 err |= __get_user(f->tracks, &uf->tracks);
1586 err |= __get_user(f->timeout, &uf->timeout);
1587 err |= __get_user(f->interleave_sect, &uf->interleave_sect);
1588 err |= __copy_from_user(&f->max_errors, &uf->max_errors, sizeof(f->max_errors));
1589 err |= __get_user(f->flags, &uf->flags);
1590 err |= __get_user(f->read_track, &uf->read_track);
1591 err |= __copy_from_user(f->autodetect, uf->autodetect, sizeof(f->autodetect));
1592 err |= __get_user(f->checkfreq, &uf->checkfreq);
1593 err |= __get_user(f->native_format, &uf->native_format);
1594 if (err) {
1595 err = -EFAULT;
1596 goto out;
1597 }
1598 break;
1599 }
1600 case FDGETDRVSTAT32:
1601 case FDPOLLDRVSTAT32:
1602 karg = kmalloc(sizeof(struct floppy_drive_struct), GFP_KERNEL);
1603 if (!karg)
1604 return -ENOMEM;
1605 break;
1606 case FDGETFDCSTAT32:
1607 karg = kmalloc(sizeof(struct floppy_fdc_state), GFP_KERNEL);
1608 if (!karg)
1609 return -ENOMEM;
1610 break;
1611 case FDWERRORGET32:
1612 karg = kmalloc(sizeof(struct floppy_write_errors), GFP_KERNEL);
1613 if (!karg)
1614 return -ENOMEM;
1615 break;
1616 default:
1617 return -EINVAL;
1618 }
1619 set_fs (KERNEL_DS);
1620 err = sys_ioctl (fd, kcmd, (unsigned long)karg);
1621 set_fs (old_fs);
1622 if (err)
1623 goto out;
1624 switch (cmd) {
1625 case FDGETPRM32:
1626 {
1627 struct floppy_struct *f = karg;
1628 struct floppy_struct32 __user *uf = compat_ptr(arg);
1629
1630 err = __put_user(f->size, &uf->size);
1631 err |= __put_user(f->sect, &uf->sect);
1632 err |= __put_user(f->head, &uf->head);
1633 err |= __put_user(f->track, &uf->track);
1634 err |= __put_user(f->stretch, &uf->stretch);
1635 err |= __put_user(f->gap, &uf->gap);
1636 err |= __put_user(f->rate, &uf->rate);
1637 err |= __put_user(f->spec1, &uf->spec1);
1638 err |= __put_user(f->fmt_gap, &uf->fmt_gap);
1639 err |= __put_user((u64)f->name, (compat_caddr_t __user *)&uf->name);
1640 break;
1641 }
1642 case FDGETDRVPRM32:
1643 {
1644 struct floppy_drive_params32 __user *uf;
1645 struct floppy_drive_params *f = karg;
1646
1647 uf = compat_ptr(arg);
1648 err = __put_user(f->cmos, &uf->cmos);
1649 err |= __put_user(f->max_dtr, &uf->max_dtr);
1650 err |= __put_user(f->hlt, &uf->hlt);
1651 err |= __put_user(f->hut, &uf->hut);
1652 err |= __put_user(f->srt, &uf->srt);
1653 err |= __put_user(f->spinup, &uf->spinup);
1654 err |= __put_user(f->spindown, &uf->spindown);
1655 err |= __put_user(f->spindown_offset, &uf->spindown_offset);
1656 err |= __put_user(f->select_delay, &uf->select_delay);
1657 err |= __put_user(f->rps, &uf->rps);
1658 err |= __put_user(f->tracks, &uf->tracks);
1659 err |= __put_user(f->timeout, &uf->timeout);
1660 err |= __put_user(f->interleave_sect, &uf->interleave_sect);
1661 err |= __copy_to_user(&uf->max_errors, &f->max_errors, sizeof(f->max_errors));
1662 err |= __put_user(f->flags, &uf->flags);
1663 err |= __put_user(f->read_track, &uf->read_track);
1664 err |= __copy_to_user(uf->autodetect, f->autodetect, sizeof(f->autodetect));
1665 err |= __put_user(f->checkfreq, &uf->checkfreq);
1666 err |= __put_user(f->native_format, &uf->native_format);
1667 break;
1668 }
1669 case FDGETDRVSTAT32:
1670 case FDPOLLDRVSTAT32:
1671 {
1672 struct floppy_drive_struct32 __user *uf;
1673 struct floppy_drive_struct *f = karg;
1674
1675 uf = compat_ptr(arg);
1676 err = __put_user(f->flags, &uf->flags);
1677 err |= __put_user(f->spinup_date, &uf->spinup_date);
1678 err |= __put_user(f->select_date, &uf->select_date);
1679 err |= __put_user(f->first_read_date, &uf->first_read_date);
1680 err |= __put_user(f->probed_format, &uf->probed_format);
1681 err |= __put_user(f->track, &uf->track);
1682 err |= __put_user(f->maxblock, &uf->maxblock);
1683 err |= __put_user(f->maxtrack, &uf->maxtrack);
1684 err |= __put_user(f->generation, &uf->generation);
1685 err |= __put_user(f->keep_data, &uf->keep_data);
1686 err |= __put_user(f->fd_ref, &uf->fd_ref);
1687 err |= __put_user(f->fd_device, &uf->fd_device);
1688 err |= __put_user(f->last_checked, &uf->last_checked);
1689 err |= __put_user((u64)f->dmabuf, &uf->dmabuf);
1690 err |= __put_user((u64)f->bufblocks, &uf->bufblocks);
1691 break;
1692 }
1693 case FDGETFDCSTAT32:
1694 {
1695 struct floppy_fdc_state32 __user *uf;
1696 struct floppy_fdc_state *f = karg;
1697
1698 uf = compat_ptr(arg);
1699 err = __put_user(f->spec1, &uf->spec1);
1700 err |= __put_user(f->spec2, &uf->spec2);
1701 err |= __put_user(f->dtr, &uf->dtr);
1702 err |= __put_user(f->version, &uf->version);
1703 err |= __put_user(f->dor, &uf->dor);
1704 err |= __put_user(f->address, &uf->address);
1705 err |= __copy_to_user((char __user *)&uf->address + sizeof(uf->address),
1706 (char *)&f->address + sizeof(f->address), sizeof(int));
1707 err |= __put_user(f->driver_version, &uf->driver_version);
1708 err |= __copy_to_user(uf->track, f->track, sizeof(f->track));
1709 break;
1710 }
1711 case FDWERRORGET32:
1712 {
1713 struct floppy_write_errors32 __user *uf;
1714 struct floppy_write_errors *f = karg;
1715
1716 uf = compat_ptr(arg);
1717 err = __put_user(f->write_errors, &uf->write_errors);
1718 err |= __put_user(f->first_error_sector, &uf->first_error_sector);
1719 err |= __put_user(f->first_error_generation, &uf->first_error_generation);
1720 err |= __put_user(f->last_error_sector, &uf->last_error_sector);
1721 err |= __put_user(f->last_error_generation, &uf->last_error_generation);
1722 err |= __put_user(f->badness, &uf->badness);
1723 break;
1724 }
1725 default:
1726 break;
1727 }
1728 if (err)
1729 err = -EFAULT;
1730
1731out:
1732 kfree(karg);
1733 return err;
1734}
1735#endif
1736
1737struct mtd_oob_buf32 { 1409struct mtd_oob_buf32 {
1738 u_int32_t start; 1410 u_int32_t start;
1739 u_int32_t length; 1411 u_int32_t length;
@@ -3025,15 +2697,6 @@ HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
3025HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns) 2697HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns)
3026#endif 2698#endif
3027#ifdef CONFIG_BLOCK 2699#ifdef CONFIG_BLOCK
3028HANDLE_IOCTL(FDSETPRM32, fd_ioctl_trans)
3029HANDLE_IOCTL(FDDEFPRM32, fd_ioctl_trans)
3030HANDLE_IOCTL(FDGETPRM32, fd_ioctl_trans)
3031HANDLE_IOCTL(FDSETDRVPRM32, fd_ioctl_trans)
3032HANDLE_IOCTL(FDGETDRVPRM32, fd_ioctl_trans)
3033HANDLE_IOCTL(FDGETDRVSTAT32, fd_ioctl_trans)
3034HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans)
3035HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans)
3036HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans)
3037HANDLE_IOCTL(SG_IO,sg_ioctl_trans) 2700HANDLE_IOCTL(SG_IO,sg_ioctl_trans)
3038HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) 2701HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans)
3039#endif 2702#endif