--- ./arch/um/drivers/hostaudio_kern.c.fix 2004-01-17 18:41:10.000000000 +0100 +++ ./arch/um/drivers/hostaudio_kern.c 2004-01-20 16:28:31.000000000 +0100 @@ -13,7 +13,18 @@ #include "asm/uaccess.h" #include "kern_util.h" #include "init.h" -#include "hostaudio.h" +#include "os.h" + +struct hostaudio_state { + int fd; +}; + +struct hostmixer_state { + int fd; +}; + +#define HOSTAUDIO_DEV_DSP "/dev/sound/dsp" +#define HOSTAUDIO_DEV_MIXER "/dev/sound/mixer" /* Only changed from linux_main at boot time */ char *dsp = HOSTAUDIO_DEV_DSP; @@ -56,6 +67,66 @@ /* /dev/dsp file operations */ +static inline ssize_t hostaudio_read_user(struct hostaudio_state *state, char *buffer, + size_t count, loff_t *ppos) +{ +#ifdef DEBUG + printk("hostaudio: read_user called, count = %d\n", count); +#endif + + return(os_read_file(state->fd, buffer, count)); +} + +static inline ssize_t hostaudio_write_user(struct hostaudio_state *state, const char *buffer, + size_t count, loff_t *ppos) +{ +#ifdef DEBUG + printk("hostaudio: write_user called, count = %d\n", count); +#endif + + return(os_write_file(state->fd, buffer, count)); +} + +static inline int hostaudio_ioctl_user(struct hostaudio_state *state, unsigned int cmd, + unsigned long arg) +{ +#ifdef DEBUG + printk("hostaudio: ioctl_user called, cmd = %u\n", cmd); +#endif + + return(os_ioctl_generic(state->fd, cmd, arg)); +} + +static inline int hostaudio_open_user(struct hostaudio_state *state, int r, int w, char *dsp) +{ +#ifdef DEBUG + printk("hostaudio: open_user called\n"); +#endif + + state->fd = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); + + if(state->fd < 0) { + printk("hostaudio_open_user failed to open '%s', err = %d\n", + dsp, -state->fd); + return(state->fd); + } + + return(0); +} + +static inline int hostaudio_release_user(struct hostaudio_state *state) +{ +#ifdef DEBUG + printk("hostaudio: release called\n"); +#endif + if(state->fd >= 0){ + os_close_file(state->fd); + state->fd = -1; + } + + return(0); +} + static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count, loff_t *ppos) { @@ -209,6 +280,48 @@ /* /dev/mixer file operations */ +static inline int hostmixer_ioctl_mixdev_user(struct hostmixer_state *state, + unsigned int cmd, unsigned long arg) +{ +#ifdef DEBUG + printk("hostmixer: ioctl_user called cmd = %u\n",cmd); +#endif + + return(os_ioctl_generic(state->fd, cmd, arg)); +} + +static inline int hostmixer_open_mixdev_user(struct hostmixer_state *state, int r, int w, + char *mixer) +{ +#ifdef DEBUG + printk("hostmixer: open_user called\n"); +#endif + + state->fd = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); + + if(state->fd < 0) { + printk("hostaudio_open_mixdev_user failed to open '%s', " + "err = %d\n", mixer, state->fd); + return(state->fd); + } + + return(0); +} + +static inline int hostmixer_release_mixdev_user(struct hostmixer_state *state) +{ +#ifdef DEBUG + printk("hostmixer: release_user called\n"); +#endif + + if(state->fd >= 0){ + os_close_file(state->fd); + state->fd = -1; + } + + return 0; +} + static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { --- ./arch/um/drivers/hostaudio_user.c.fix 2004-01-17 18:41:10.000000000 +0100 +++ ./arch/um/drivers/hostaudio_user.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2002 Steve Schmidtke - * Licensed under the GPL - */ - -#include -#include -#include -#include "hostaudio.h" -#include "user_util.h" -#include "kern_util.h" -#include "user.h" -#include "os.h" - -/* /dev/dsp file operations */ - -ssize_t hostaudio_read_user(struct hostaudio_state *state, char *buffer, - size_t count, loff_t *ppos) -{ -#ifdef DEBUG - printk("hostaudio: read_user called, count = %d\n", count); -#endif - - return(os_read_file(state->fd, buffer, count)); -} - -ssize_t hostaudio_write_user(struct hostaudio_state *state, const char *buffer, - size_t count, loff_t *ppos) -{ -#ifdef DEBUG - printk("hostaudio: write_user called, count = %d\n", count); -#endif - - return(os_write_file(state->fd, buffer, count)); -} - -int hostaudio_ioctl_user(struct hostaudio_state *state, unsigned int cmd, - unsigned long arg) -{ -#ifdef DEBUG - printk("hostaudio: ioctl_user called, cmd = %u\n", cmd); -#endif - - return(os_ioctl_generic(state->fd, cmd, arg)); -} - -int hostaudio_open_user(struct hostaudio_state *state, int r, int w, char *dsp) -{ -#ifdef DEBUG - printk("hostaudio: open_user called\n"); -#endif - - state->fd = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); - - if(state->fd < 0) { - printk("hostaudio_open_user failed to open '%s', err = %d\n", - dsp, -state->fd); - return(state->fd); - } - - return(0); -} - -int hostaudio_release_user(struct hostaudio_state *state) -{ -#ifdef DEBUG - printk("hostaudio: release called\n"); -#endif - if(state->fd >= 0){ - os_close_file(state->fd); - state->fd = -1; - } - - return(0); -} - -/* /dev/mixer file operations */ - -int hostmixer_ioctl_mixdev_user(struct hostmixer_state *state, - unsigned int cmd, unsigned long arg) -{ -#ifdef DEBUG - printk("hostmixer: ioctl_user called cmd = %u\n",cmd); -#endif - - return(os_ioctl_generic(state->fd, cmd, arg)); -} - -int hostmixer_open_mixdev_user(struct hostmixer_state *state, int r, int w, - char *mixer) -{ -#ifdef DEBUG - printk("hostmixer: open_user called\n"); -#endif - - state->fd = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); - - if(state->fd < 0) { - printk("hostaudio_open_mixdev_user failed to open '%s', " - "err = %d\n", mixer, state->fd); - return(state->fd); - } - - return(0); -} - -int hostmixer_release_mixdev_user(struct hostmixer_state *state) -{ -#ifdef DEBUG - printk("hostmixer: release_user called\n"); -#endif - - if(state->fd >= 0){ - os_close_file(state->fd); - state->fd = -1; - } - - return 0; -} - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ --- ./arch/um/drivers/Makefile.fix 2004-01-18 10:07:33.000000000 +0100 +++ ./arch/um/drivers/Makefile 2004-01-20 16:25:14.000000000 +0100 @@ -15,7 +15,7 @@ #pcap-objs := pcap_kern.o pcap_user.o $(PCAP) net-objs := net_kern.o net_user.o mconsole-objs := mconsole_kern.o mconsole_user.o -hostaudio-objs := hostaudio_kern.o hostaudio_user.o +hostaudio-objs := hostaudio_kern.o ubd-objs := ubd_kern.o ubd_user.o port-objs := port_kern.o port_user.o harddog-objs := harddog_kern.o harddog_user.o --- ./arch/um/include/hostaudio.h.fix 2003-12-20 16:58:43.000000000 +0100 +++ ./arch/um/include/hostaudio.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2002 Steve Schmidtke - * Licensed under the GPL - */ - -#ifndef HOSTAUDIO_H -#define HOSTAUDIO_H - -#define HOSTAUDIO_DEV_DSP "/dev/sound/dsp" -#define HOSTAUDIO_DEV_MIXER "/dev/sound/mixer" - -struct hostaudio_state { - int fd; -}; - -struct hostmixer_state { - int fd; -}; - -/* UML user-side protoypes */ -extern ssize_t hostaudio_read_user(struct hostaudio_state *state, char *buffer, - size_t count, loff_t *ppos); -extern ssize_t hostaudio_write_user(struct hostaudio_state *state, - const char *buffer, size_t count, - loff_t *ppos); -extern int hostaudio_ioctl_user(struct hostaudio_state *state, - unsigned int cmd, unsigned long arg); -extern int hostaudio_open_user(struct hostaudio_state *state, int r, int w, - char *dsp); -extern int hostaudio_release_user(struct hostaudio_state *state); -extern int hostmixer_ioctl_mixdev_user(struct hostmixer_state *state, - unsigned int cmd, unsigned long arg); -extern int hostmixer_open_mixdev_user(struct hostmixer_state *state, int r, - int w, char *mixer); -extern int hostmixer_release_mixdev_user(struct hostmixer_state *state); - -#endif /* HOSTAUDIO_H */ - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */