r2651: Added 'stat' command to smbclient to exercise the UNIX_FILE_BASIC
[nivanova/samba-autobuild/.git] / source3 / lib / system.c
index a0007ec83cd277fc966e14fcacbfc4c64ab3ef9e..b27ac5c00ad51cc31a2cc1075302ca13ea4960f4 100644 (file)
@@ -1580,3 +1580,29 @@ int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size
        return -1;
 #endif
 }
+
+/****************************************************************************
+ Return the major devicenumber for UNIX extensions.
+****************************************************************************/
+                                                                                                                
+uint32 unix_dev_major(SMB_DEV_T dev)
+{
+#if defined(HAVE_DEVICE_MAJOR_FN)
+        return (uint32)major(dev);
+#else
+        return (uint32)(dev >> 8);
+#endif
+}
+                                                                                                                
+/****************************************************************************
+ Return the minor devicenumber for UNIX extensions.
+****************************************************************************/
+                                                                                                                
+uint32 unix_dev_minor(SMB_DEV_T dev)
+{
+#if defined(HAVE_DEVICE_MINOR_FN)
+        return (uint32)minor(dev);
+#else
+        return (uint32)(dev & 0xff);
+#endif
+}