MCPcopy
hub / github.com/cubefs/cubefs / mount

Function mount

client/fuse.go:751–887  ·  view source on GitHub ↗
(opt *proto.MountOptions)

Source from the content-addressed store, hash-verified

749}
750
751func mount(opt *proto.MountOptions) (fsConn *fuse.Conn, super *cfs.Super, err error) {
752 mountPoints, err := getMountPoints()
753 if err != nil {
754 return nil, nil, err
755 }
756
757 for _, mountPoint := range mountPoints {
758 if mountPoint == opt.MountPoint {
759 return nil, nil, errors.NewErrorf("mountpoint:%v has been mounted", opt.MountPoint)
760 }
761 }
762
763 master.BcacheOnlyForNotSSD = opt.EnableBcache && opt.BcacheOnlyForNotSSD
764 super, err = cfs.NewSuper(opt)
765 if err != nil {
766 log.LogError(errors.Stack(err))
767 return
768 }
769
770 http.HandleFunc(ControlCommandSetRate, super.SetRate)
771 http.HandleFunc(ControlCommandGetRate, super.GetRate)
772 http.HandleFunc(log.SetLogLevelPath, log.SetLogLevel)
773 http.HandleFunc(ControlCommandFreeOSMemory, freeOSMemory)
774 http.HandleFunc(ControlCommandMemStats, memStats)
775 http.HandleFunc(log.GetLogPath, log.GetLog)
776 http.HandleFunc(ControlCommandSuspend, super.SetSuspend)
777 http.HandleFunc(ControlCommandResume, super.SetResume)
778 http.HandleFunc(ControlCommandStopWarmMeta, super.SetStopWarmMeta)
779 http.HandleFunc(ControlCommandGetWarmUpMetaPaths, super.GetWarmUpMetaPaths)
780 // auditlog
781 http.HandleFunc(auditlog.EnableAuditLogReqPath, super.EnableAuditLog)
782 http.HandleFunc(auditlog.DisableAuditLogReqPath, auditlog.DisableAuditLog)
783 http.HandleFunc(auditlog.SetAuditLogBufSizeReqPath, auditlog.ResetWriterBuffSize)
784 http.HandleFunc(meta.DisableTrash, super.DisableTrash)
785 http.HandleFunc(meta.QueryTrash, super.QueryTrash)
786
787 statusCh := make(chan error)
788 pprofAddr := ":" + opt.Profport
789 if opt.LocallyProf {
790 pprofAddr = "127.0.0.1:" + opt.Profport
791 }
792 mainMux := http.NewServeMux()
793 mux := http.NewServeMux()
794 mux.Handle("/debug/pprof", http.HandlerFunc(pprof.Index))
795 mux.Handle("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
796 mux.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
797 mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
798 mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
799 mux.Handle("/debug/", http.HandlerFunc(pprof.Index))
800 mainHandler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
801 if strings.HasPrefix(req.URL.Path, "/debug/") {
802 mux.ServeHTTP(w, req)
803 } else {
804 http.DefaultServeMux.ServeHTTP(w, req)
805 }
806 })
807 mainMux.Handle("/", mainHandler)
808

Callers 1

mainFunction · 0.70

Calls 15

NewErrorfFunction · 0.92
LogErrorFunction · 0.92
StackFunction · 0.92
LogDebugfFunction · 0.92
LogErrorfFunction · 0.92
LogFlushFunction · 0.92
IsColdFunction · 0.92
IsStorageClassBlobStoreFunction · 0.92
IsVolSupportStorageClassFunction · 0.92
InitUmpFunction · 0.92
AllowOtherFunction · 0.92

Tested by

no test coverage detected