873 /*
874 * Setup the multiplexer configuration for the two
875 * streams.
876 *
877 * We expect to be called on the stream that will
878 * become the log stream and be passed one data block
879 * with the minor number of the slave side of the
880 * primary stream.
881 */
882 int to;
883 int instance;
884 zfd_state_t *prim_zfds;
885
886 if (iocbp->ioc_count != TRANSPARENT ||
887 mp->b_cont == NULL) {
888 miocack(qp, mp, 0, EINVAL);
889 return;
890 }
891
892 /* Get the primary slave minor device number */
893 to = *(int *)mp->b_cont->b_rptr;
894 instance = ZFD_INSTANCE(to);
895
896 if ((prim_zfds = ddi_get_soft_state(zfd_soft_state,
897 instance)) == NULL) {
898 miocack(qp, mp, 0, EINVAL);
899 return;
900 }
901
902 /* Disallow changing primary/log once set. */
903 mutex_enter(&zfd_mux_lock);
904 if (zfds->zfd_muxt != ZFD_NO_MUX ||
905 prim_zfds->zfd_muxt != ZFD_NO_MUX) {
906 mutex_exit(&zfd_mux_lock);
907 miocack(qp, mp, 0, EINVAL);
908 return;
909 }
910
911 zfds->zfd_muxt = ZFD_LOG_STREAM;
912 zfds->zfd_inst_pri = prim_zfds;
925 * log stream. We don't use the primary stream since
926 * there can be other streams modules pushed onto that
927 * stream which would interfere with the ioctl.
928 */
929 int val;
930 zfd_state_t *prim_zfds;
931
932 if (iocbp->ioc_count != TRANSPARENT ||
933 mp->b_cont == NULL) {
934 miocack(qp, mp, 0, EINVAL);
935 return;
936 }
937
938 if (zfds->zfd_muxt != ZFD_LOG_STREAM) {
939 miocack(qp, mp, 0, EINVAL);
940 return;
941 }
942 prim_zfds = zfds->zfd_inst_pri;
943
944 /* Get the flow control setting */
945 val = *(int *)mp->b_cont->b_rptr;
946 if (val != 0 && val != 1) {
947 miocack(qp, mp, 0, EINVAL);
948 return;
949 }
950
951 prim_zfds->zfd_allow_flowcon = (boolean_t)val;
952 if (!prim_zfds->zfd_allow_flowcon)
953 prim_zfds->zfd_is_flowcon = B_FALSE;
954
955 DTRACE_PROBE1(zfd__mux__flowcon, void *, prim_zfds);
956 miocack(qp, mp, 0, 0);
957 return;
958 }
959 default:
960 break;
961 }
962 }
963
964 /* if on the write side, may need to tee */
|
873 /*
874 * Setup the multiplexer configuration for the two
875 * streams.
876 *
877 * We expect to be called on the stream that will
878 * become the log stream and be passed one data block
879 * with the minor number of the slave side of the
880 * primary stream.
881 */
882 int to;
883 int instance;
884 zfd_state_t *prim_zfds;
885
886 if (iocbp->ioc_count != TRANSPARENT ||
887 mp->b_cont == NULL) {
888 miocack(qp, mp, 0, EINVAL);
889 return;
890 }
891
892 /* Get the primary slave minor device number */
893 ASSERT(IS_P2ALIGNED(mp->b_cont->b_rptr, 4));
894 /* LINTED - b_rptr will always be aligned. */
895 to = *(int *)mp->b_cont->b_rptr;
896 instance = ZFD_INSTANCE(to);
897
898 if ((prim_zfds = ddi_get_soft_state(zfd_soft_state,
899 instance)) == NULL) {
900 miocack(qp, mp, 0, EINVAL);
901 return;
902 }
903
904 /* Disallow changing primary/log once set. */
905 mutex_enter(&zfd_mux_lock);
906 if (zfds->zfd_muxt != ZFD_NO_MUX ||
907 prim_zfds->zfd_muxt != ZFD_NO_MUX) {
908 mutex_exit(&zfd_mux_lock);
909 miocack(qp, mp, 0, EINVAL);
910 return;
911 }
912
913 zfds->zfd_muxt = ZFD_LOG_STREAM;
914 zfds->zfd_inst_pri = prim_zfds;
927 * log stream. We don't use the primary stream since
928 * there can be other streams modules pushed onto that
929 * stream which would interfere with the ioctl.
930 */
931 int val;
932 zfd_state_t *prim_zfds;
933
934 if (iocbp->ioc_count != TRANSPARENT ||
935 mp->b_cont == NULL) {
936 miocack(qp, mp, 0, EINVAL);
937 return;
938 }
939
940 if (zfds->zfd_muxt != ZFD_LOG_STREAM) {
941 miocack(qp, mp, 0, EINVAL);
942 return;
943 }
944 prim_zfds = zfds->zfd_inst_pri;
945
946 /* Get the flow control setting */
947 ASSERT(IS_P2ALIGNED(mp->b_cont->b_rptr, 4));
948 /* LINTED - b_rptr will always be aligned. */
949 val = *(int *)mp->b_cont->b_rptr;
950 if (val != 0 && val != 1) {
951 miocack(qp, mp, 0, EINVAL);
952 return;
953 }
954
955 prim_zfds->zfd_allow_flowcon = (boolean_t)val;
956 if (!prim_zfds->zfd_allow_flowcon)
957 prim_zfds->zfd_is_flowcon = B_FALSE;
958
959 DTRACE_PROBE1(zfd__mux__flowcon, void *, prim_zfds);
960 miocack(qp, mp, 0, 0);
961 return;
962 }
963 default:
964 break;
965 }
966 }
967
968 /* if on the write side, may need to tee */
|