示例#1
0
func main() {
	var err *p.Error

	flag.Parse()

	err = root.Add(nil, "/", user, nil, p.DMDIR|0777, nil)
	if err != nil {
		goto error
	}
	var ctl = new(Ctl)
	ctl.status = new(bytes.Buffer)
	ctl.parent = root
	err = ctl.Add(root, "in", user, nil, 0666, ctl)
	if err != nil {
		goto error
	}

	s := srv.NewFileSrv(root)
	s.Dotu = false

	if *debug {
		s.Debuglevel = 1
	}

	s.Start(s)
	err = s.StartNetListener("tcp", *addr)
	if err != nil {
		goto error
	}
	return

error:
	fmt.Println(fmt.Sprintf("Error: %s %d", err.Error, err.Errornum))
}
示例#2
0
文件: srv.go 项目: cmars/replican-r9p
func NewStoreSrv(local *fs.LocalStore) (storeSrv *StoreSrv, err os.Error) {
	user := p.OsUsers.Uid2User(os.Geteuid())

	root := new(srv.File)
	err = root.Add(nil, "/", user, nil, p.DMDIR|0555, nil)

	noderoot := &RootFile{store: local}
	err = noderoot.Add(root, r9p.ROOT_FILE, user, nil, 0444, noderoot)

	strongdir := &StrongDir{store: local, File: new(srv.File)}
	err = strongdir.Add(root, r9p.STRONG_DIR, user, nil, p.DMDIR|0555, strongdir)

	storeSrv = &StoreSrv{
		local: local,
		user:  user}
	storeSrv.Fsrv = srv.NewFileSrv(root)

	return storeSrv, nil
}