[IBAL] Add versioning of the IOCTL interface.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 15 May 2006 21:36:18 +0000 (21:36 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 15 May 2006 21:36:18 +0000 (21:36 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@350 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_dev.h
core/al/kernel/al_dev.c
core/al/user/ual_mgr.c

index 4d27bd3..ad9f6dd 100644 (file)
 #define AL_DEVICE_NAME L"\\Device\\ibal"\r
 #define        ALDEV_KEY               (0x3B)  /* Matches FILE_DEVICE_INFINIBAND from wdm.h */\r
 \r
-/*\r
- * These are to be used as the offset parameter in mmap() syscall\r
- * ALDEV_ALLOCATE_AND_MAP will allocate a page and return the\r
- * mapped address.\r
- *\r
- *     The usage of mmap() for AL device is TBD\r
- */\r
-\r
-#define ALDEV_ALLOCATE_AND_MAP         0\r
-#define ALDEV_MAP                                      4096\r
-\r
+#define AL_IOCTL_VERSION                       (2)\r
 \r
 #ifdef CL_KERNEL\r
 \r
index f79702b..a6a4136 100644 (file)
@@ -138,20 +138,31 @@ al_dev_open(
        ib_api_status_t                 status;\r
        cl_status_t                             cl_status;\r
        IO_STACK_LOCATION               *p_io_stack;\r
+       ULONG                                   *p_ver;\r
 \r
        CL_ENTER( AL_DBG_DEV, g_al_dbg_lvl );\r
 \r
        p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
 \r
+       p_ver = cl_ioctl_in_buf( h_ioctl );\r
+\r
        if( p_io_stack->FileObject->FsContext ||\r
-               p_io_stack->Parameters.DeviceIoControl.InputBufferLength ||\r
-               p_io_stack->Parameters.DeviceIoControl.OutputBufferLength )\r
+               cl_ioctl_in_size( h_ioctl ) != sizeof(ULONG) ||\r
+               !p_ver ||\r
+               cl_ioctl_out_size( h_ioctl ) )\r
        {\r
                AL_TRACE_EXIT( AL_DBG_ERROR,\r
                        ("context already exists or bad parameters.\n") );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
+       if( *p_ver != AL_IOCTL_VERSION )\r
+       {\r
+               AL_TRACE_EXIT( AL_DBG_ERROR,\r
+                       ("Unsupported client version: %d\n", *p_ver) );\r
+               return CL_INVALID_PARAMETER;\r
+       }\r
+\r
        /* Allocate the client's context structure. */\r
        p_context = (al_dev_open_context_t*)\r
                cl_zalloc( sizeof(al_dev_open_context_t) );\r
index ee09bd6..87f2993 100644 (file)
@@ -248,6 +248,7 @@ create_al_mgr()
        ib_api_status_t                 ib_status;\r
        cl_status_t                             cl_status;\r
        uintn_t                                 bytes_ret;\r
+       ULONG                                   ver;\r
 \r
        CL_ENTER( AL_DBG_MGR, g_al_dbg_lvl );\r
 \r
@@ -261,7 +262,10 @@ create_al_mgr()
        if( g_al_device == INVALID_HANDLE_VALUE )\r
                return IB_ERROR;\r
 \r
-       cl_status = do_al_dev_ioctl( UAL_BIND, NULL, 0, NULL, 0, &bytes_ret );\r
+       ver = AL_IOCTL_VERSION;\r
+\r
+       cl_status =\r
+               do_al_dev_ioctl( UAL_BIND, &ver, sizeof(ver), NULL, 0, &bytes_ret );\r
        if( cl_status != CL_SUCCESS )\r
                return IB_ERROR;\r
 \r