From 060ed31dd9ede0726f8c88aff36c6cd8ec6d0fe8 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 4 Jun 2012 13:35:26 +0200 Subject: TTY: um/line, add tty_port And use count from there. Signed-off-by: Jiri Slaby Cc: Jeff Dike Cc: Richard Weinberger Cc: user-mode-linux-devel@lists.sourceforge.net Signed-off-by: Richard Weinberger --- arch/um/drivers/line.c | 7 ++++--- arch/um/drivers/line.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index acfd0e0fd0c9..482a7bd4a64c 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -404,7 +404,7 @@ int line_open(struct line *lines, struct tty_struct *tty) goto out_unlock; err = 0; - if (line->count++) + if (line->port.count++) goto out_unlock; BUG_ON(tty->driver_data); @@ -446,7 +446,7 @@ void line_close(struct tty_struct *tty, struct file * filp) mutex_lock(&line->count_lock); BUG_ON(!line->valid); - if (--line->count) + if (--line->port.count) goto out_unlock; line->tty = NULL; @@ -478,7 +478,7 @@ int setup_one_line(struct line *lines, int n, char *init, mutex_lock(&line->count_lock); - if (line->count) { + if (line->port.count) { *error_out = "Device is already open"; goto out; } @@ -663,6 +663,7 @@ int register_lines(struct line_driver *line_driver, driver->init_termios = tty_std_termios; for (i = 0; i < nlines; i++) { + tty_port_init(&lines[i].port); spin_lock_init(&lines[i].lock); mutex_init(&lines[i].count_lock); lines[i].driver = line_driver; diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index 0a1834719dba..0e06a1f441d7 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -32,9 +32,9 @@ struct line_driver { }; struct line { + struct tty_port port; struct tty_struct *tty; struct mutex count_lock; - unsigned long count; int valid; char *init_str; -- cgit v1.2.3 From 6fc58845ad189f8ceebd68a2ff524bfcd689a75e Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 4 Jun 2012 13:35:27 +0200 Subject: TTY: um/line, use tty from tty_port This means switching to the tty refcounted model so that we will not race with interrupts. Signed-off-by: Jiri Slaby Cc: Jeff Dike Cc: Richard Weinberger Cc: user-mode-linux-devel@lists.sourceforge.net Signed-off-by: Richard Weinberger --- arch/um/drivers/chan_kern.c | 4 +++- arch/um/drivers/line.c | 25 ++++++++++++++++++------- arch/um/drivers/line.h | 1 - 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 45e248c2f43c..87eebfe03c61 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -150,9 +150,11 @@ void chan_enable_winch(struct chan *chan, struct tty_struct *tty) static void line_timer_cb(struct work_struct *work) { struct line *line = container_of(work, struct line, task.work); + struct tty_struct *tty = tty_port_tty_get(&line->port); if (!line->throttled) - chan_interrupt(line, line->tty, line->driver->read_irq); + chan_interrupt(line, tty, line->driver->read_irq); + tty_kref_put(tty); } int enable_chan(struct line *line) diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 482a7bd4a64c..fb6e4ea09921 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -19,9 +19,11 @@ static irqreturn_t line_interrupt(int irq, void *data) { struct chan *chan = data; struct line *line = chan->line; + struct tty_struct *tty = tty_port_tty_get(&line->port); if (line) - chan_interrupt(line, line->tty, irq); + chan_interrupt(line, tty, irq); + tty_kref_put(tty); return IRQ_HANDLED; } @@ -333,7 +335,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data) { struct chan *chan = data; struct line *line = chan->line; - struct tty_struct *tty = line->tty; + struct tty_struct *tty; int err; /* @@ -352,10 +354,13 @@ static irqreturn_t line_write_interrupt(int irq, void *data) } spin_unlock(&line->lock); + tty = tty_port_tty_get(&line->port); if (tty == NULL) return IRQ_NONE; tty_wakeup(tty); + tty_kref_put(tty); + return IRQ_HANDLED; } @@ -409,7 +414,7 @@ int line_open(struct line *lines, struct tty_struct *tty) BUG_ON(tty->driver_data); tty->driver_data = line; - line->tty = tty; + tty_port_tty_set(&line->port, tty); err = enable_chan(line); if (err) /* line_close() will be called by our caller */ @@ -449,7 +454,7 @@ void line_close(struct tty_struct *tty, struct file * filp) if (--line->port.count) goto out_unlock; - line->tty = NULL; + tty_port_tty_set(&line->port, NULL); tty->driver_data = NULL; if (line->sigio) { @@ -610,9 +615,15 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str, mutex_lock(&line->count_lock); if (!line->valid) CONFIG_CHUNK(str, size, n, "none", 1); - else if (line->tty == NULL) - CONFIG_CHUNK(str, size, n, line->init_str, 1); - else n = chan_config_string(line, str, size, error_out); + else { + struct tty_struct *tty = tty_port_tty_get(&line->port); + if (tty == NULL) { + CONFIG_CHUNK(str, size, n, line->init_str, 1); + } else { + n = chan_config_string(line, str, size, error_out); + tty_kref_put(tty); + } + } mutex_unlock(&line->count_lock); return n; diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index 0e06a1f441d7..5b3d4fbdec18 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -33,7 +33,6 @@ struct line_driver { struct line { struct tty_port port; - struct tty_struct *tty; struct mutex count_lock; int valid; -- cgit v1.2.3 From d003e982c1d2b8bf8418c415b0b87175d6a1bda2 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Mon, 4 Jun 2012 20:53:13 +0200 Subject: um: remove line_ioctl() line_ioctl() has no real function. Signed-off-by: Richard Weinberger --- arch/um/drivers/line.c | 86 ----------------------------------------- arch/um/drivers/line.h | 2 - arch/um/drivers/ssl.c | 1 - arch/um/drivers/stdio_console.c | 1 - 4 files changed, 90 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index fb6e4ea09921..131129aec249 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -221,92 +221,6 @@ void line_set_termios(struct tty_struct *tty, struct ktermios * old) /* nothing */ } -static const struct { - int cmd; - char *level; - char *name; -} tty_ioctls[] = { - /* don't print these, they flood the log ... */ - { TCGETS, NULL, "TCGETS" }, - { TCSETS, NULL, "TCSETS" }, - { TCSETSW, NULL, "TCSETSW" }, - { TCFLSH, NULL, "TCFLSH" }, - { TCSBRK, NULL, "TCSBRK" }, - - /* general tty stuff */ - { TCSETSF, KERN_DEBUG, "TCSETSF" }, - { TCGETA, KERN_DEBUG, "TCGETA" }, - { TIOCMGET, KERN_DEBUG, "TIOCMGET" }, - { TCSBRKP, KERN_DEBUG, "TCSBRKP" }, - { TIOCMSET, KERN_DEBUG, "TIOCMSET" }, - - /* linux-specific ones */ - { TIOCLINUX, KERN_INFO, "TIOCLINUX" }, - { KDGKBMODE, KERN_INFO, "KDGKBMODE" }, - { KDGKBTYPE, KERN_INFO, "KDGKBTYPE" }, - { KDSIGACCEPT, KERN_INFO, "KDSIGACCEPT" }, -}; - -int line_ioctl(struct tty_struct *tty, unsigned int cmd, - unsigned long arg) -{ - int ret; - int i; - - ret = 0; - switch(cmd) { -#ifdef TIOCGETP - case TIOCGETP: - case TIOCSETP: - case TIOCSETN: -#endif -#ifdef TIOCGETC - case TIOCGETC: - case TIOCSETC: -#endif -#ifdef TIOCGLTC - case TIOCGLTC: - case TIOCSLTC: -#endif - /* Note: these are out of date as we now have TCGETS2 etc but this - whole lot should probably go away */ - case TCGETS: - case TCSETSF: - case TCSETSW: - case TCSETS: - case TCGETA: - case TCSETAF: - case TCSETAW: - case TCSETA: - case TCXONC: - case TCFLSH: - case TIOCOUTQ: - case TIOCINQ: - case TIOCGLCKTRMIOS: - case TIOCSLCKTRMIOS: - case TIOCPKT: - case TIOCGSOFTCAR: - case TIOCSSOFTCAR: - return -ENOIOCTLCMD; -#if 0 - case TCwhatever: - /* do something */ - break; -#endif - default: - for (i = 0; i < ARRAY_SIZE(tty_ioctls); i++) - if (cmd == tty_ioctls[i].cmd) - break; - if (i == ARRAY_SIZE(tty_ioctls)) { - printk(KERN_ERR "%s: %s: unknown ioctl: 0x%x\n", - __func__, tty->name, cmd); - } - ret = -ENOIOCTLCMD; - break; - } - return ret; -} - void line_throttle(struct tty_struct *tty) { struct line *line = tty->driver_data; diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index 5b3d4fbdec18..6c3b252bf480 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -69,8 +69,6 @@ extern int line_chars_in_buffer(struct tty_struct *tty); extern void line_flush_buffer(struct tty_struct *tty); extern void line_flush_chars(struct tty_struct *tty); extern int line_write_room(struct tty_struct *tty); -extern int line_ioctl(struct tty_struct *tty, unsigned int cmd, - unsigned long arg); extern void line_throttle(struct tty_struct *tty); extern void line_unthrottle(struct tty_struct *tty); diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index e09801a1327b..a39d53eaf57b 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -129,7 +129,6 @@ static const struct tty_operations ssl_ops = { .flush_buffer = line_flush_buffer, .flush_chars = line_flush_chars, .set_termios = line_set_termios, - .ioctl = line_ioctl, .throttle = line_throttle, .unthrottle = line_unthrottle, #if 0 diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index 7663541c372e..5cefdba2e3bf 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c @@ -112,7 +112,6 @@ static const struct tty_operations console_ops = { .flush_buffer = line_flush_buffer, .flush_chars = line_flush_chars, .set_termios = line_set_termios, - .ioctl = line_ioctl, .throttle = line_throttle, .unthrottle = line_unthrottle, }; -- cgit v1.2.3 From df7b86f313fd26b5021afde7e66b35f9267b1261 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Mon, 4 Jun 2012 20:58:18 +0200 Subject: um: Remove dead code Signed-off-by: Richard Weinberger --- arch/um/drivers/ssl.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index a39d53eaf57b..cba95d959af1 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -98,27 +98,6 @@ static int ssl_open(struct tty_struct *tty, struct file *filp) return err; } -#if 0 -static void ssl_flush_buffer(struct tty_struct *tty) -{ - return; -} - -static void ssl_stop(struct tty_struct *tty) -{ - printk(KERN_ERR "Someone should implement ssl_stop\n"); -} - -static void ssl_start(struct tty_struct *tty) -{ - printk(KERN_ERR "Someone should implement ssl_start\n"); -} - -void ssl_hangup(struct tty_struct *tty) -{ -} -#endif - static const struct tty_operations ssl_ops = { .open = ssl_open, .close = line_close, @@ -131,11 +110,6 @@ static const struct tty_operations ssl_ops = { .set_termios = line_set_termios, .throttle = line_throttle, .unthrottle = line_unthrottle, -#if 0 - .stop = ssl_stop, - .start = ssl_start, - .hangup = ssl_hangup, -#endif }; /* Changed by ssl_init and referenced by ssl_exit, which are both serialized -- cgit v1.2.3 From 79e0273d187c807dfec8d0cf450b8187cab5d3af Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Mon, 4 Jun 2012 21:57:24 +0200 Subject: um: fully use tty_port ... use all tty_port helpers Signed-off-by: Richard Weinberger --- arch/um/drivers/line.c | 102 ++++++++++++++++++---------------------- arch/um/drivers/line.h | 6 ++- arch/um/drivers/ssl.c | 15 +++--- arch/um/drivers/stdio_console.c | 20 ++++---- 4 files changed, 65 insertions(+), 78 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 131129aec249..95d5e7803bc7 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -296,43 +296,14 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data) return err; } -/* - * Normally, a driver like this can rely mostly on the tty layer - * locking, particularly when it comes to the driver structure. - * However, in this case, mconsole requests can come in "from the - * side", and race with opens and closes. - * - * mconsole config requests will want to be sure the device isn't in - * use, and get_config, open, and close will want a stable - * configuration. The checking and modification of the configuration - * is done under a spinlock. Checking whether the device is in use is - * line->tty->count > 1, also under the spinlock. - * - * line->count serves to decide whether the device should be enabled or - * disabled on the host. If it's equal to 0, then we are doing the - * first open or last close. Otherwise, open and close just return. - */ - -int line_open(struct line *lines, struct tty_struct *tty) +static int line_activate(struct tty_port *port, struct tty_struct *tty) { - struct line *line = &lines[tty->index]; - int err = -ENODEV; - - mutex_lock(&line->count_lock); - if (!line->valid) - goto out_unlock; - - err = 0; - if (line->port.count++) - goto out_unlock; - - BUG_ON(tty->driver_data); - tty->driver_data = line; - tty_port_tty_set(&line->port, tty); + int ret; + struct line *line = tty->driver_data; - err = enable_chan(line); - if (err) /* line_close() will be called by our caller */ - goto out_unlock; + ret = enable_chan(line); + if (ret) + return ret; if (!line->sigio) { chan_enable_winch(line->chan_out, tty); @@ -340,44 +311,60 @@ int line_open(struct line *lines, struct tty_struct *tty) } chan_window_size(line, &tty->winsize.ws_row, - &tty->winsize.ws_col); -out_unlock: - mutex_unlock(&line->count_lock); - return err; + &tty->winsize.ws_col); + + return 0; } -static void unregister_winch(struct tty_struct *tty); +static const struct tty_port_operations line_port_ops = { + .activate = line_activate, +}; -void line_close(struct tty_struct *tty, struct file * filp) +int line_open(struct tty_struct *tty, struct file *filp) { struct line *line = tty->driver_data; - /* - * If line_open fails (and tty->driver_data is never set), - * tty_open will call line_close. So just return in this case. - */ - if (line == NULL) - return; + return tty_port_open(&line->port, tty, filp); +} - /* We ignore the error anyway! */ - flush_buffer(line); +int line_install(struct tty_driver *driver, struct tty_struct *tty, + struct line *line) +{ + int ret; - mutex_lock(&line->count_lock); - BUG_ON(!line->valid); + ret = tty_standard_install(driver, tty); + if (ret) + return ret; + + tty->driver_data = line; - if (--line->port.count) - goto out_unlock; + return 0; +} + +static void unregister_winch(struct tty_struct *tty); - tty_port_tty_set(&line->port, NULL); - tty->driver_data = NULL; +void line_cleanup(struct tty_struct *tty) +{ + struct line *line = tty->driver_data; if (line->sigio) { unregister_winch(tty); line->sigio = 0; } +} -out_unlock: - mutex_unlock(&line->count_lock); +void line_close(struct tty_struct *tty, struct file * filp) +{ + struct line *line = tty->driver_data; + + tty_port_close(&line->port, tty, filp); +} + +void line_hangup(struct tty_struct *tty) +{ + struct line *line = tty->driver_data; + + tty_port_hangup(&line->port); } void close_lines(struct line *lines, int nlines) @@ -589,6 +576,7 @@ int register_lines(struct line_driver *line_driver, for (i = 0; i < nlines; i++) { tty_port_init(&lines[i].port); + lines[i].port.ops = &line_port_ops; spin_lock_init(&lines[i].lock); mutex_init(&lines[i].count_lock); lines[i].driver = line_driver; diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index 6c3b252bf480..ad00f3e11ecc 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -58,7 +58,11 @@ struct line { }; extern void line_close(struct tty_struct *tty, struct file * filp); -extern int line_open(struct line *lines, struct tty_struct *tty); +extern int line_open(struct tty_struct *tty, struct file *filp); +extern int line_install(struct tty_driver *driver, struct tty_struct *tty, + struct line *line); +extern void line_cleanup(struct tty_struct *tty); +extern void line_hangup(struct tty_struct *tty); extern int line_setup(char **conf, unsigned nlines, char **def, char *init, char *name); extern int line_write(struct tty_struct *tty, const unsigned char *buf, diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index cba95d959af1..7e86f0070123 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c @@ -87,19 +87,13 @@ static int ssl_remove(int n, char **error_out) error_out); } -static int ssl_open(struct tty_struct *tty, struct file *filp) +static int ssl_install(struct tty_driver *driver, struct tty_struct *tty) { - int err = line_open(serial_lines, tty); - - if (err) - printk(KERN_ERR "Failed to open serial line %d, err = %d\n", - tty->index, err); - - return err; + return line_install(driver, tty, &serial_lines[tty->index]); } static const struct tty_operations ssl_ops = { - .open = ssl_open, + .open = line_open, .close = line_close, .write = line_write, .put_char = line_put_char, @@ -110,6 +104,9 @@ static const struct tty_operations ssl_ops = { .set_termios = line_set_termios, .throttle = line_throttle, .unthrottle = line_unthrottle, + .install = ssl_install, + .cleanup = line_cleanup, + .hangup = line_hangup, }; /* Changed by ssl_init and referenced by ssl_exit, which are both serialized diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index 5cefdba2e3bf..929b99a261f3 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c @@ -89,21 +89,17 @@ static int con_remove(int n, char **error_out) return line_remove(vts, ARRAY_SIZE(vts), n, error_out); } -static int con_open(struct tty_struct *tty, struct file *filp) -{ - int err = line_open(vts, tty); - if (err) - printk(KERN_ERR "Failed to open console %d, err = %d\n", - tty->index, err); - - return err; -} - /* Set in an initcall, checked in an exitcall */ static int con_init_done = 0; +static int con_install(struct tty_driver *driver, struct tty_struct *tty) +{ + return line_install(driver, tty, &vts[tty->index]); +} + static const struct tty_operations console_ops = { - .open = con_open, + .open = line_open, + .install = con_install, .close = line_close, .write = line_write, .put_char = line_put_char, @@ -114,6 +110,8 @@ static const struct tty_operations console_ops = { .set_termios = line_set_termios, .throttle = line_throttle, .unthrottle = line_unthrottle, + .cleanup = line_cleanup, + .hangup = line_hangup, }; static void uml_console_write(struct console *console, const char *string, -- cgit v1.2.3 From a84ccab132370a07c7ca0c6df8c96bbd16306c9a Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Mon, 4 Jun 2012 21:58:39 +0200 Subject: um: remove count_lock this lock is no longer needed. Signed-off-by: Richard Weinberger --- arch/um/drivers/line.c | 6 ------ arch/um/drivers/line.h | 1 - 2 files changed, 7 deletions(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 95d5e7803bc7..555ccfc7300c 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -382,8 +382,6 @@ int setup_one_line(struct line *lines, int n, char *init, struct tty_driver *driver = line->driver->driver; int err = -EINVAL; - mutex_lock(&line->count_lock); - if (line->port.count) { *error_out = "Device is already open"; goto out; @@ -425,7 +423,6 @@ int setup_one_line(struct line *lines, int n, char *init, } } out: - mutex_unlock(&line->count_lock); return err; } @@ -513,7 +510,6 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str, line = &lines[dev]; - mutex_lock(&line->count_lock); if (!line->valid) CONFIG_CHUNK(str, size, n, "none", 1); else { @@ -525,7 +521,6 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str, tty_kref_put(tty); } } - mutex_unlock(&line->count_lock); return n; } @@ -578,7 +573,6 @@ int register_lines(struct line_driver *line_driver, tty_port_init(&lines[i].port); lines[i].port.ops = &line_port_ops; spin_lock_init(&lines[i].lock); - mutex_init(&lines[i].count_lock); lines[i].driver = line_driver; INIT_LIST_HEAD(&lines[i].chan_list); } diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index ad00f3e11ecc..bae95611e7ab 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -33,7 +33,6 @@ struct line_driver { struct line { struct tty_port port; - struct mutex count_lock; int valid; char *init_str; -- cgit v1.2.3 From d4afcba95fca4dd0f831fe72c1fa4f0638f23765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A4rtel?= Date: Thu, 2 Aug 2012 00:44:22 +0200 Subject: um: fix ubd_file_size for read-only files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made ubd_file_size not request write access. Fixes use of read-only images. Signed-off-by: Martin Pärtel Signed-off-by: Richard Weinberger --- arch/um/drivers/ubd_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/um/drivers') diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 20505cafa299..0643e5bc9f41 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -514,7 +514,7 @@ static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) goto out; } - fd = os_open_file(ubd_dev->file, global_openflags, 0); + fd = os_open_file(ubd_dev->file, of_read(OPENFLAGS()), 0); if (fd < 0) return fd; -- cgit v1.2.3