aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Roehrich <roehrich@sgi.com>2004-05-25 19:25:04 +0000
committerDean Roehrich <roehrich@sgi.com>2004-05-25 19:25:04 +0000
commit743ce64a0663b90fb73069b31f2ce0d943c44280 (patch)
tree56312f45f7a93adccc7586b3c29541f448a6f143
parentd2ca5214ee962f7ceae3c5de0859d813cb65a7ff (diff)
downloaddmapi-dev-743ce64a0663b90fb73069b31f2ce0d943c44280.tar.gz
prep dmapi library for new dmapi on 2.4 kernel
find new dmapi device on 2.4 kernel
-rw-r--r--libdm/dmapi_lib.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libdm/dmapi_lib.c b/libdm/dmapi_lib.c
index 64811f6..fde9671 100644
--- a/libdm/dmapi_lib.c
+++ b/libdm/dmapi_lib.c
@@ -50,16 +50,20 @@ static int dmapi_fd = -1;
int
dmi_init_service( char *versionstr )
{
+ /* On 2.6 kernels, /dev/dmapi is it */
dmapi_fd = open( "/dev/dmapi", O_RDWR );
- if( dmapi_fd == -1 ) {
- /* Try the old device location, used with 2.4 kernels,
- * which still offers a compatible interface.
- */
- dmapi_fd = open( "/proc/fs/xfs_dmapi_v2", O_RDWR );
- if( dmapi_fd == -1 )
- return -1;
- }
- return 0;
+ if (dmapi_fd != -1)
+ return 0;
+
+ /* On 2.4 kernels, fs/dmapi_v2 is newer than fs/xfs_dmapi_v2. */
+ dmapi_fd = open( "/proc/fs/dmapi_v2", O_RDWR );
+ if (dmapi_fd != -1)
+ return 0;
+ dmapi_fd = open( "/proc/fs/xfs_dmapi_v2", O_RDWR );
+ if (dmapi_fd != -1)
+ return 0;
+
+ return -1;
}