svn commit: r207569 - head/sys/compat/linux

Alexander Leidinger netchild at FreeBSD.org
Mon May 3 14:19:59 UTC 2010


Author: netchild
Date: Mon May  3 14:19:58 2010
New Revision: 207569
URL: http://svn.freebsd.org/changeset/base/207569

Log:
  - #ifdef out the cliplist part, skype seems like using an uninitialized
    variable and can cause problems, without the cliplist handling it works
    without problems
  - improve the cliplist error handling
  - fix VIDIOCGTUNER and VIDIOCSMICROCODE (still no hardware available to test)
  
  Submitted by:	J.R. Oldroyd <jr at opal.com>
  X-MFC after:	soon (together with all the v4l stuff)

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Mon May  3 12:43:17 2010	(r207568)
+++ head/sys/compat/linux/linux_ioctl.c	Mon May  3 14:19:58 2010	(r207569)
@@ -2628,6 +2628,7 @@ bsd_to_linux_v4l_tuner(struct video_tune
 	return (0);
 }
 
+#ifdef COMPAT_LINUX_V4L_CLIPLIST
 static int
 linux_to_bsd_v4l_clip(struct l_video_clip *lvc, struct video_clip *vc)
 {
@@ -2638,6 +2639,7 @@ linux_to_bsd_v4l_clip(struct l_video_cli
 	vc->next = PTRIN(lvc->next);	/* possible pointer size conversion */
 	return (0);
 }
+#endif
 
 static int
 linux_to_bsd_v4l_window(struct l_video_window *lvw, struct video_window *vw)
@@ -2698,6 +2700,7 @@ linux_to_bsd_v4l_code(struct l_video_cod
 	return (0);
 }
 
+#ifdef COMPAT_LINUX_V4L_CLIPLIST
 static int
 linux_v4l_clip_copy(void *lvc, struct video_clip **ppvc)
 {
@@ -2772,15 +2775,18 @@ linux_v4l_cliplist_copy(struct l_video_w
 		 *	example of cliplist use.
 		 */
 		plvc = PTRIN(lvw->clips);
+		vw->clips = NULL;
 		ppvc = &(vw->clips);
 		while (clipcount-- > 0) {
-			if (plvc == 0)
+			if (plvc == 0) {
 				error = EFAULT;
-			if (!error)
-				error = linux_v4l_clip_copy(plvc, ppvc);
-			if (error) {
-				linux_v4l_cliplist_free(vw);
 				break;
+			} else {
+				error = linux_v4l_clip_copy(plvc, ppvc);
+				if (error) {
+					linux_v4l_cliplist_free(vw);
+					break;
+				}
 			}
 			ppvc = &((*ppvc)->next);
 		        plvc = PTRIN(((struct l_video_clip *) plvc)->next);
@@ -2795,6 +2801,7 @@ linux_v4l_cliplist_copy(struct l_video_w
 	}
 	return (error);
 }
+#endif
 
 static int
 linux_ioctl_v4l(struct thread *td, struct linux_ioctl_args *args)
@@ -2818,6 +2825,12 @@ linux_ioctl_v4l(struct thread *td, struc
 	case LINUX_VIDIOCGTUNER:
 		if ((error = fget(td, args->fd, &fp)) != 0)
 			return (error);
+		error = copyin((void *) args->arg, &l_vtun, sizeof(l_vtun));
+		if (error) {
+			fdrop(fp, td);
+			return (error);
+		}
+		linux_to_bsd_v4l_tuner(&l_vtun, &vtun);
 		error = fo_ioctl(fp, VIDIOCGTUNER, &vtun, td->td_ucred, td);
 		if (!error) {
 			bsd_to_linux_v4l_tuner(&vtun, &l_vtun);
@@ -2836,7 +2849,7 @@ linux_ioctl_v4l(struct thread *td, struc
 			return (error);
 		}
 		linux_to_bsd_v4l_tuner(&l_vtun, &vtun);
-		error = fo_ioctl(fp, VIDIOCSMICROCODE, &vtun, td->td_ucred, td);
+		error = fo_ioctl(fp, VIDIOCSTUNER, &vtun, td->td_ucred, td);
 		fdrop(fp, td);
 		return (error);
 
@@ -2865,14 +2878,18 @@ linux_ioctl_v4l(struct thread *td, struc
 			return (error);
 		}
 		linux_to_bsd_v4l_window(&l_vwin, &vwin);
+#ifdef COMPAT_LINUX_V4L_CLIPLIST
 		error = linux_v4l_cliplist_copy(&l_vwin, &vwin);
 		if (error) {
 			fdrop(fp, td);
 			return (error);
 		}
+#endif
 		error = fo_ioctl(fp, VIDIOCSWIN, &vwin, td->td_ucred, td);
 		fdrop(fp, td);
+#ifdef COMPAT_LINUX_V4L_CLIPLIST
 		linux_v4l_cliplist_free(&vwin);
+#endif
 		return (error);
 
 	case LINUX_VIDIOCGFBUF:
@@ -2924,7 +2941,7 @@ linux_ioctl_v4l(struct thread *td, struc
 			return (error);
 		}
 		linux_to_bsd_v4l_code(&l_vcode, &vcode);
-		error = fo_ioctl(fp, VIDIOCSTUNER, &vcode, td->td_ucred, td);
+		error = fo_ioctl(fp, VIDIOCSMICROCODE, &vcode, td->td_ucred, td);
 		fdrop(fp, td);
 		return (error);
 


More information about the svn-src-head mailing list