termux-packages/packages/parted/03_minormajor.patch
Vladimir Serbinenko 24f7bf1c34 parted: New package (GNU parted)
This is a partition editor. While editing real disks
requires root, this is useful to create partitioned images for VMs.
2018-06-21 21:26:22 +02:00

32 lines
923 B
Diff

Add missing major() and minor().
Based on glibc version of this functions. Parted relies on those
functions and they're not provided by bionic libc.
diff -ur src-orig/libparted/arch/linux.c src/libparted/arch/linux.c
--- src-orig/libparted/arch/linux.c 2017-08-31 15:47:07.007674598 +0200
+++ src/libparted/arch/linux.c 2017-08-31 15:50:01.487860337 +0200
@@ -86,6 +86,22 @@
#define WR_MODE (O_WRONLY)
#define RW_MODE (O_RDWR)
+unsigned int major(dev_t __dev)
+{
+ unsigned int __major;
+ __major = ((__dev & (dev_t) 0x00000000000fff00u) >> 8);
+ __major |= ((__dev & (dev_t) 0xfffff00000000000u) >> 32);
+ return __major;
+}
+
+unsigned int minor(dev_t __dev)
+{
+ unsigned int __minor;
+ __minor = ((__dev & (dev_t) 0x00000000000000ffu) >> 0);
+ __minor |= ((__dev & (dev_t) 0x00000ffffff00000u) >> 12);
+ return __minor;
+}
+
struct hd_geometry {
unsigned char heads;
unsigned char sectors;