mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 22:35:33 +00:00
sockets: Decode kernel dev_t into stat's one
Unix diag and stat report dev_t-s in different formats. Cast one to another when comparing in unix dumping. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
02c8793c6e
commit
82a8a8ff95
@@ -264,4 +264,25 @@ FILE *fopen_proc(int pid_dir_fd, char *fmt, ...);
|
||||
#define pr_img_head(type, ...) pr_info("\n"#type __VA_ARGS__ "\n----------------\n")
|
||||
#define pr_img_tail(type) pr_info("----------------\n")
|
||||
|
||||
#define KDEV_MINORBITS 20
|
||||
#define KDEV_MINORMASK ((1UL << KDEV_MINORBITS) - 1)
|
||||
|
||||
static inline u32 kdev_major(u32 kdev)
|
||||
{
|
||||
return kdev >> KDEV_MINORBITS;
|
||||
}
|
||||
|
||||
static inline u32 kdev_minor(u32 kdev)
|
||||
{
|
||||
return kdev & KDEV_MINORMASK;
|
||||
}
|
||||
|
||||
static inline dev_t kdev_to_odev(u32 kdev)
|
||||
{
|
||||
/*
|
||||
* New kernels envcode devices in a new form
|
||||
*/
|
||||
return (kdev_major(kdev) << 8) | kdev_minor(kdev);
|
||||
}
|
||||
|
||||
#endif /* UTIL_H_ */
|
||||
|
Reference in New Issue
Block a user