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