Migrated position dependent initialization, to label based
authorDavide Libenzi <dlibenzi@google.com>
Tue, 10 Nov 2015 02:31:47 +0000 (18:31 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 10 Nov 2015 16:43:08 +0000 (11:43 -0500)
Migrated position dependent initialization, to label based.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
14 files changed:
kern/arch/x86/devarch.c
kern/drivers/dev/acpi.c
kern/drivers/dev/alarm.c
kern/drivers/dev/cons.c
kern/drivers/dev/ether.c
kern/drivers/dev/kprof.c
kern/drivers/dev/mnt.c
kern/drivers/dev/nix.c
kern/drivers/dev/pci.c
kern/drivers/dev/pipe.c
kern/drivers/dev/proc.c
kern/drivers/dev/regress.c
kern/drivers/dev/root.c
kern/drivers/dev/srv.c

index 90721c6..61fa247 100644 (file)
@@ -491,23 +491,23 @@ static long archwrite(struct chan *c, void *a, long n, int64_t offset)
 }
 
 struct dev archdevtab __devtab = {
-       "arch",
-
-       devreset,
-       devinit,
-       devshutdown,
-       archattach,
-       archwalk,
-       archstat,
-       archopen,
-       devcreate,
-       archclose,
-       archread,
-       devbread,
-       archwrite,
-       devbwrite,
-       devremove,
-       devwstat,
+       .name = "arch",
+
+       .reset = devreset,
+       .init = devinit,
+       .shutdown = devshutdown,
+       .attach = archattach,
+       .walk = archwalk,
+       .stat = archstat,
+       .open = archopen,
+       .create = devcreate,
+       .close = archclose,
+       .read = archread,
+       .bread = devbread,
+       .write = archwrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = devwstat,
 };
 
 /*
index d5aa3a3..fd71814 100644 (file)
@@ -1698,21 +1698,21 @@ static long acpiwrite(struct chan *c, void *a, long n, int64_t off)
 }
 
 struct dev acpidevtab __devtab = {
-       "acpi",
-
-       devreset,
-       devinit,
-       devshutdown,
-       acpiattach,
-       acpiwalk,
-       acpistat,
-       acpiopen,
-       devcreate,
-       acpiclose,
-       acpiread,
-       devbread,
-       acpiwrite,
-       devbwrite,
-       devremove,
-       devwstat,
+       .name = "acpi",
+
+       .reset = devreset,
+       .init = devinit,
+       .shutdown = devshutdown,
+       .attach = acpiattach,
+       .walk = acpiwalk,
+       .stat = acpistat,
+       .open = acpiopen,
+       .create = devcreate,
+       .close = acpiclose,
+       .read = acpiread,
+       .bread = devbread,
+       .write = acpiwrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = devwstat,
 };
index 7ecee2d..889384c 100644 (file)
@@ -415,24 +415,23 @@ static long alarmwrite(struct chan *c, void *ubuf, long n, int64_t unused)
 }
 
 struct dev alarmdevtab __devtab = {
-       "alarm",
+       .name = "alarm",
 
-       devreset,
-       alarminit,
-       devshutdown,
-       alarmattach,
-       alarmwalk,
-       alarmstat,
-       alarmopen,
-       alarmcreate,
-       alarmclose,
-       alarmread,
-       devbread,
-       alarmwrite,
-       devbwrite,
-       alarmremove,
-       alarmwstat,
-       devpower,
-       //devconfig,
-       devchaninfo,
+       .reset = devreset,
+       .init = alarminit,
+       .shutdown = devshutdown,
+       .attach = alarmattach,
+       .walk = alarmwalk,
+       .stat = alarmstat,
+       .open = alarmopen,
+       .create = alarmcreate,
+       .close = alarmclose,
+       .read = alarmread,
+       .bread = devbread,
+       .write = alarmwrite,
+       .bwrite = devbwrite,
+       .remove = alarmremove,
+       .wstat = alarmwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
index ff93ca4..84b3dd8 100644 (file)
@@ -1114,25 +1114,25 @@ static long conswrite(struct chan *c, void *va, long n, int64_t offset)
 }
 
 struct dev consdevtab __devtab = {
-       "cons",
-
-       devreset,
-       consinit,
-       devshutdown,
-       consattach,
-       conswalk,
-       consstat,
-       consopen,
-       devcreate,
-       consclose,
-       consread,
-       devbread,
-       conswrite,
-       devbwrite,
-       devremove,
-       devwstat,
-       devpower,
-       devchaninfo,
+       .name = "cons",
+
+       .reset = devreset,
+       .init = consinit,
+       .shutdown = devshutdown,
+       .attach = consattach,
+       .walk = conswalk,
+       .stat = consstat,
+       .open = consopen,
+       .create = devcreate,
+       .close = consclose,
+       .read = consread,
+       .bread = devbread,
+       .write = conswrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = devwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
 
 static uint32_t randn;
index ec2eab7..3b9c5e6 100644 (file)
@@ -837,23 +837,23 @@ uint32_t ethercrc(uint8_t * p, int len)
 }
 
 struct dev etherdevtab __devtab = {
-       "ether",
-
-       etherreset,
-       devinit,
-       ethershutdown,
-       etherattach,
-       etherwalk,
-       etherstat,
-       etheropen,
-       devcreate,
-       etherclose,
-       etherread,
-       etherbread,
-       etherwrite,
-       etherbwrite,
-       devremove,
-       etherwstat,
-       etherpower,
-       devchaninfo,
+       .name = "ether",
+
+       .reset = etherreset,
+       .init = devinit,
+       .shutdown = ethershutdown,
+       .attach = etherattach,
+       .walk = etherwalk,
+       .stat = etherstat,
+       .open = etheropen,
+       .create = devcreate,
+       .close = etherclose,
+       .read = etherread,
+       .bread = etherbread,
+       .write = etherwrite,
+       .bwrite = etherbwrite,
+       .remove = devremove,
+       .wstat = etherwstat,
+       .power = etherpower,
+       .chaninfo = devchaninfo,
 };
index 250b633..5d173c3 100644 (file)
@@ -611,21 +611,21 @@ void trace_printk(const char *fmt, ...)
 }
 
 struct dev kprofdevtab __devtab = {
-       "kprof",
-
-       devreset,
-       kprofinit,
-       kprofshutdown,
-       kprofattach,
-       kprofwalk,
-       kprofstat,
-       kprofopen,
-       devcreate,
-       kprofclose,
-       kprofread,
-       devbread,
-       kprofwrite,
-       devbwrite,
-       devremove,
-       devwstat,
+       .name = "kprof",
+
+       .reset = devreset,
+       .init = kprofinit,
+       .shutdown = kprofshutdown,
+       .attach = kprofattach,
+       .walk = kprofwalk,
+       .stat = kprofstat,
+       .open = kprofopen,
+       .create = devcreate,
+       .close = kprofclose,
+       .read = kprofread,
+       .bread = devbread,
+       .write = kprofwrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = devwstat,
 };
index 350f522..fbff606 100644 (file)
@@ -1245,23 +1245,23 @@ int rpcattn(void *v)
 }
 
 struct dev mntdevtab __devtab = {
-       "mnt",
-
-       devreset,
-       mntinit,
-       devshutdown,
-       mntattach,
-       mntwalk,
-       mntstat,
-       mntopen,
-       mntcreate,
-       mntclose,
-       mntread,
-       devbread,
-       mntwrite,
-       devbwrite,
-       mntremove,
-       mntwstat,
-       devpower,
-       devchaninfo,
+       .name = "mnt",
+
+       .reset = devreset,
+       .init = mntinit,
+       .shutdown = devshutdown,
+       .attach = mntattach,
+       .walk = mntwalk,
+       .stat = mntstat,
+       .open = mntopen,
+       .create = mntcreate,
+       .close = mntclose,
+       .read = mntread,
+       .bread = devbread,
+       .write = mntwrite,
+       .bwrite = devbwrite,
+       .remove = mntremove,
+       .wstat = mntwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
index cc05780..65f8297 100644 (file)
@@ -525,24 +525,23 @@ static long nixwrite(struct chan *c, void *ubuf, long n, int64_t off)
 }
 
 struct dev nixdevtab __devtab = {
-       "nix",
-
-       devreset,
-       nixinit,
-       devshutdown,
-       nixattach,
-       nixwalk,
-       nixstat,
-       nixopen,
-       nixcreate,
-       nixclose,
-       nixread,
-       devbread,
-       nixwrite,
-       devbwrite,
-       nixremove,
-       nixwstat,
-       devpower,
-//  devconfig,
-       devchaninfo,
+       .name = "nix",
+
+       .reset = devreset,
+       .init = nixinit,
+       .shutdown = devshutdown,
+       .attach = nixattach,
+       .walk = nixwalk,
+       .stat = nixstat,
+       .open = nixopen,
+       .create = nixcreate,
+       .close = nixclose,
+       .read = nixread,
+       .bread = devbread,
+       .write = nixwrite,
+       .bwrite = devbwrite,
+       .remove = nixremove,
+       .wstat = nixwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
index 5556931..40f9fce 100644 (file)
@@ -252,21 +252,21 @@ static long pciwrite(struct chan *c, void *va, long n, int64_t offset)
 }
 
 struct dev pcidevtab = {
-       "pci",
+       .name = "pci",
 
-       devreset,
-       devinit,
-       devshutdown,
-       pciattach,
-       pciwalk,
-       pcistat,
-       pciopen,
-       devcreate,
-       pciclose,
-       pciread,
-       devbread,
-       pciwrite,
-       devbwrite,
-       devremove,
-       devwstat,
+       .reset = devreset,
+       .init = devinit,
+       .shutdown = devshutdown,
+       .attach = pciattach,
+       .walk = pciwalk,
+       .stat = pcistat,
+       .open = pciopen,
+       .create = devcreate,
+       .close = pciclose,
+       .read = pciread,
+       .bread = devbread,
+       .write = pciwrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = devwstat,
 };
index f59c62f..81c591a 100644 (file)
@@ -479,23 +479,23 @@ static int pipewstat(struct chan *c, uint8_t *dp, int n)
 }
 
 struct dev pipedevtab __devtab = {
-       "pipe",
-
-       devreset,
-       pipeinit,
-       devshutdown,
-       pipeattach,
-       pipewalk,
-       pipestat,
-       pipeopen,
-       devcreate,
-       pipeclose,
-       piperead,
-       pipebread,
-       pipewrite,
-       pipebwrite,
-       devremove,
-       pipewstat,
-       devpower,
-       devchaninfo,
+       .name = "pipe",
+
+       .reset = devreset,
+       .init = pipeinit,
+       .shutdown = devshutdown,
+       .attach = pipeattach,
+       .walk = pipewalk,
+       .stat = pipestat,
+       .open = pipeopen,
+       .create = devcreate,
+       .close = pipeclose,
+       .read = piperead,
+       .bread = pipebread,
+       .write = pipewrite,
+       .bwrite = pipebwrite,
+       .remove = devremove,
+       .wstat = pipewstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
index 9a7d305..b77c675 100644 (file)
@@ -1329,25 +1329,25 @@ static long procwrite(struct chan *c, void *va, long n, int64_t off)
 }
 
 struct dev procdevtab __devtab = {
-       "proc",
-
-       devreset,
-       procinit,
-       devshutdown,
-       procattach,
-       procwalk,
-       procstat,
-       procopen,
-       devcreate,
-       procclose,
-       procread,
-       devbread,
-       procwrite,
-       devbwrite,
-       devremove,
-       procwstat,
-       devpower,
-       devchaninfo,
+       .name = "proc",
+
+       .reset = devreset,
+       .init = procinit,
+       .shutdown = devshutdown,
+       .attach = procattach,
+       .walk = procwalk,
+       .stat = procstat,
+       .open = procopen,
+       .create = devcreate,
+       .close = procclose,
+       .read = procread,
+       .bread = devbread,
+       .write = procwrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = procwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
 
 #if 0
index 274e678..c84d60d 100644 (file)
@@ -178,21 +178,21 @@ regresswrite(struct chan *c, void *a, long n, int64_t unused)
 }
 
 struct dev regressdevtab __devtab = {
-       "regress",
-
-       devreset,
-       regressinit,
-       devshutdown,
-       regressattach,
-       regresswalk,
-       regressstat,
-       regressopen,
-       devcreate,
-       regressclose,
-       regressread,
-       devbread,
-       regresswrite,
-       devbwrite,
-       devremove,
-       devwstat,
+       .name = "regress",
+
+       .reset = devreset,
+       .init = regressinit,
+       .shutdown = devshutdown,
+       .attach = regressattach,
+       .walk = regresswalk,
+       .stat = regressstat,
+       .open = regressopen,
+       .create = devcreate,
+       .close = regressclose,
+       .read = regressread,
+       .bread = devbread,
+       .write = regresswrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = devwstat,
 };
index a39045a..32c361f 100644 (file)
@@ -471,22 +471,22 @@ static int rootwstat(struct chan *c, uint8_t *m_buf, int m_buf_sz)
 }
 
 struct dev rootdevtab __devtab = {
-       "root",
-       devreset,
-       rootinit,
-       devshutdown,
-       rootattach,
-       rootwalk,
-       rootstat,
-       rootopen,
-       rootcreate,
-       rootclose,
-       rootread,
-       devbread,
-       rootwrite,
-       devbwrite,
-       devremove,
-       rootwstat,
-       devpower,
-       devchaninfo,
+       .name = "root",
+       .reset = devreset,
+       .init = rootinit,
+       .shutdown = devshutdown,
+       .attach = rootattach,
+       .walk = rootwalk,
+       .stat = rootstat,
+       .open = rootopen,
+       .create = rootcreate,
+       .close = rootclose,
+       .read = rootread,
+       .bread = devbread,
+       .write = rootwrite,
+       .bwrite = devbwrite,
+       .remove = devremove,
+       .wstat = rootwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };
index db09385..9fc0f0b 100644 (file)
@@ -330,23 +330,23 @@ static long srvwrite(struct chan *c, void *va, long count, int64_t offset)
 }
 
 struct dev srvdevtab __devtab = {
-       "srv",
+       .name = "srv",
 
-       devreset,
-       srvinit,
-       devshutdown,
-       srvattach,
-       srvwalk,
-       srvstat,
-       srvopen,
-       srvcreate,
-       srvclose,
-       srvread,
-       devbread,
-       srvwrite,
-       devbwrite,
-       srvremove,
-       srvwstat,
-       devpower,
-       devchaninfo,
+       .reset = devreset,
+       .init = srvinit,
+       .shutdown = devshutdown,
+       .attach = srvattach,
+       .walk = srvwalk,
+       .stat = srvstat,
+       .open = srvopen,
+       .create = srvcreate,
+       .close = srvclose,
+       .read = srvread,
+       .bread = devbread,
+       .write = srvwrite,
+       .bwrite = devbwrite,
+       .remove = srvremove,
+       .wstat = srvwstat,
+       .power = devpower,
+       .chaninfo = devchaninfo,
 };