Commit 82a8a8ff authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

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: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 02c8793c
...@@ -264,4 +264,25 @@ FILE *fopen_proc(int pid_dir_fd, char *fmt, ...); ...@@ -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_head(type, ...) pr_info("\n"#type __VA_ARGS__ "\n----------------\n")
#define pr_img_tail(type) pr_info("----------------\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_ */ #endif /* UTIL_H_ */
...@@ -466,7 +466,10 @@ static int unix_collect_one(struct unix_diag_msg *m, struct rtattr **tb) ...@@ -466,7 +466,10 @@ static int unix_collect_one(struct unix_diag_msg *m, struct rtattr **tb)
} }
if ((st.st_ino != uv->udiag_vfs_ino) || if ((st.st_ino != uv->udiag_vfs_ino) ||
(st.st_dev != uv->udiag_vfs_dev)) { (st.st_dev != kdev_to_odev(uv->udiag_vfs_dev))) {
pr_info("unix: Dropping path for unlinked bound sk %x.%x real %x.%x\n",
(int)st.st_dev, (int)st.st_ino,
(int)uv->udiag_vfs_dev, (int)uv->udiag_vfs_ino);
/* /*
* When a listen socket is bound to * When a listen socket is bound to
* unlinked file, we just drop his name, * unlinked file, we just drop his name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment