diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-08-13 14:44:13 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-08-13 14:44:13 +0000 |
commit | 7636612d506bbb20c8bfc0e1f15eb99fa5884a11 (patch) | |
tree | 0631131d7fb89f90a298d13b79f50d8d91fcbe3c /sys | |
parent | b3d7d91f32f19576a1068e8d9f48e8ec8925c484 (diff) | |
download | src-test2-7636612d506bbb20c8bfc0e1f15eb99fa5884a11.tar.gz src-test2-7636612d506bbb20c8bfc0e1f15eb99fa5884a11.zip |
Notes
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/linux/linux.h | 5 | ||||
-rw-r--r-- | sys/compat/linux/linux_ioctl.c | 66 | ||||
-rw-r--r-- | sys/i386/linux/linux.h | 5 | ||||
-rw-r--r-- | sys/i386/linux/linux_ioctl.c | 66 |
4 files changed, 138 insertions, 4 deletions
diff --git a/sys/alpha/linux/linux.h b/sys/alpha/linux/linux.h index 405b6e04a7ec..03f9e167cd69 100644 --- a/sys/alpha/linux/linux.h +++ b/sys/alpha/linux/linux.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux.h,v 1.30 1999/07/17 08:24:57 marcel Exp $ + * $Id: linux.h,v 1.31 1999/08/11 13:34:29 marcel Exp $ */ #ifndef _I386_LINUX_LINUX_H_ @@ -706,4 +706,7 @@ struct linux_ifreq #define LINUX_CDROMCLOSETRAY 0x5319 #define LINUX_CDROMLOADFROMSLOT 0x531a +#define LINUX_CDROM_LBA 0x01 +#define LINUX_CDROM_MSF 0x02 + #endif /* !_I386_LINUX_LINUX_H_ */ diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 1c79c6c0f5f9..da1abdcb5714 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_ioctl.c,v 1.35 1999/07/08 16:15:19 marcel Exp $ + * $Id: linux_ioctl.c,v 1.36 1999/07/17 08:24:57 marcel Exp $ */ #include <sys/param.h> @@ -49,6 +49,7 @@ #include <i386/linux/linux.h> #include <i386/linux/linux_proto.h> +#include <i386/linux/linux_util.h> #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) @@ -484,6 +485,18 @@ struct linux_cdrom_tocentry u_char cdte_datamode; }; +struct linux_cdrom_subchnl +{ + u_char cdsc_format; + u_char cdsc_audiostatus; + u_char cdsc_adr:4; + u_char cdsc_ctrl:4; + u_char cdsc_trk; + u_char cdsc_ind; + union linux_cdrom_addr cdsc_absaddr; + union linux_cdrom_addr cdsc_reladdr; +}; + #if 0 static void linux_to_bsd_msf_lba(u_char address_format, @@ -512,6 +525,20 @@ bsd_to_linux_msf_lba(u_char address_format, } } +static void +set_linux_cdrom_addr(union linux_cdrom_addr *addr, int format, int lba) +{ + if (format == LINUX_CDROM_MSF) { + addr->msf.frame = lba % 75; + lba /= 75; + lba += 2; + addr->msf.second = lba % 60; + addr->msf.minute = lba / 60; + } + else + addr->lba = lba; +} + static unsigned dirbits[4] = { IOC_VOID, IOC_OUT, IOC_IN, IOC_INOUT }; #define SETDIR(c) (((c) & ~IOC_DIRMASK) | dirbits[args->cmd >> 30]) @@ -1184,6 +1211,43 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) return error; } + case LINUX_CDROMSUBCHNL: { + caddr_t sg; + struct linux_cdrom_subchnl sc; + struct ioc_read_subchannel bsdsc; + struct cd_sub_channel_info *bsdinfo; + + sg = stackgap_init(); + bsdinfo = (struct cd_sub_channel_info*)stackgap_alloc(&sg, + sizeof(struct cd_sub_channel_info)); + + bsdsc.address_format = CD_LBA_FORMAT; + bsdsc.data_format = CD_CURRENT_POSITION; + bsdsc.data_len = sizeof(struct cd_sub_channel_info); + bsdsc.data = bsdinfo; + error = (*func)(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, p); + if (error) + return error; + + error = copyin((caddr_t)args->arg, (caddr_t)&sc, + sizeof(struct linux_cdrom_subchnl)); + if (error) + return error; + + sc.cdsc_audiostatus = bsdinfo->header.audio_status; + sc.cdsc_adr = bsdinfo->what.position.addr_type; + sc.cdsc_ctrl = bsdinfo->what.position.control; + sc.cdsc_trk = bsdinfo->what.position.track_number; + sc.cdsc_ind = bsdinfo->what.position.index_number; + set_linux_cdrom_addr(&sc.cdsc_absaddr, sc.cdsc_format, + bsdinfo->what.position.absaddr.lba); + set_linux_cdrom_addr(&sc.cdsc_reladdr, sc.cdsc_format, + bsdinfo->what.position.reladdr.lba); + error = copyout((caddr_t)&sc, (caddr_t)args->arg, + sizeof(struct linux_cdrom_subchnl)); + return error; + } + } uprintf("LINUX: 'ioctl' fd=%d, typ=0x%x(%c), num=0x%x not implemented\n", diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 405b6e04a7ec..03f9e167cd69 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux.h,v 1.30 1999/07/17 08:24:57 marcel Exp $ + * $Id: linux.h,v 1.31 1999/08/11 13:34:29 marcel Exp $ */ #ifndef _I386_LINUX_LINUX_H_ @@ -706,4 +706,7 @@ struct linux_ifreq #define LINUX_CDROMCLOSETRAY 0x5319 #define LINUX_CDROMLOADFROMSLOT 0x531a +#define LINUX_CDROM_LBA 0x01 +#define LINUX_CDROM_MSF 0x02 + #endif /* !_I386_LINUX_LINUX_H_ */ diff --git a/sys/i386/linux/linux_ioctl.c b/sys/i386/linux/linux_ioctl.c index 1c79c6c0f5f9..da1abdcb5714 100644 --- a/sys/i386/linux/linux_ioctl.c +++ b/sys/i386/linux/linux_ioctl.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_ioctl.c,v 1.35 1999/07/08 16:15:19 marcel Exp $ + * $Id: linux_ioctl.c,v 1.36 1999/07/17 08:24:57 marcel Exp $ */ #include <sys/param.h> @@ -49,6 +49,7 @@ #include <i386/linux/linux.h> #include <i386/linux/linux_proto.h> +#include <i386/linux/linux_util.h> #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) @@ -484,6 +485,18 @@ struct linux_cdrom_tocentry u_char cdte_datamode; }; +struct linux_cdrom_subchnl +{ + u_char cdsc_format; + u_char cdsc_audiostatus; + u_char cdsc_adr:4; + u_char cdsc_ctrl:4; + u_char cdsc_trk; + u_char cdsc_ind; + union linux_cdrom_addr cdsc_absaddr; + union linux_cdrom_addr cdsc_reladdr; +}; + #if 0 static void linux_to_bsd_msf_lba(u_char address_format, @@ -512,6 +525,20 @@ bsd_to_linux_msf_lba(u_char address_format, } } +static void +set_linux_cdrom_addr(union linux_cdrom_addr *addr, int format, int lba) +{ + if (format == LINUX_CDROM_MSF) { + addr->msf.frame = lba % 75; + lba /= 75; + lba += 2; + addr->msf.second = lba % 60; + addr->msf.minute = lba / 60; + } + else + addr->lba = lba; +} + static unsigned dirbits[4] = { IOC_VOID, IOC_OUT, IOC_IN, IOC_INOUT }; #define SETDIR(c) (((c) & ~IOC_DIRMASK) | dirbits[args->cmd >> 30]) @@ -1184,6 +1211,43 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) return error; } + case LINUX_CDROMSUBCHNL: { + caddr_t sg; + struct linux_cdrom_subchnl sc; + struct ioc_read_subchannel bsdsc; + struct cd_sub_channel_info *bsdinfo; + + sg = stackgap_init(); + bsdinfo = (struct cd_sub_channel_info*)stackgap_alloc(&sg, + sizeof(struct cd_sub_channel_info)); + + bsdsc.address_format = CD_LBA_FORMAT; + bsdsc.data_format = CD_CURRENT_POSITION; + bsdsc.data_len = sizeof(struct cd_sub_channel_info); + bsdsc.data = bsdinfo; + error = (*func)(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, p); + if (error) + return error; + + error = copyin((caddr_t)args->arg, (caddr_t)&sc, + sizeof(struct linux_cdrom_subchnl)); + if (error) + return error; + + sc.cdsc_audiostatus = bsdinfo->header.audio_status; + sc.cdsc_adr = bsdinfo->what.position.addr_type; + sc.cdsc_ctrl = bsdinfo->what.position.control; + sc.cdsc_trk = bsdinfo->what.position.track_number; + sc.cdsc_ind = bsdinfo->what.position.index_number; + set_linux_cdrom_addr(&sc.cdsc_absaddr, sc.cdsc_format, + bsdinfo->what.position.absaddr.lba); + set_linux_cdrom_addr(&sc.cdsc_reladdr, sc.cdsc_format, + bsdinfo->what.position.reladdr.lba); + error = copyout((caddr_t)&sc, (caddr_t)args->arg, + sizeof(struct linux_cdrom_subchnl)); + return error; + } + } uprintf("LINUX: 'ioctl' fd=%d, typ=0x%x(%c), num=0x%x not implemented\n", |