/* * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ /* * Stub. */ #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "../port/error.h" extern Dev* devtab[]; void devtabreset(void) { int i; for(i = 0; devtab[i] != nil; i++) { devtab[i]->reset(); } } void devtabinit(void) { int i; for(i = 0; devtab[i] != nil; i++) { devtab[i]->init(); } } void devtabshutdown(void) { int i; /* * Shutdown in reverse order. */ for(i = 0; devtab[i] != nil; i++) ; for(i--; i >= 0; i--) devtab[i]->shutdown(); } Dev* devtabget(int dc, int user) { int i; for(i = 0; devtab[i] != nil; i++){ if(devtab[i]->dc == dc) return devtab[i]; } if(user == 0) panic("devtabget %C\n", dc); return nil; } int32_t devtabread(Chan* c, void* buf, int32_t n, int64_t off) { Proc *up = externup(); int i; Dev *dev; char *alloc, *e, *p; alloc = malloc(READSTR); if(alloc == nil) error(Enomem); p = alloc; e = p + READSTR; for(i = 0; devtab[i] != nil; i++){ dev = devtab[i]; p = seprint(p, e, "#%C %s\n", dev->dc, dev->name); } if(waserror()){ free(alloc); nexterror(); } n = readstr(off, buf, n, alloc); free(alloc); poperror(); return n; }