mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-25 11:04:35 +00:00
test: rtc don't use hard coded major value
The /dev/rtc device major value may change depending on the architecture, and kernel release. To ensure the test rtc is working all the time, we no longer belong on hard coded major value but peek it from /dev/rtc itself. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
1ad78171ad
commit
da1be409cc
1 changed files with 9 additions and 7 deletions
|
|
@ -23,19 +23,21 @@ int cr_plugin_dump_file(int fd, int id)
|
|||
unsigned char buf[4096];
|
||||
int img_fd, ret, len;
|
||||
unsigned long irqp;
|
||||
struct stat st;
|
||||
struct stat st, st_rtc;
|
||||
|
||||
if (fstat(fd, &st) == -1) {
|
||||
pr_perror("fstat");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(__PPC64__)
|
||||
#define RTC_DEV_MAJOR 253
|
||||
#else
|
||||
#define RTC_DEV_MAJOR 254
|
||||
#endif
|
||||
if (major(st.st_rdev) != RTC_DEV_MAJOR || minor(st.st_rdev) != 0)
|
||||
ret = stat("/dev/rtc", &st_rtc);
|
||||
if (ret == -1) {
|
||||
pr_perror("fstat");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (major(st.st_rdev) != major(st_rtc.st_rdev) ||
|
||||
minor(st.st_rdev) != 0)
|
||||
return -ENOTSUP;
|
||||
|
||||
if (ioctl(fd, RTC_IRQP_READ, &irqp) == -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue