Hello Hackers, I'm working on porting some kernel modules written for FreeBSD7 to FreeBSD8. Some of these modules contain the following code:
struct cdev *dev; ... int dev_num = minor(dev); This code doesn't compile on FreeBSD8. I found that in FreeBSD7 minor() was defined as follows: 515 int 516 minor(struct cdev *x) 517 { 518 if (x == NULL) 519 return NODEV; 520 return(x->si_drv0 & MAXMINOR); 521 } where MAXMINOR was defined as 236 #define MAXMINOR 0xffff00ffU But in FreeBSD8 minor() is defined as macro that takes integer as a parameter: 323 #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ I also found that FreeBSD8 provides dev2unit macro: 276 #define dev2unit(d) ((d)->si_drv0) It looks like dev2unit is exactly what I need to fix compilation issue. I changed the code of all modules as follows: - int dev_num = minor(dev); + int dev_num = minor(dev2unit(dev)); and now it compiles and works well. Is this the proper way of solving the problem? Thanks in advance! -- Sincerely yours, Dmitry V. Krivenok e-mail: krivenok.dmi...@gmail.com skype: krivenok_dmitry jabber: krivenok_dmi...@jabber.ru icq: 242-526-443 _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"