mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 07:45:17 +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:
committed by
Pavel Emelyanov
parent
74a2cce189
commit
3a9c6a3d37
@@ -13,9 +13,6 @@
|
||||
#define SIGMAX 64
|
||||
#define SIGMAX_OLD 31
|
||||
|
||||
#define MAJOR(dev) ((dev)>>8)
|
||||
#define MINOR(dev) ((dev) & 0xff)
|
||||
|
||||
typedef void rt_signalfn_t(int, siginfo_t *, void *);
|
||||
typedef rt_signalfn_t *rt_sighandler_t;
|
||||
|
||||
|
@@ -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);
|
||||
|
2
mount.c
2
mount.c
@@ -158,7 +158,7 @@ dev_t phys_stat_resolve_dev(struct mount_info *tree,
|
||||
* obtained from mountinfo (ie subvolume0).
|
||||
*/
|
||||
return strcmp(m->fstype->name, "btrfs") ?
|
||||
MKKDEV(MAJOR(st_dev), MINOR(st_dev)) : m->s_dev;
|
||||
MKKDEV(major(st_dev), minor(st_dev)) : m->s_dev;
|
||||
}
|
||||
|
||||
bool phys_stat_dev_match(struct mount_info *tree, dev_t st_dev,
|
||||
|
Reference in New Issue
Block a user