Whamcloud - gitweb
LU-3025 hsm-llapi: bad type cast in llapi_hsm_copytool_fini()
authorjcl <jacques-charles.lafoucriere@cea.fr>
Tue, 12 Feb 2013 09:25:32 +0000 (10:25 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 27 Mar 2013 22:19:48 +0000 (18:19 -0400)
Correct a wrong type cast in llapi_hsm_copytool_fini()

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Change-Id: Iebe4a36178afdfad8b99140efd6b3afc8b9eb942
Reviewed-on: http://review.whamcloud.com/5837
Reviewed-by: John Hammond <johnlockwoodhammond@gmail.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustreapi.h
lustre/tests/copytool.c
lustre/utils/liblustreapi_hsm.c

index c500965..80954c8 100644 (file)
@@ -280,11 +280,13 @@ extern int llapi_changelog_clear(const char *mdtname, const char *idstr,
 /* HSM copytool interface.
  * priv is private state, managed internally by these functions
  */
-extern int llapi_hsm_copytool_start(void **priv, char *fsname, int flags,
+struct hsm_copytool_private;
+extern int llapi_hsm_copytool_start(struct hsm_copytool_private **priv,
+                                   char *fsname, int flags,
                                    int archive_count, int *archives);
-extern int llapi_hsm_copytool_fini(void **priv);
-extern int llapi_hsm_copytool_recv(void *priv, struct hsm_action_list **hal,
-                                  int *msgsize);
+extern int llapi_hsm_copytool_fini(struct hsm_copytool_private **priv);
+extern int llapi_hsm_copytool_recv(struct hsm_copytool_private *priv,
+                                  struct hsm_action_list **hal, int *msgsize);
 extern int llapi_hsm_copytool_free(struct hsm_action_list **hal);
 extern int llapi_hsm_copy_start(char *mnt, struct hsm_copy *copy,
                                const struct hsm_action_item *hai);
index 9f66168..b877e5b 100644 (file)
@@ -55,7 +55,7 @@
 #include <libcfs/libcfs.h>
 #include <lustre/lustreapi.h>
 
-void *ctdata;
+struct hsm_copytool_private *ctdata;
 
 void handler(int signal ) {
         psignal(signal, "exiting");
index 814ab2c..4d32588 100644 (file)
@@ -76,8 +76,8 @@ struct hsm_copytool_private {
  * \param archive_count
  * \param archives Which archive numbers this copytool is responsible for
  */
-int llapi_hsm_copytool_start(void **priv, char *fsname, int flags,
-                            int archive_count, int *archives)
+int llapi_hsm_copytool_start(struct hsm_copytool_private **priv, char *fsname,
+                            int flags, int archive_count, int *archives)
 {
        struct hsm_copytool_private     *ct;
        int                              rc;
@@ -152,11 +152,11 @@ out_err:
  * killed), the libcfs module will be referenced and unremovable,
  * even after Lustre services stop.
  */
-int llapi_hsm_copytool_fini(void **priv)
+int llapi_hsm_copytool_fini(struct hsm_copytool_private **priv)
 {
        struct hsm_copytool_private *ct;
 
-       ct = (struct hsm_copytool_private *)priv;
+       ct = *priv;
        if (!ct || (ct->magic != CT_PRIV_MAGIC))
                return -EINVAL;
 
@@ -174,21 +174,19 @@ int llapi_hsm_copytool_fini(void **priv)
 }
 
 /** Wait for the next hsm_action_list
- * \param priv Opaque private control structure
+ * \param ct Opaque private control structure
  * \param halh Action list handle, will be allocated here
  * \param msgsize Number of bytes in the message, will be set here
  * \return 0 valid message received; halh and msgsize are set
  *        <0 error code
  */
-int llapi_hsm_copytool_recv(void *priv, struct hsm_action_list **halh,
-                           int *msgsize)
+int llapi_hsm_copytool_recv(struct hsm_copytool_private *ct,
+                           struct hsm_action_list **halh, int *msgsize)
 {
-       struct hsm_copytool_private     *ct;
        struct kuc_hdr                  *kuch;
        struct hsm_action_list          *hal;
        int                              rc = 0;
 
-       ct = (struct hsm_copytool_private *)priv;
        if (!ct || (ct->magic != CT_PRIV_MAGIC))
                return -EINVAL;
        if (halh == NULL || msgsize == NULL)