# # # patch "lib/device/dev-cache.c" # from [7acc3c8cbfe7763b4350e14012183cd6c017b00b] # to [8cb251e4032bcd39994db215440623faf2ad5224] # ============================================================ --- lib/device/dev-cache.c 7acc3c8cbfe7763b4350e14012183cd6c017b00b +++ lib/device/dev-cache.c 8cb251e4032bcd39994db215440623faf2ad5224 @@ -25,6 +25,10 @@ #include #include +#ifdef __NetBSD__ +#include "netbsd.h" +#endif + struct dev_iter { struct btree_iter *current; struct dev_filter *filter; @@ -421,14 +425,26 @@ static int _insert(const char *path, int if (rec) r = _insert_dir(path); - } else { /* add a device */ - if (!S_ISBLK(info.st_mode)) { - log_debug("%s: Not a block device", path); - return 0; + } else { + /* add a device */ +#ifdef __NetBSD__ + /* + * In NetBSD we have two different types of devices + * raw and block. I can insert only existing + * raw and block device. + */ + if (nbsd_check_dev(MAJOR(info.st_rdev),path) < 0) { + log_debug("%s: Not a block device.", path); + return_0; } - if (!_insert_dev(path, info.st_rdev)) +#else + if (!S_ISBLK(info.st_mode)) + log_debug("%s: Not a block device", path); +#endif + if (!_insert_dev(path, info.st_rdev)) { return_0; + } r = 1; }