From: Michael Vrable Date: Wed, 18 Jul 2007 20:06:03 +0000 (-0700) Subject: Extract major/minor components of device numbers. X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=commitdiff_plain;h=762821c656f018b9f03d131cdaee08b011d0c399 Extract major/minor components of device numbers. I hope these are the right macros and include files to use... --- diff --git a/scandir.cc b/scandir.cc index 89bdaab..5b3caaa 100644 --- a/scandir.cc +++ b/scandir.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -351,7 +352,8 @@ void scanfile(const string& path, bool include) case S_IFBLK: case S_IFCHR: inode_type = ((stat_buf.st_mode & S_IFMT) == S_IFBLK) ? 'b' : 'c'; - file_info["device"] = encode_int(stat_buf.st_rdev); + file_info["device"] = encode_int(major(stat_buf.st_rdev)) + + "/" + encode_int(minor(stat_buf.st_rdev)); break; case S_IFLNK: inode_type = 'l';