/[gxemul]/trunk/src/device.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/device.c

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

revision 11 by dpavlin, Mon Oct 8 16:18:27 2007 UTC revision 12 by dpavlin, Mon Oct 8 16:18:38 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: device.c,v 1.14 2005/06/22 08:13:38 debug Exp $   *  $Id: device.c,v 1.16 2005/08/10 22:25:50 debug Exp $
29   *   *
30   *  Device registry framework.   *  Device registry framework.
31   */   */
# Line 181  struct device_entry *device_lookup(char Line 181  struct device_entry *device_lookup(char
181   */   */
182  int device_unregister(char *name)  int device_unregister(char *name)
183  {  {
184          size_t i;          ssize_t i;
185          struct device_entry *p = device_lookup(name);          struct device_entry *p = device_lookup(name);
186    
187          if (p == NULL) {          if (p == NULL) {
# Line 233  void *device_add(struct machine *machine Line 233  void *device_add(struct machine *machine
233    
234          /*  Default values:  */          /*  Default values:  */
235          devinit.addr_mult = 1;          devinit.addr_mult = 1;
236            devinit.in_use = 1;
237    
238          /*  Get the device name first:  */          /*  Get the device name first:  */
239          s2 = name_and_params;          s2 = name_and_params;
# Line 290  void *device_add(struct machine *machine Line 291  void *device_add(struct machine *machine
291                          devinit.addr_mult = mystrtoull(s3, NULL, 0);                          devinit.addr_mult = mystrtoull(s3, NULL, 0);
292                  } else if (strncmp(s2, "irq=", 4) == 0) {                  } else if (strncmp(s2, "irq=", 4) == 0) {
293                          devinit.irq_nr = mystrtoull(s3, NULL, 0);                          devinit.irq_nr = mystrtoull(s3, NULL, 0);
294                    } else if (strncmp(s2, "in_use=", 7) == 0) {
295                            devinit.in_use = mystrtoull(s3, NULL, 0);
296                    } else if (strncmp(s2, "name2=", 6) == 0) {
297                            char *h = s2 + 6;
298                            size_t len = 0;
299                            while (*h && *h != ' ')
300                                    h++, len++;
301                            devinit.name2 = malloc(len + 1);
302                            if (devinit.name2 == NULL) {
303                                    fprintf(stderr, "out of memory\n");
304                                    exit(1);
305                            }
306                            snprintf(devinit.name2, len + 1, s2 + 6);
307                  } else {                  } else {
308                          fatal("unknown param: %s\n", s2);                          fatal("unknown param: %s\n", s2);
309                          if (device_exit_on_error)                          if (device_exit_on_error)

Legend:
Removed from v.11  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26