aboutsummaryrefslogtreecommitdiff
path: root/console/console.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-06-13 00:24:26 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-06-13 00:24:26 +0000
commitccc4092e238c5e074a32e2c5794ab01934f272df (patch)
treed1cbbed8182717c1bc1eba4c288b400b4ed36324 /console/console.c
parent693eb63d90f9036680e538bc84275a32f707f926 (diff)
downloadhurd-ccc4092e238c5e074a32e2c5794ab01934f272df.tar.gz
hurd-ccc4092e238c5e074a32e2c5794ab01934f272df.tar.bz2
hurd-ccc4092e238c5e074a32e2c5794ab01934f272df.zip
2002-06-13 Marcus Brinkmann <marcus@gnu.org>
* Makefile (DIST_FILES): New target. (MIGSTUBS): Likewise. (OBJS): Add $(MIGSTUBS). * ourfs_notify.defs: New file. * console.c: Diddle order of typedefs. (netfs_attempt_read): Clip AMT to bytes left to read before calling display_read. (netfs_S_file_notice_changes): New function. * console.h: Include <stdint.h>, not <sys/types.h>. Change all types from u_int32_t to uint32_t. * display.c: Include <stddef.h> and "outfs_notify_U.h". Change all u_int_32 types to uint32_t. (struct modreq): New structure. (struct display): New member filemod_reqs. (free_modreqs): New function. (display_notice_changes): Likewise. (display_notice_filechange): Likewise. (display_destroy): Free filemod_reqs member of DISPLAY. (MATRIX_POS): Macro removed. (screen_fill): Rewritten. (screen_shift_left): New function. (screen_shift_right): Likewise. (screen_scroll_up): Function removed. (screen_scroll_down): Likewise. (screen_scroll_left): Likewise. (screen_scroll_right): Likewise. (handle_esc_bracket): Use new screen_* functions. (display_output_one): Store old cursor and screen attributes, and if they have been changed, send file change notifications. * display.h: New prototype for display_notice_changes.
Diffstat (limited to 'console/console.c')
-rw-r--r--console/console.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/console/console.c b/console/console.c
index 3c1c5ce2..7d12db9f 100644
--- a/console/console.c
+++ b/console/console.c
@@ -52,6 +52,12 @@ volatile struct mapped_time_value *console_maptime;
#define DEFAULT_ENCODING "ISO-8859-1"
+/* A handle for a console device. */
+typedef struct cons *cons_t;
+
+/* A handle for a virtual console device. */
+typedef struct vcons *vcons_t;
+
struct vcons
{
/* Protected by cons->lock. */
@@ -75,8 +81,6 @@ struct vcons
struct node *disp_node;
struct node *inpt_node;
};
-/* A handle for a virtual console device. */
-typedef struct vcons *vcons_t;
struct cons
{
@@ -93,8 +97,6 @@ struct cons
/* A template for the stat information of all nodes. */
struct stat stat_template;
};
-/* A handle for a console device. */
-typedef struct cons *cons_t;
/* Lookup the virtual console with number ID in the console CONS,
@@ -1051,11 +1053,14 @@ netfs_attempt_read (struct iouser *cred, struct node *np,
ssize_t amt = *len;
assert (np == vcons->disp_node);
- if (amt > np->nn_stat.st_size)
- amt = np->nn_stat.st_size;
- amt = display_read (vcons->display,
- /* cred->po->openstat & O_NONBLOCK */ 0,
- offset, data, amt);
+ if (offset + amt > np->nn_stat.st_size)
+ amt = np->nn_stat.st_size - offset;
+ if (amt < 0)
+ amt = 0;
+ else
+ amt = display_read (vcons->display,
+ /* cred->po->openstat & O_NONBLOCK */ 0,
+ offset, data, amt);
if (amt == -1)
err = errno;
else
@@ -1166,6 +1171,24 @@ netfs_S_io_map (struct protid *cred,
}
+kern_return_t
+netfs_S_file_notice_changes (struct protid *cred, mach_port_t notify)
+{
+ struct node *np;
+ vcons_t vcons;
+
+ if (!cred)
+ return EOPNOTSUPP;
+
+ np = cred->po->np;
+ vcons = np->nn->vcons;
+ if (!vcons || np != vcons->disp_node)
+ return EOPNOTSUPP;
+
+ return display_notice_changes (vcons->display, notify);
+}
+
+
static const struct argp_option options[] =
{
{"encoding", 'e', "NAME", 0, "Set encoding of virtual consoles to"