Skip to content

Commit 93618a3

Browse files
authored
tailscale: update tailfs functions and vars to use drive naming (tailscale#11597)
This change updates all tailfs functions and the majority of the tailfs variables to use the new drive naming. Updates tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
1 parent 2409661 commit 93618a3

File tree

27 files changed

+233
-233
lines changed

27 files changed

+233
-233
lines changed

client/tailscale/localclient.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,25 +1418,25 @@ func (lc *LocalClient) CheckUpdate(ctx context.Context) (*tailcfg.ClientVersion,
14181418
return &cv, nil
14191419
}
14201420

1421-
// TailFSSetFileServerAddr instructs TailFS to use the server at addr to access
1421+
// DriveSetServerAddr instructs Taildrive to use the server at addr to access
14221422
// the filesystem. This is used on platforms like Windows and MacOS to let
1423-
// TailFS know to use the file server running in the GUI app.
1424-
func (lc *LocalClient) TailFSSetFileServerAddr(ctx context.Context, addr string) error {
1423+
// Taildrive know to use the file server running in the GUI app.
1424+
func (lc *LocalClient) DriveSetServerAddr(ctx context.Context, addr string) error {
14251425
_, err := lc.send(ctx, "PUT", "/localapi/v0/tailfs/fileserver-address", http.StatusCreated, strings.NewReader(addr))
14261426
return err
14271427
}
14281428

1429-
// TailFSShareSet adds or updates the given share in the list of shares that
1430-
// TailFS will serve to remote nodes. If a share with the same name already
1429+
// DriveShareSet adds or updates the given share in the list of shares that
1430+
// Taildrive will serve to remote nodes. If a share with the same name already
14311431
// exists, the existing share is replaced/updated.
1432-
func (lc *LocalClient) TailFSShareSet(ctx context.Context, share *drive.Share) error {
1432+
func (lc *LocalClient) DriveShareSet(ctx context.Context, share *drive.Share) error {
14331433
_, err := lc.send(ctx, "PUT", "/localapi/v0/tailfs/shares", http.StatusCreated, jsonBody(share))
14341434
return err
14351435
}
14361436

1437-
// TailFSShareRemove removes the share with the given name from the list of
1438-
// shares that TailFS will serve to remote nodes.
1439-
func (lc *LocalClient) TailFSShareRemove(ctx context.Context, name string) error {
1437+
// DriveShareRemove removes the share with the given name from the list of
1438+
// shares that Taildrive will serve to remote nodes.
1439+
func (lc *LocalClient) DriveShareRemove(ctx context.Context, name string) error {
14401440
_, err := lc.send(
14411441
ctx,
14421442
"DELETE",
@@ -1446,8 +1446,8 @@ func (lc *LocalClient) TailFSShareRemove(ctx context.Context, name string) error
14461446
return err
14471447
}
14481448

1449-
// TailFSShareRename renames the share from old to new name.
1450-
func (lc *LocalClient) TailFSShareRename(ctx context.Context, oldName, newName string) error {
1449+
// DriveShareRename renames the share from old to new name.
1450+
func (lc *LocalClient) DriveShareRename(ctx context.Context, oldName, newName string) error {
14511451
_, err := lc.send(
14521452
ctx,
14531453
"POST",
@@ -1457,9 +1457,9 @@ func (lc *LocalClient) TailFSShareRename(ctx context.Context, oldName, newName s
14571457
return err
14581458
}
14591459

1460-
// TailFSShareList returns the list of shares that TailFS is currently serving
1460+
// DriveShareList returns the list of shares that drive is currently serving
14611461
// to remote nodes.
1462-
func (lc *LocalClient) TailFSShareList(ctx context.Context) ([]*drive.Share, error) {
1462+
func (lc *LocalClient) DriveShareList(ctx context.Context) ([]*drive.Share, error) {
14631463
result, err := lc.get200(ctx, "/localapi/v0/tailfs/shares")
14641464
if err != nil {
14651465
return nil, err

cmd/tailscale/cli/cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ func TestPrefFlagMapping(t *testing.T) {
829829
// Handled by TS_DEBUG_FIREWALL_MODE env var, we don't want to have
830830
// a CLI flag for this. The Pref is used by c2n.
831831
continue
832-
case "TailFSShares":
832+
case "DriveShares":
833833
// Handled by the tailscale share subcommand, we don't want a CLI
834834
// flag for this.
835835
continue

cmd/tailscale/cli/share.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func runShareSet(ctx context.Context, args []string) error {
6969

7070
name, path := args[0], args[1]
7171

72-
err := localClient.TailFSShareSet(ctx, &drive.Share{
72+
err := localClient.DriveShareSet(ctx, &drive.Share{
7373
Name: name,
7474
Path: path,
7575
})
@@ -86,7 +86,7 @@ func runShareRemove(ctx context.Context, args []string) error {
8686
}
8787
name := args[0]
8888

89-
err := localClient.TailFSShareRemove(ctx, name)
89+
err := localClient.DriveShareRemove(ctx, name)
9090
if err == nil {
9191
fmt.Printf("Removed share %q\n", name)
9292
}
@@ -101,7 +101,7 @@ func runShareRename(ctx context.Context, args []string) error {
101101
oldName := args[0]
102102
newName := args[1]
103103

104-
err := localClient.TailFSShareRename(ctx, oldName, newName)
104+
err := localClient.DriveShareRename(ctx, oldName, newName)
105105
if err == nil {
106106
fmt.Printf("Renamed share %q to %q\n", oldName, newName)
107107
}
@@ -114,7 +114,7 @@ func runShareList(ctx context.Context, args []string) error {
114114
return fmt.Errorf("usage: tailscale %v", shareListUsage)
115115
}
116116

117-
shares, err := localClient.TailFSShareList(ctx)
117+
shares, err := localClient.DriveShareList(ctx)
118118
if err != nil {
119119
return err
120120
}

cmd/tailscaled/tailscaled.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ var subCommands = map[string]*func([]string) error{
145145
"uninstall-system-daemon": &uninstallSystemDaemon,
146146
"debug": &debugModeFunc,
147147
"be-child": &beChildFunc,
148-
"serve-tailfs": &serveTailFSFunc,
148+
"serve-tailfs": &serveDriveFunc,
149149
}
150150

151151
var beCLI func() // non-nil if CLI is linked in
@@ -645,12 +645,12 @@ var tstunNew = tstun.New
645645

646646
func tryEngine(logf logger.Logf, sys *tsd.System, name string) (onlyNetstack bool, err error) {
647647
conf := wgengine.Config{
648-
ListenPort: args.port,
649-
NetMon: sys.NetMon.Get(),
650-
Dialer: sys.Dialer.Get(),
651-
SetSubsystem: sys.Set,
652-
ControlKnobs: sys.ControlKnobs(),
653-
TailFSForLocal: driveimpl.NewFileSystemForLocal(logf),
648+
ListenPort: args.port,
649+
NetMon: sys.NetMon.Get(),
650+
Dialer: sys.Dialer.Get(),
651+
SetSubsystem: sys.Set,
652+
ControlKnobs: sys.ControlKnobs(),
653+
DriveForLocal: driveimpl.NewFileSystemForLocal(logf),
654654
}
655655

656656
onlyNetstack = name == "userspace-networking"
@@ -753,7 +753,7 @@ func runDebugServer(mux *http.ServeMux, addr string) {
753753
}
754754

755755
func newNetstack(logf logger.Logf, sys *tsd.System) (*netstack.Impl, error) {
756-
tfs, _ := sys.TailFSForLocal.GetOK()
756+
tfs, _ := sys.DriveForLocal.GetOK()
757757
ret, err := netstack.Create(logf,
758758
sys.Tun.Get(),
759759
sys.Engine.Get(),
@@ -831,16 +831,16 @@ func beChild(args []string) error {
831831
return f(args[1:])
832832
}
833833

834-
var serveTailFSFunc = serveTailFS
834+
var serveDriveFunc = serveDrive
835835

836-
// serveTailFS serves one or more tailfs on localhost using the WebDAV
836+
// serveDrive serves one or more tailfs on localhost using the WebDAV
837837
// protocol. On UNIX and MacOS tailscaled environment, tailfs spawns child
838838
// tailscaled processes in serve-tailfs mode in order to access the fliesystem
839839
// as specific (usually unprivileged) users.
840840
//
841-
// serveTailFS prints the address on which it's listening to stdout so that the
841+
// serveDrive prints the address on which it's listening to stdout so that the
842842
// parent process knows where to connect to.
843-
func serveTailFS(args []string) error {
843+
func serveDrive(args []string) error {
844844
if len(args) == 0 {
845845
return errors.New("missing shares")
846846
}

drive/driveimpl/drive_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func init() {
4141
drive.DisallowShareAs = true
4242
}
4343

44-
// The tests in this file simulate real-life TailFS scenarios, but without
44+
// The tests in this file simulate real-life Taildrive scenarios, but without
4545
// going over the Tailscale network stack.
4646
func TestDirectoryListing(t *testing.T) {
4747
s := newSystem(t)

drive/driveimpl/fileserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
// FileServer is a standalone WebDAV server that dynamically serves up shares.
16-
// It's typically used in a separate process from the actual TailFS server to
16+
// It's typically used in a separate process from the actual Taildrive server to
1717
// serve up files as an unprivileged user.
1818
type FileServer struct {
1919
l net.Listener

drive/driveimpl/local_impl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func NewFileSystemForLocal(logf logger.Logf) *FileSystemForLocal {
4242
return fs
4343
}
4444

45-
// FileSystemForLocal is the TailFS filesystem exposed to local clients. It
46-
// provides a unified WebDAV interface to remote TailFS shares on other nodes.
45+
// FileSystemForLocal is the Taildrive filesystem exposed to local clients. It
46+
// provides a unified WebDAV interface to remote Taildrive shares on other nodes.
4747
type FileSystemForLocal struct {
4848
logf logger.Logf
4949
h *compositedav.Handler

drive/driveimpl/remote_impl.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func NewFileSystemForRemote(logf logger.Logf) *FileSystemForRemote {
4444
return fs
4545
}
4646

47-
// FileSystemForRemote implements tailfs.FileSystemForRemote.
47+
// FileSystemForRemote implements drive.FileSystemForRemote.
4848
type FileSystemForRemote struct {
4949
logf logger.Logf
5050
lockSystem webdav.LockSystem
@@ -58,15 +58,15 @@ type FileSystemForRemote struct {
5858
userServers map[string]*userServer
5959
}
6060

61-
// SetFileServerAddr implements tailfs.FileSystemForRemote.
61+
// SetFileServerAddr implements drive.FileSystemForRemote.
6262
func (s *FileSystemForRemote) SetFileServerAddr(addr string) {
6363
s.mu.Lock()
6464
s.fileServerAddr = addr
6565
s.mu.Unlock()
6666
}
6767

68-
// SetShares implements tailfs.FileSystemForRemote. Shares must be sorted
69-
// according to tailfs.CompareShares.
68+
// SetShares implements drive.FileSystemForRemote. Shares must be sorted
69+
// according to drive.CompareShares.
7070
func (s *FileSystemForRemote) SetShares(shares []*drive.Share) {
7171
userServers := make(map[string]*userServer)
7272
if drive.AllowShareAs() {
@@ -176,7 +176,7 @@ func (s *FileSystemForRemote) buildChild(share *drive.Share) *compositedav.Child
176176
}
177177
}
178178

179-
// ServeHTTPWithPerms implements tailfs.FileSystemForRemote.
179+
// ServeHTTPWithPerms implements drive.FileSystemForRemote.
180180
func (s *FileSystemForRemote) ServeHTTPWithPerms(permissions drive.Permissions, w http.ResponseWriter, r *http.Request) {
181181
isWrite := writeMethods[r.Method]
182182
if isWrite {
@@ -228,7 +228,7 @@ func (s *FileSystemForRemote) closeChildren(children map[string]*compositedav.Ch
228228
}
229229
}
230230

231-
// Close() implements tailfs.FileSystemForRemote.
231+
// Close() implements drive.FileSystemForRemote.
232232
func (s *FileSystemForRemote) Close() error {
233233
s.mu.Lock()
234234
userServers := s.userServers

drive/driveimpl/shared/readonlydir.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Tailscale Inc & AUTHORS
22
// SPDX-License-Identifier: BSD-3-Clause
33

4-
// Package shared contains types and functions shared by different tailfs
4+
// Package shared contains types and functions shared by different drive
55
// packages.
66
package shared
77

drive/local.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// SPDX-License-Identifier: BSD-3-Clause
33

44
// Package drive provides a filesystem that allows sharing folders between
5-
// Tailscale nodes using WebDAV. The actual implementation of the core drive
5+
// Tailscale nodes using WebDAV. The actual implementation of the core Taildrive
66
// functionality lives in package driveimpl. These packages are separated to
7-
// allow users of drive to refer to the interfaces without having a hard
8-
// dependency on drive, so that programs which don't actually use drive can
7+
// allow users of Taildrive to refer to the interfaces without having a hard
8+
// dependency on Taildrive, so that programs which don't actually use Taildrive can
99
// avoid its transitive dependencies.
1010
package drive
1111

@@ -14,15 +14,15 @@ import (
1414
"net/http"
1515
)
1616

17-
// Remote represents a remote TailFS node.
17+
// Remote represents a remote Taildrive node.
1818
type Remote struct {
1919
Name string
2020
URL string
2121
Available func() bool
2222
}
2323

24-
// FileSystemForLocal is the TailFS filesystem exposed to local clients. It
25-
// provides a unified WebDAV interface to remote TailFS shares on other nodes.
24+
// FileSystemForLocal is the Taildrive filesystem exposed to local clients. It
25+
// provides a unified WebDAV interface to remote Taildrive shares on other nodes.
2626
type FileSystemForLocal interface {
2727
// HandleConn handles connections from local WebDAV clients
2828
HandleConn(conn net.Conn, remoteAddr net.Addr) error

0 commit comments

Comments
 (0)