9p: move job script to b/; remove job from s/ sessionStoreFiles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-18 12:14:09 +02:00
parent 0c3f4e8e4a
commit 4a42002a0f
2 changed files with 10 additions and 10 deletions

View File

@ -339,7 +339,7 @@ func (s *Server) pathType(path string) string {
return "dir"
case len(parts) == 2 && parts[0] == "b":
switch parts[1] {
case "new", "idx", "q", "sched":
case "new", "idx", "job", "q", "sched":
return "file"
default:
if _, err := s.batchStore.Stat(parts[1]); err == nil {
@ -575,7 +575,7 @@ func (s *Server) read(cs *connState, fc *plan9.Fcall) *plan9.Fcall {
}
return s.readSlice(fc, content)
}
if path == "/b/q" || path == "/b/sched" {
if path == "/b/job" || path == "/b/q" || path == "/b/sched" {
plog.Debug("Tread path=%q offset=%d count=%d", path, fc.Offset, fc.Count)
content, err := os.ReadFile(paths.CfgDir() + "/scripts/b/" + pathBase(path))
if err != nil {
@ -1390,6 +1390,7 @@ func (s *Server) readDir(path string, offset uint64, count uint32) []byte {
dirs = append(dirs, makeDir(e.Name(), "/u/"+e.Name(), false, 0555))
}
} else if path == "/b" {
dirs = append(dirs, makeDir("job", "/b/job", false, 0555))
dirs = append(dirs, makeDir("q", "/b/q", false, 0555))
dirs = append(dirs, makeDir("sched", "/b/sched", false, 0555))
entries, _ := s.batchStore.List()
@ -1518,7 +1519,7 @@ func (s *Server) makeStat(path string) plan9.Dir {
mode = 0777
} else if strings.HasPrefix(path, "/u/") {
mode = 0555
} else if path == "/b/q" || path == "/b/sched" {
} else if path == "/b/job" || path == "/b/q" || path == "/b/sched" {
mode = 0555
} else {
mode = 0444
@ -1605,7 +1606,7 @@ func (s *Server) makeStat(path string) plan9.Dir {
if content, err := s.utilStore.Get(base); err == nil {
dir.Length = uint64(len(content))
}
case path == "/b/q" || path == "/b/sched":
case path == "/b/job" || path == "/b/q" || path == "/b/sched":
if content, err := os.ReadFile(paths.CfgDir() + "/scripts/b/" + base); err == nil {
dir.Length = uint64(len(content))
}

View File

@ -12,16 +12,15 @@ import (
// Add an entry here to expose a new file; the server uses this map for
// routing, mode, and stat length.
var sessionStoreFiles = map[string]os.FileMode{
"new": 0666,
"idx": 0444,
"ls": 0555,
"new": 0666,
"idx": 0444,
"ls": 0555,
"kill": 0555,
"sh": 0555,
"job": 0555,
"sh": 0555,
}
// sessionStoreOrder defines the listing order for fixed s/ entries.
var sessionStoreOrder = []string{"new", "idx", "ls", "kill", "sh", "job"}
var sessionStoreOrder = []string{"new", "idx", "ls", "kill", "sh"}
// SessionStore implements Store for the /s/ directory.
// Entries are session IDs (directories) plus the synthetic files "new" and "idx".