2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

util: use glibc macros to generate device numbers in the dev_t format

Our version of macroses are worng.

Our macros:
#define MINOR(dev)           ((dev) & 0xff)

Glibc function:
return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);

Reported-by: Amey Deshpande <ameyd@google.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2014-05-05 14:26:00 +04:00
committed by Pavel Emelyanov
parent 74a2cce189
commit 3a9c6a3d37
3 changed files with 3 additions and 9 deletions

View File

@@ -211,11 +211,8 @@ static inline dev_t kdev_to_odev(u32 kdev)
*/
unsigned major = kdev_major(kdev);
unsigned minor = kdev_minor(kdev);
#if BITS_PER_LONG == 32
return (major << 8) | minor;
#else
return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12);
#endif
return makedev(major, minor);
}
extern int copy_file(int fd_in, int fd_out, size_t bytes);