123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /*
- * 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.
- */
- #include <u.h>
- #include <libc.h>
- #include <fcall.h>
- #include <thread.h>
- #include <9p.h>
- #include "dat.h"
- #include "fns.h"
- #include "errstr.h"
- int errno;
- int rdonly;
- char *srvfile;
- char *deffile;
- extern void iobuf_init(void);
- extern Srv ext2srv;
- void
- usage(void)
- {
- fprint(2, "usage: %s [-v] [-s] [-r] [-p passwd] [-g group] [-f devicefile] [srvname]\n", argv0);
- exits("usage");
- }
- /*void handler(void *v, char *sig)
- {
- USED(v,sig);
- syncbuf();
- noted(NDFLT);
- }*/
- void
- main(int argc, char **argv)
- {
- int stdio;
- stdio = 0;
- ARGBEGIN{
- case 'D':
- ++chatty9p;
- break;
- case 'v':
- ++chatty;
- break;
- case 'f':
- deffile = ARGF();
- break;
- case 'g':
- gidfile(ARGF());
- break;
- case 'p':
- uidfile(ARGF());
- break;
- case 's':
- stdio = 1;
- break;
- case 'r':
- rdonly = 1;
- break;
- default:
- usage();
- }ARGEND
- if(argc == 0)
- srvfile = "ext2";
- else if(argc == 1)
- srvfile = argv[0];
- else
- usage();
- iobuf_init();
- /*notify(handler);*/
- if(!chatty){
- close(2);
- open("#c/cons", OWRITE);
- }
- if(stdio){
- srv(&ext2srv);
- }else{
- chat("%s %d: serving %s\n", argv0, getpid(), srvfile);
- postmountsrv(&ext2srv, srvfile, 0, 0);
- }
- exits(0);
- }
- char *
- xerrstr(int e)
- {
- if (e < 0 || e >= sizeof errmsg/sizeof errmsg[0])
- return "no such error";
- else
- return errmsg[e];
- }
|