Print this page
5083 avoid undefined order of operations in assignments


 842 static intptr_t qmerge_sync2async = 4;
 843 static int      qmerge2wayscan = 1;
 844 static int      qmerge1pri = 0;
 845 static int      qmerge_merge = 0;
 846 
 847 /*
 848  *      Local static data
 849  */
 850 struct que_obj *
 851 qmerge_create()
 852 {
 853         struct que_data *qfp;
 854         struct que_obj *queobjp;
 855 
 856         queobjp = kmem_zalloc((sizeof (*queobjp) + sizeof (*qfp)), KM_NOSLEEP);
 857         if (!queobjp)
 858                 return (NULL);
 859 
 860         queobjp->que_ops = &qmerge_ops;
 861         qfp = (struct que_data *)(queobjp+1);
 862         qfp->q_tab.hd_private = qfp->q_tab.hd_private = 0;
 863         qfp->q_tab.hd_sync_next = qfp->q_tab.hd_async_next = NULL;
 864         qfp->q_tab.hd_cnt = (void *)qmerge_sync2async;
 865         queobjp->que_data = (opaque_t)qfp;
 866 
 867         return ((opaque_t)queobjp);
 868 }
 869 
 870 static int
 871 qmerge_free(struct que_obj *queobjp)
 872 {
 873         struct  que_data *qfp;
 874 
 875         qfp = (struct que_data *)queobjp->que_data;
 876         mutex_destroy(&qfp->q_mutex);
 877         kmem_free(queobjp, (sizeof (*queobjp) + sizeof (*qfp)));
 878         return (0);
 879 }
 880 
 881 static int
 882 qmerge_can_merge(bp1, bp2)




 842 static intptr_t qmerge_sync2async = 4;
 843 static int      qmerge2wayscan = 1;
 844 static int      qmerge1pri = 0;
 845 static int      qmerge_merge = 0;
 846 
 847 /*
 848  *      Local static data
 849  */
 850 struct que_obj *
 851 qmerge_create()
 852 {
 853         struct que_data *qfp;
 854         struct que_obj *queobjp;
 855 
 856         queobjp = kmem_zalloc((sizeof (*queobjp) + sizeof (*qfp)), KM_NOSLEEP);
 857         if (!queobjp)
 858                 return (NULL);
 859 
 860         queobjp->que_ops = &qmerge_ops;
 861         qfp = (struct que_data *)(queobjp+1);
 862         qfp->q_tab.hd_private = 0;
 863         qfp->q_tab.hd_sync_next = qfp->q_tab.hd_async_next = NULL;
 864         qfp->q_tab.hd_cnt = (void *)qmerge_sync2async;
 865         queobjp->que_data = (opaque_t)qfp;
 866 
 867         return ((opaque_t)queobjp);
 868 }
 869 
 870 static int
 871 qmerge_free(struct que_obj *queobjp)
 872 {
 873         struct  que_data *qfp;
 874 
 875         qfp = (struct que_data *)queobjp->que_data;
 876         mutex_destroy(&qfp->q_mutex);
 877         kmem_free(queobjp, (sizeof (*queobjp) + sizeof (*qfp)));
 878         return (0);
 879 }
 880 
 881 static int
 882 qmerge_can_merge(bp1, bp2)