Skip to content

Commit 9e01ffd

Browse files
authored
Rename option to 'passive' and add some example in manual. (#232)
1 parent de0504e commit 9e01ffd

2 files changed

Lines changed: 27 additions & 23 deletions

File tree

sshfs.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ struct sshfs {
341341
int foreground;
342342
int reconnect;
343343
int delay_connect;
344-
int slave;
344+
int passive;
345345
char *host;
346346
char *base_path;
347347
GHashTable *reqtab;
@@ -351,7 +351,7 @@ struct sshfs {
351351
int max_conns;
352352
struct conn *conns;
353353
int ptyfd;
354-
int ptyslavefd;
354+
int ptypassivefd;
355355
int connvers;
356356
int server_version;
357357
unsigned remote_uid;
@@ -497,7 +497,8 @@ static struct fuse_opt sshfs_opts[] = {
497497
SSHFS_OPT("no_check_root", no_check_root, 1),
498498
SSHFS_OPT("password_stdin", password_stdin, 1),
499499
SSHFS_OPT("delay_connect", delay_connect, 1),
500-
SSHFS_OPT("slave", slave, 1),
500+
SSHFS_OPT("slave", passive, 1),
501+
SSHFS_OPT("passive", passive, 1),
501502
SSHFS_OPT("disable_hardlink", disable_hardlink, 1),
502503
SSHFS_OPT("dir_cache=yes", dir_cache, 1),
503504
SSHFS_OPT("dir_cache=no", dir_cache, 0),
@@ -1147,8 +1148,8 @@ static int start_ssh(struct conn *conn)
11471148
if (sshfs.ptyfd == -1)
11481149
return -1;
11491150

1150-
sshfs.ptyslavefd = open(ptyname, O_RDWR | O_NOCTTY);
1151-
if (sshfs.ptyslavefd == -1)
1151+
sshfs.ptypassivefd = open(ptyname, O_RDWR | O_NOCTTY);
1152+
if (sshfs.ptypassivefd == -1)
11521153
return -1;
11531154
}
11541155

@@ -1207,7 +1208,7 @@ static int start_ssh(struct conn *conn)
12071208
_exit(1);
12081209
}
12091210
close(sfd);
1210-
close(sshfs.ptyslavefd);
1211+
close(sshfs.ptypassivefd);
12111212
close(sshfs.ptyfd);
12121213
}
12131214

@@ -1231,7 +1232,7 @@ static int start_ssh(struct conn *conn)
12311232
return 0;
12321233
}
12331234

1234-
static int connect_slave(struct conn *conn)
1235+
static int connect_passive(struct conn *conn)
12351236
{
12361237
conn->rfd = STDIN_FILENO;
12371238
conn->wfd = STDOUT_FILENO;
@@ -1538,9 +1539,9 @@ static void close_conn(struct conn *conn)
15381539
close(sshfs.ptyfd);
15391540
sshfs.ptyfd = -1;
15401541
}
1541-
if (sshfs.ptyslavefd != -1) {
1542-
close(sshfs.ptyslavefd);
1543-
sshfs.ptyslavefd = -1;
1542+
if (sshfs.ptypassivefd != -1) {
1543+
close(sshfs.ptypassivefd);
1544+
sshfs.ptypassivefd = -1;
15441545
}
15451546
}
15461547

@@ -1831,8 +1832,8 @@ static int connect_remote(struct conn *conn)
18311832
{
18321833
int err;
18331834

1834-
if (sshfs.slave)
1835-
err = connect_slave(conn);
1835+
if (sshfs.passive)
1836+
err = connect_passive(conn);
18361837
else if (sshfs.directport)
18371838
err = connect_to(conn, sshfs.host, sshfs.directport);
18381839
else
@@ -3636,7 +3637,7 @@ static void usage(const char *progname)
36363637
" -o ssh_protocol=N ssh protocol to use (default: 2)\n"
36373638
" -o sftp_server=SERV path to sftp server or subsystem (default: sftp)\n"
36383639
" -o directport=PORT directly connect to PORT bypassing ssh\n"
3639-
" -o slave communicate over stdin and stdout bypassing network\n"
3640+
" -o passive communicate over stdin and stdout bypassing network\n"
36403641
" -o disable_hardlink link(2) will return with errno set to ENOSYS\n"
36413642
" -o transform_symlinks transform absolute symlinks to relative\n"
36423643
" -o follow_symlinks follow symlinks on the server\n"
@@ -4189,9 +4190,9 @@ int main(int argc, char *argv[])
41894190
sshfs.show_version = 0;
41904191
sshfs.singlethread = 0;
41914192
sshfs.foreground = 0;
4192-
sshfs.ptyslavefd = -1;
4193+
sshfs.ptypassivefd = -1;
41934194
sshfs.delay_connect = 0;
4194-
sshfs.slave = 0;
4195+
sshfs.passive = 0;
41954196
sshfs.detect_uid = 0;
41964197
if (strcmp(IDMAP_DEFAULT, "none") == 0) {
41974198
sshfs.idmap = IDMAP_NONE;
@@ -4257,12 +4258,12 @@ int main(int argc, char *argv[])
42574258
DEBUG("SSHFS version %s\n", PACKAGE_VERSION);
42584259

42594260
/* Force sshfs to the foreground when using stdin+stdout */
4260-
if (sshfs.slave)
4261+
if (sshfs.passive)
42614262
sshfs.foreground = 1;
42624263

42634264

4264-
if (sshfs.slave && sshfs.password_stdin) {
4265-
fprintf(stderr, "the password_stdin and slave options cannot both be specified\n");
4265+
if (sshfs.passive && sshfs.password_stdin) {
4266+
fprintf(stderr, "the password_stdin and passive options cannot both be specified\n");
42664267
exit(1);
42674268
}
42684269

@@ -4294,8 +4295,8 @@ int main(int argc, char *argv[])
42944295
exit(1);
42954296
}
42964297

4297-
if (sshfs.slave) {
4298-
fprintf(stderr, "slave option cannot be specified with parallel connections\n");
4298+
if (sshfs.passive) {
4299+
fprintf(stderr, "passive option cannot be specified with parallel connections\n");
42994300
exit(1);
43004301
}
43014302
} else if (sshfs.max_conns <= 0) {

sshfs.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ Options
156156
-o directport=PORT
157157
directly connect to PORT bypassing ssh
158158

159-
-o slave
160-
communicate over stdin and stdout bypassing network
159+
-o passive
160+
communicate over stdin and stdout bypassing network. Useful for
161+
mounting local filesystem on the remote side. An example using
162+
dpipe command would be ``dpipe /usr/lib/openssh/sftp-server = ssh
163+
RemoteHostname sshfs :/directory/to/be/shared ~/mnt/src -o passive``
161164

162165
-o disable_hardlink
163166
With this option set, attempts to call `link(2)` will fail with
@@ -223,7 +226,7 @@ Options
223226
to use. Each connection is established with a separate SSH process.
224227
The primary purpose of this feature is to improve the responsiveness of the
225228
file system during large file transfers. When using more than once
226-
connection, the *password_stdin* and *slave* options can not be
229+
connection, the *password_stdin* and *passive* options can not be
227230
used, and the *buflimit* workaround is not supported.
228231

229232
In addition, SSHFS accepts several options common to all FUSE file

0 commit comments

Comments
 (0)