- Implemented major() and minor() methods.
authorMarius Tomaschewski <mt@suse.de>
Tue, 31 Jan 2006 14:46:49 +0000 (14:46 +0000)
committerMarius Tomaschewski <mt@suse.de>
Tue, 31 Jan 2006 14:46:49 +0000 (14:46 +0000)
zypp/PathInfo.cc
zypp/PathInfo.h

index 6e9df58..a3c68ca 100644 (file)
@@ -22,6 +22,8 @@
 #include "zypp/PathInfo.h"
 #include "zypp/Digest.h"
 
+#include <sys/types.h> // for ::minor, ::major macros
+
 using std::string;
 
 ///////////////////////////////////////////////////////////////////
@@ -227,6 +229,26 @@ namespace zypp
 
     /******************************************************************
      **
+     **        FUNCTION NAME : PathInfo::major
+     **        FUNCTION TYPE : unsigned int
+     */
+    unsigned int PathInfo::major() const
+    {
+      return isBlk() || isChr() ? ::major(statbuf_C.st_rdev) : 0;
+    }
+
+    /******************************************************************
+     **
+     **        FUNCTION NAME : PathInfo::major
+     **        FUNCTION TYPE : unsigned int
+     */
+    unsigned int PathInfo::minor() const
+    {
+      return isBlk() || isChr() ? ::major(statbuf_C.st_rdev) : 0;
+    }
+
+    /******************************************************************
+     **
      **        FUNCTION NAME : operator<<
      **        FUNCTION TYPE :  std::ostream &
     */
index 3a32eb5..a13d6f8 100644 (file)
@@ -349,9 +349,12 @@ namespace zypp
 
       /** \name Device and inode info. */
       //@{
+      ino_t  ino()     const { return isExist() ? statbuf_C.st_ino  : 0; }
       dev_t  dev()     const { return isExist() ? statbuf_C.st_dev  : 0; }
       dev_t  rdev()    const { return isExist() ? statbuf_C.st_rdev : 0; }
-      ino_t  ino()     const { return isExist() ? statbuf_C.st_ino  : 0; }
+
+      unsigned int major() const;
+      unsigned int minor() const;
       //@}
 
       /** \name Size info. */