blkpg.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI__LINUX_BLKPG_H
  3. #define _UAPI__LINUX_BLKPG_H
  4. /*
  5. * Partition table and disk geometry handling
  6. *
  7. * A single ioctl with lots of subfunctions:
  8. *
  9. * Device number stuff:
  10. * get_whole_disk() (given the device number of a partition,
  11. * find the device number of the encompassing disk)
  12. * get_all_partitions() (given the device number of a disk, return the
  13. * device numbers of all its known partitions)
  14. *
  15. * Partition stuff:
  16. * add_partition()
  17. * delete_partition()
  18. * test_partition_in_use() (also for test_disk_in_use)
  19. *
  20. * Geometry stuff:
  21. * get_geometry()
  22. * set_geometry()
  23. * get_bios_drivedata()
  24. *
  25. * For today, only the partition stuff - aeb, 990515
  26. */
  27. #include <linux/compiler.h>
  28. #include <linux/ioctl.h>
  29. #define BLKPG _IO(0x12,105)
  30. /* The argument structure */
  31. struct blkpg_ioctl_arg {
  32. int op;
  33. int flags;
  34. int datalen;
  35. void __user *data;
  36. };
  37. /* The subfunctions (for the op field) */
  38. #define BLKPG_ADD_PARTITION 1
  39. #define BLKPG_DEL_PARTITION 2
  40. #define BLKPG_RESIZE_PARTITION 3
  41. /* Sizes of name fields. Unused at present. */
  42. #define BLKPG_DEVNAMELTH 64
  43. #define BLKPG_VOLNAMELTH 64
  44. /* The data structure for ADD_PARTITION and DEL_PARTITION */
  45. struct blkpg_partition {
  46. long long start; /* starting offset in bytes */
  47. long long length; /* length in bytes */
  48. int pno; /* partition number */
  49. char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
  50. to be used in kernel messages */
  51. char volname[BLKPG_VOLNAMELTH]; /* volume label */
  52. };
  53. #endif /* _UAPI__LINUX_BLKPG_H */