Changes by: szaka
Update of /cvsroot/linux-ntfs/linux-ntfs/libntfs
In directory usw-pr-cvs1:/tmp/cvs-serv31498/libntfs
Modified Files:
volume.c
Log Message:
NTFS_V* version macros and ntfs_is_version_supported() added.
Modified ntfsfix and ntfsresize to use them.
Index: volume.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/libntfs/volume.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -U2 -r1.50 -r1.51
--- volume.c 11 Jul 2002 23:44:13 -0000 1.50
+++ volume.c 12 Jul 2002 07:10:44 -0000 1.51
@@ -875,2 +875,42 @@
}
+/**
+ * ntfs_version_supported - check if NTFS version is supported.
+ * @vol: ntfs volume whose version we're interested in.
+ *
+ * The function checks if the NTFS volume version is known or not.
+ * Version 1.1 and 1.2 are used by Windows NT4.
+ * Version 2.x is used by Windows 2000 Beta's
+ * Version 3.0 is used by Windows 2000.
+ * Version 3.1 is used by Windows XP and .NET.
+ *
+ * Return 0 if NTFS version is supported otherwise -1 with errno set.
+ *
+ * The following error codes are defined:
+ * ENOTSUP Unknown NTFS versions
+ * EINVAL Invalid argument
+ */
+int ntfs_is_version_supported(ntfs_volume *vol)
+{
+ u8 major, minor;
+
+ if (!vol) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ major = vol->major_ver;
+ minor = vol->minor_ver;
+
+ if (NTFS_V1_1(major, minor) || NTFS_V1_2(major, minor))
+ return 0;
+
+ if (NTFS_V2_X(major, minor))
+ return 0;
+
+ if (NTFS_V3_0(major, minor) || NTFS_V3_1(major, minor))
+ return 0;
+
+ errno = ENOTSUP;
+ return -1;
+}
|