From ccc4092e238c5e074a32e2c5794ab01934f272df Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 13 Jun 2002 00:24:26 +0000 Subject: 2002-06-13 Marcus Brinkmann * 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 , not . Change all types from u_int32_t to uint32_t. * display.c: Include 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. --- console/console.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'console/console.c') 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 @@ -1165,6 +1170,24 @@ netfs_S_io_map (struct protid *cred, return errno; } + +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[] = { -- cgit v1.2.3