/[hurd]/hurd/libcons/cons.h
ViewVC logotype

Diff of /hurd/libcons/cons.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by marcus, Thu Aug 22 19:24:19 2002 UTC revision 1.2 by marcus, Sun Sep 8 21:55:59 2002 UTC
# Line 28  Line 28 
28    
29  #include <hurd/console.h>  #include <hurd/console.h>
30    
 typedef struct vcons *vcons_t;  
31  typedef struct cons *cons_t;  typedef struct cons *cons_t;
32    typedef struct vcons_list *vcons_list_t;
33    typedef struct vcons *vcons_t;
34  typedef struct cons_notify *cons_notify_t;  typedef struct cons_notify *cons_notify_t;
35    
36    struct vcons_list
37    {
38      cons_t cons;
39      vcons_list_t next;
40      vcons_list_t prev;
41    
42      /* The ID of the virtual console entry in the list.  */
43      int id;
44    
45      /* The opened vcons port on which we receive notifications.  */
46      vcons_t vcons;
47    };
48    
49    struct cons_notify
50    {
51      struct port_info pi;
52    
53      /* This is set for the dir notification port.  */
54      cons_t cons;
55    };
56    
57  struct vcons  struct vcons
58  {  {
59    vcons_t next;    /* This must come first for the port info structure.  */
60    vcons_t prev;    struct cons_notify notify;
61    
62      /* These elements are static from creation time.  */
63    cons_t cons;    cons_t cons;
64      vcons_list_t vcons_entry;
65    int id;    int id;
66    
67      /* The lock that protects all other members.  */
68    struct mutex lock;    struct mutex lock;
69    
70    /* The FD of the input node.  */    /* The FD of the input node.  */
71    int input;    int input;
72    
73      /* The shared memory of the display.  */
74    struct cons_display *display;    struct cons_display *display;
75    size_t display_size;    size_t display_size;
   cons_notify_t notify;  
76    
77    struct    struct
78    {    {
# Line 82  struct cons Line 110  struct cons
110    /* Protects the cons structure and the linked list in    /* Protects the cons structure and the linked list in
111       VCONS_LIST.  */       VCONS_LIST.  */
112    struct mutex lock;    struct mutex lock;
113    vcons_t vcons_list;    vcons_list_t vcons_list;
114    vcons_t vcons_last;    vcons_list_t vcons_last;
   vcons_t active;  
115    
116    struct port_class *port_class;    struct port_class *port_class;
117    struct port_bucket *port_bucket;    struct port_bucket *port_bucket;
# Line 93  struct cons Line 120  struct cons
120    int slack;    int slack;
121  };  };
122    
 struct cons_notify  
 {  
   struct port_info pi;  
   
   /* This is set for the dir notification port.  */  
   cons_t cons;  
   
   /* This is set for the file notification ports.  */  
   vcons_t vcons;  
 };  
   
123    
124  /* The user must define this variable.  Set this to the name of the  /* The user must define this variable.  Set this to the name of the
125     console client.  */     console client.  */
126  extern const char *cons_client_name;  extern const char *cons_client_name;
127    
128  /* The user must define this variables.  Set this to be the client  /* The user must define this variable.  Set this to be the client
129     version number.  */     version number.  */
130  extern const char *cons_client_version;  extern const char *cons_client_version;
131    
# Line 133  void cons_vcons_set_cursor_status (vcons Line 149  void cons_vcons_set_cursor_status (vcons
149    
150  /* The user must define this function.  Scroll the content of virtual  /* The user must define this function.  Scroll the content of virtual
151     console VCONS, which is locked, up by DELTA if DELTA is positive or     console VCONS, which is locked, up by DELTA if DELTA is positive or
152     down by -DELTA if DELTA is negative.  This call will be immediately     down by -DELTA if DELTA is negative.  DELTA will never be zero, and
153     followed by corresponding cons_vcons_write calls to fill the     the absolute value if DELTA will be smaller than or equal to the
154     resulting gap on the screen, and VCONS will be looked throughout     height of the screen matrix.
155     the whole time.  */  
156       This call will be immediately followed by corresponding
157       cons_vcons_write calls to fill the resulting gap on the screen, and
158       VCONS will be looked throughout the whole time.  The purpose of the
159       function is two-fold: It is called with an absolute value of DELTA
160       smaller than the screen height to perform scrolling.  It is called
161       with an absolute value of DELTA equal to the screen height to
162       prepare a full refresh of the screen.  In the latter case the user
163       should not really perform any scrolling.  Instead it might
164       deallocate limited resources (like display glyph slots and palette
165       colors) if that helps to perform the subsequent write.  It goes
166       without saying that the same deallocation, if any, should be
167       performed on the area that will be filled with the scrolled in
168       content.
169    
170       XXX Possibly need a function to invalidate scrollback buffer, or in
171       general to signal a switch of the console so state can be reset.
172       Only do this if we make guarantees about validity of scrollback
173       buffer, of course.
174    
175       The driver is allowed to delay the effect of this operation until
176       the UPDATE function is called.  */
177  void cons_vcons_scroll (vcons_t vcons, int delta);  void cons_vcons_scroll (vcons_t vcons, int delta);
178    
179  /* The user may define this function.  Make the changes from  /* The user may define this function.  Make the changes from
# Line 157  void cons_vcons_beep (vcons_t vcons); Line 194  void cons_vcons_beep (vcons_t vcons);
194  void cons_vcons_flash (vcons_t vcons);  void cons_vcons_flash (vcons_t vcons);
195    
196  /* The user must define this function.  It is called whenever a  /* The user must define this function.  It is called whenever a
197     virtual console is selected to be the active one.  */     virtual console is selected to be the active one.  It is the user's
198       responsibility to close the console at some later time.  */
199  error_t cons_vcons_activate (vcons_t vcons);  error_t cons_vcons_activate (vcons_t vcons);
200    
201  /* The user may define this function.  It is called whenever a  /* The user may define this function.  It is called after a
202     virtual console is added.  VCONS->cons is locked.  */     virtual console entry was added.  CONS is locked.  */
203  void cons_vcons_add (vcons_t vcons);  void cons_vcons_add (cons_t cons, vcons_list_t vcons_entry);
204    
205  /* The user may define this function.  It is called whenever a  /* The user may define this function.  It is called just before a
206     virtual console is removed.  VCONS->cons is locked.  */     virtual console entry is removed.  CONS is locked.  */
207  void cons_vcons_remove (vcons_t vcons);  void cons_vcons_remove (cons_t cons, vcons_list_t vcons_entry);
208    
209  /* Switch the active console in CONS to ID or the current one plus  /* Open the virtual console ID or the ACTIVE_ID plus DELTA one in CONS
210     DELTA.  This will call back into the user code by doing a     and return it in R_VCONS.  */
211     cons_vcons_activate.  */  error_t cons_switch (cons_t cons, int active_id, int id, int delta,
212  error_t cons_switch (cons_t cons, int id, int delta);                       vcons_t *r_vcons);
213    
214    
215  extern const struct argp cons_startup_argp;  extern const struct argp cons_startup_argp;
# Line 184  void cons_server_loop (void); Line 222  void cons_server_loop (void);
222  int cons_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp);  int cons_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp);
223    
224  /* Lookup the virtual console with number ID in the console CONS,  /* Lookup the virtual console with number ID in the console CONS,
225     acquire a reference for it, and return it in R_VCONS.  If CREATE is     acquire a reference for it, and return its list entry in R_VCONS.
226     true, the virtual console will be created if it doesn't exist yet.     If CREATE is true, the virtual console will be created if it
227     If CREATE is true, and ID 0, the first free virtual console id is     doesn't exist yet.  If CREATE is true, and ID 0, the first free
228     used.  CONS must be locked.  */     virtual console id is used.  CONS must be locked.  */
229  error_t cons_lookup (cons_t cons, int id, int create, vcons_t *r_vcons);  error_t cons_lookup (cons_t cons, int id, int create, vcons_list_t *r_vcons);
230    
231  /* Open the virtual console VCONS.  VCONS->cons is locked.  */  /* Open the virtual console for VCONS_ENTRY.  CONS is locked.  */
232  error_t cons_vcons_open (vcons_t vcons);  error_t cons_vcons_open (cons_t cons, vcons_list_t vcons_entry,
233                             vcons_t *r_vcons);
234    
235  /* Close the virtual console VCONS.  VCONS->cons is locked.  */  /* Close the virtual console VCONS.  VCONS->cons is locked.  */
236  void cons_vcons_close (vcons_t vcons);  void cons_vcons_close (vcons_t vcons);
237    
238    /* Destroy the virtual console VCONS.  */
239    void cons_vcons_destroy (void *port);
240    
241  /* Redraw the virtual console VCONS, which is locked.  */  /* Redraw the virtual console VCONS, which is locked.  */
242  void cons_vcons_refresh (vcons_t vcons);  void cons_vcons_refresh (vcons_t vcons);
243    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26