Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 92d2bfb5a363004a8a399eefe5c79f14 > files > 164

coccinelle-examples-1.0.0-0.rc4.2.fc16.i686.rpm

int p20_ioctl(int cmd, void*arg) {
  switch(cmd) {
  case VIDIOGCTUNER: {
    struct video_tuner v;
    if(copy_from_user(&v,arg)!=0)
      return -EFAULT;
    if(v.tuner)
      return -EINVAL;
    v.rangelow = 87*16000;
    v.rangehigh = 108 * 16000;
    if(copy_to_user(arg,&v))
      return -EFAULT;
    return 0;
  }
  case AGCTUNER: {
    struct video_tuner v;     
    if(copy_from_user(&v,arg))
      { 
        return -EFAULT;
      }
    if(v.tuner)
      return -EINVAL;
    v.rangelow = 0;
    v.rangehigh = 0;
    if(copy_to_user(arg,&v))
      return -EFAULT;
    return 0;
  }
  }
}