summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2019-05-08 21:30:12 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2019-05-08 21:30:12 +0000
commitb3dccd82855f217c000b0302e0315b5af977be84 (patch)
treef28f1cb76c6ba40450e98a945eac1145dc9891e3 /usr.bin
parent967717226afa6bb06671dd62b0e880697742e3b7 (diff)
remove sess argument from all functions that only used it for logging
functions. ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rsync/Makefile4
-rw-r--r--usr.bin/rsync/blocks.c38
-rw-r--r--usr.bin/rsync/downloader.c19
-rw-r--r--usr.bin/rsync/extern.h34
-rw-r--r--usr.bin/rsync/flist.c37
-rw-r--r--usr.bin/rsync/ids.c5
-rw-r--r--usr.bin/rsync/io.c61
-rw-r--r--usr.bin/rsync/mkpath.c4
-rw-r--r--usr.bin/rsync/mktemp.c4
-rw-r--r--usr.bin/rsync/receiver.c9
-rw-r--r--usr.bin/rsync/sender.c8
-rw-r--r--usr.bin/rsync/server.c8
-rw-r--r--usr.bin/rsync/socket.c10
-rw-r--r--usr.bin/rsync/symlinks.c6
-rw-r--r--usr.bin/rsync/uploader.c34
15 files changed, 131 insertions, 150 deletions
diff --git a/usr.bin/rsync/Makefile b/usr.bin/rsync/Makefile
index 8bb82588520..d7af8bd0a87 100644
--- a/usr.bin/rsync/Makefile
+++ b/usr.bin/rsync/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.9 2019/04/02 05:32:08 deraadt Exp $
+# $OpenBSD: Makefile,v 1.10 2019/05/08 21:30:11 benno Exp $
PROG= openrsync
SRCS= blocks.c client.c downloader.c fargs.c flist.c hash.c ids.c \
@@ -8,7 +8,7 @@ LDADD+= -lcrypto -lm
DPADD+= ${LIBCRYPTO} ${LIBM}
MAN= openrsync.1
-CFLAGS+=-g -W -Wall -Wextra -Wno-unused-parameter
+CFLAGS+=-g -W -Wall -Wextra
openrsync.1: rsync.1
ln -sf ${.CURDIR}/rsync.1 openrsync.1
diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c
index 603a7b4a971..f6a3575caab 100644
--- a/usr.bin/rsync/blocks.c
+++ b/usr.bin/rsync/blocks.c
@@ -1,4 +1,4 @@
-/* $Id: blocks.c,v 1.15 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: blocks.c,v 1.16 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -206,8 +206,7 @@ blk_match(struct sess *sess, const struct blkset *blks,
* Symmetrises blk_send_ack().
*/
void
-blk_recv_ack(struct sess *sess, char buf[20],
- const struct blkset *blocks, int32_t idx)
+blk_recv_ack(char buf[20], const struct blkset *blocks, int32_t idx)
{
size_t pos = 0, sz;
@@ -218,11 +217,11 @@ blk_recv_ack(struct sess *sess, char buf[20],
sizeof(int32_t); /* block remainder */
assert(sz == 20);
- io_buffer_int(sess, buf, &pos, sz, idx);
- io_buffer_int(sess, buf, &pos, sz, blocks->blksz);
- io_buffer_int(sess, buf, &pos, sz, blocks->len);
- io_buffer_int(sess, buf, &pos, sz, blocks->csum);
- io_buffer_int(sess, buf, &pos, sz, blocks->rem);
+ io_buffer_int(buf, &pos, sz, idx);
+ io_buffer_int(buf, &pos, sz, blocks->blksz);
+ io_buffer_int(buf, &pos, sz, blocks->len);
+ io_buffer_int(buf, &pos, sz, blocks->csum);
+ io_buffer_int(buf, &pos, sz, blocks->rem);
assert(pos == sz);
}
@@ -348,13 +347,13 @@ blk_send_ack(struct sess *sess, int fd, struct blkset *p)
return 0;
}
- if (!io_unbuffer_size(sess, buf, &pos, sz, &p->blksz))
+ if (!io_unbuffer_size(buf, &pos, sz, &p->blksz))
ERRX1("io_unbuffer_size");
- else if (!io_unbuffer_size(sess, buf, &pos, sz, &p->len))
+ else if (!io_unbuffer_size(buf, &pos, sz, &p->len))
ERRX1("io_unbuffer_size");
- else if (!io_unbuffer_size(sess, buf, &pos, sz, &p->csum))
+ else if (!io_unbuffer_size(buf, &pos, sz, &p->csum))
ERRX1("io_unbuffer_size");
- else if (!io_unbuffer_size(sess, buf, &pos, sz, &p->rem))
+ else if (!io_unbuffer_size(buf, &pos, sz, &p->rem))
ERRX1("io_unbuffer_size");
else if (p->len && p->rem >= p->len)
ERRX1("non-zero length is less than remainder");
@@ -394,17 +393,16 @@ blk_send(struct sess *sess, int fd, size_t idx,
return 0;
}
- io_buffer_int(sess, buf, &pos, sz, idx);
- io_buffer_int(sess, buf, &pos, sz, p->blksz);
- io_buffer_int(sess, buf, &pos, sz, p->len);
- io_buffer_int(sess, buf, &pos, sz, p->csum);
- io_buffer_int(sess, buf, &pos, sz, p->rem);
+ io_buffer_int(buf, &pos, sz, idx);
+ io_buffer_int(buf, &pos, sz, p->blksz);
+ io_buffer_int(buf, &pos, sz, p->len);
+ io_buffer_int(buf, &pos, sz, p->csum);
+ io_buffer_int(buf, &pos, sz, p->rem);
for (i = 0; i < p->blksz; i++) {
- io_buffer_int(sess, buf, &pos,
+ io_buffer_int(buf, &pos,
sz, p->blks[i].chksum_short);
- io_buffer_buf(sess, buf, &pos, sz,
- p->blks[i].chksum_long, p->csum);
+ io_buffer_buf(buf, &pos, sz, p->blks[i].chksum_long, p->csum);
}
assert(pos == sz);
diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c
index 918272e1e29..9ddb8600a73 100644
--- a/usr.bin/rsync/downloader.c
+++ b/usr.bin/rsync/downloader.c
@@ -1,4 +1,4 @@
-/* $Id: downloader.c,v 1.20 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: downloader.c,v 1.21 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -222,8 +222,7 @@ download_free(struct download *p)
* Returns zero on failure, non-zero on success.
*/
static int
-buf_copy(struct sess *sess,
- const char *buf, size_t sz, struct download *p)
+buf_copy(const char *buf, size_t sz, struct download *p)
{
size_t rem, tocopy;
ssize_t ssz;
@@ -414,8 +413,8 @@ rsync_downloader(struct download *p, struct sess *sess, int *ofd)
/* Create the temporary file. */
- if (mktemplate(sess, &p->fname,
- f->path, sess->opts->recursive) == -1) {
+ if (mktemplate(&p->fname, f->path, sess->opts->recursive) ==
+ -1) {
ERRX1("mktemplate");
goto out;
}
@@ -467,7 +466,7 @@ again:
if (!io_read_buf(sess, p->fdin, buf, sz)) {
ERRX1("io_read_int");
goto out;
- } else if (!buf_copy(sess, buf, sz, p)) {
+ } else if (!buf_copy(buf, sz, p)) {
ERRX1("buf_copy");
goto out;
}
@@ -479,7 +478,7 @@ again:
/* Fast-track more reads as they arrive. */
- if ((c = io_read_check(sess, p->fdin)) < 0) {
+ if ((c = io_read_check(p->fdin)) < 0) {
ERRX1("io_read_check");
goto out;
} else if (c > 0)
@@ -507,7 +506,7 @@ again:
*/
assert(p->map != MAP_FAILED);
- if (!buf_copy(sess, buf, sz, p)) {
+ if (!buf_copy(buf, sz, p)) {
ERRX1("buf_copy");
goto out;
}
@@ -517,7 +516,7 @@ again:
/* Fast-track more reads as they arrive. */
- if ((c = io_read_check(sess, p->fdin)) < 0) {
+ if ((c = io_read_check(p->fdin)) < 0) {
ERRX1("io_read_check");
goto out;
} else if (c > 0)
@@ -526,7 +525,7 @@ again:
return 1;
}
- if (!buf_copy(sess, NULL, 0, p)) {
+ if (!buf_copy(NULL, 0, p)) {
ERRX1("buf_copy");
goto out;
}
diff --git a/usr.bin/rsync/extern.h b/usr.bin/rsync/extern.h
index a615cbb6b03..f6404ec807f 100644
--- a/usr.bin/rsync/extern.h
+++ b/usr.bin/rsync/extern.h
@@ -1,4 +1,4 @@
-/* $Id: extern.h,v 1.29 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: extern.h,v 1.30 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -275,7 +275,7 @@ char **fargs_cmdline(struct sess *, const struct fargs *, size_t *);
int io_read_buf(struct sess *, int, void *, size_t);
int io_read_byte(struct sess *, int, uint8_t *);
-int io_read_check(struct sess *, int);
+int io_read_check(int);
int io_read_flush(struct sess *, int);
int io_read_int(struct sess *, int, int32_t *);
int io_read_uint(struct sess *, int, uint32_t *);
@@ -297,17 +297,13 @@ void io_lowbuffer_int(struct sess *, void *,
void io_lowbuffer_buf(struct sess *, void *,
size_t *, size_t, const void *, size_t);
-void io_buffer_int(struct sess *, void *,
- size_t *, size_t, int32_t);
-void io_buffer_buf(struct sess *, void *,
- size_t *, size_t, const void *, size_t);
+void io_buffer_int(void *, size_t *, size_t, int32_t);
+void io_buffer_buf(void *, size_t *, size_t, const void *, size_t);
-void io_unbuffer_int(struct sess *, const void *,
+void io_unbuffer_int(const void *,
size_t *, size_t, int32_t *);
-int io_unbuffer_size(struct sess *, const void *,
- size_t *, size_t, size_t *);
-void io_unbuffer_buf(struct sess *, const void *,
- size_t *, size_t, void *, size_t);
+int io_unbuffer_size(const void *, size_t *, size_t, size_t *);
+void io_unbuffer_buf(const void *, size_t *, size_t, void *, size_t);
int rsync_receiver(struct sess *, int, int, const char *);
int rsync_sender(struct sess *, int, int, size_t, char **);
@@ -328,13 +324,12 @@ int rsync_uploader_tail(struct upload *, struct sess *);
struct download *download_alloc(struct sess *, int,
const struct flist *, size_t, int);
void download_free(struct download *);
-struct upload *upload_alloc(struct sess *, const char *, int, int, size_t,
+struct upload *upload_alloc(const char *, int, int, size_t,
const struct flist *, size_t, mode_t);
void upload_free(struct upload *);
struct blkset *blk_recv(struct sess *, int, const char *);
-void blk_recv_ack(struct sess *,
- char [20], const struct blkset *, int32_t);
+void blk_recv_ack(char [20], const struct blkset *, int32_t);
void blk_match(struct sess *, const struct blkset *,
const char *, struct blkstat *);
int blk_send(struct sess *, int, size_t,
@@ -347,23 +342,22 @@ void hash_slow(const void *, size_t,
void hash_file(const void *, size_t,
unsigned char *, const struct sess *);
-int mkpath(struct sess *, char *);
+int mkpath(char *);
int mkstempat(int, char *);
char *mkstemplinkat(char*, int, char *);
char *mkstempfifoat(int, char *);
char *mkstempnodat(int, char *, mode_t, dev_t);
char *mkstempsock(const char *, char *);
-int mktemplate(struct sess *, char **, const char *, int);
+int mktemplate(char **, const char *, int);
-char *symlink_read(struct sess *, const char *);
-char *symlinkat_read(struct sess *, int, const char *);
+char *symlink_read(const char *);
+char *symlinkat_read(int, const char *);
int sess_stats_send(struct sess *, int);
int sess_stats_recv(struct sess *, int);
-int idents_add(struct sess *, int, struct ident **, size_t *,
- int32_t);
+int idents_add(int, struct ident **, size_t *, int32_t);
void idents_assign_gid(struct sess *,
struct flist *, size_t, const struct ident *, size_t);
void idents_assign_uid(struct sess *,
diff --git a/usr.bin/rsync/flist.c b/usr.bin/rsync/flist.c
index 0c2fd17237b..f8a6f00a149 100644
--- a/usr.bin/rsync/flist.c
+++ b/usr.bin/rsync/flist.c
@@ -1,4 +1,4 @@
-/* $Id: flist.c,v 1.25 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: flist.c,v 1.26 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2019 Florian Obser <florian@openbsd.org>
@@ -68,7 +68,7 @@ flist_cmp(const void *p1, const void *p2)
* Returns zero on failure, non-zero on success.
*/
static int
-flist_dedupe(struct sess *sess, struct flist **fl, size_t *sz)
+flist_dedupe(struct flist **fl, size_t *sz)
{
size_t i, j;
struct flist *new;
@@ -282,7 +282,7 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl,
*/
if (sess->mplex_reads &&
- io_read_check(sess, fdin) &&
+ io_read_check(fdin) &&
!io_read_flush(sess, fdin)) {
ERRX1("io_read_flush");
goto out;
@@ -334,7 +334,7 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl,
ERRX1("io_write_uint");
goto out;
}
- if (!idents_add(sess, 0, &uids, &uidsz, f->st.uid)) {
+ if (!idents_add(0, &uids, &uidsz, f->st.uid)) {
ERRX1("idents_add");
goto out;
}
@@ -347,7 +347,7 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl,
ERRX1("io_write_uint");
goto out;
}
- if (!idents_add(sess, 1, &gids, &gidsz, f->st.gid)) {
+ if (!idents_add(1, &gids, &gidsz, f->st.gid)) {
ERRX1("idents_add");
goto out;
}
@@ -514,7 +514,7 @@ flist_recv_name(struct sess *sess, int fd, struct flist *f, uint8_t flags,
* Returns zero on failure, non-zero on success.
*/
static int
-flist_realloc(struct sess *sess, struct flist **fl, size_t *sz, size_t *max)
+flist_realloc(struct flist **fl, size_t *sz, size_t *max)
{
void *pp;
@@ -541,8 +541,7 @@ flist_realloc(struct sess *sess, struct flist **fl, size_t *sz, size_t *max)
* Returns zero on failure, non-zero on success.
*/
static int
-flist_append(struct sess *sess, struct flist *f, struct stat *st,
- const char *path)
+flist_append(struct flist *f, struct stat *st, const char *path)
{
/*
@@ -571,7 +570,7 @@ flist_append(struct sess *sess, struct flist *f, struct stat *st,
/* Optionally copy link information. */
if (S_ISLNK(st->st_mode)) {
- f->link = symlink_read(sess, f->path);
+ f->link = symlink_read(f->path);
if (f->link == NULL) {
ERRX1("symlink_read");
return 0;
@@ -609,7 +608,7 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz)
} else if (flag == 0)
break;
- if (!flist_realloc(sess, &fl, &flsz, &flmax)) {
+ if (!flist_realloc(&fl, &flsz, &flmax)) {
ERRX1("flist_realloc");
goto out;
}
@@ -824,14 +823,14 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz,
ERR("%s: lstat", root);
return 0;
} else if (S_ISREG(st.st_mode)) {
- if (!flist_realloc(sess, fl, sz, max)) {
+ if (!flist_realloc(fl, sz, max)) {
ERRX1("flist_realloc");
return 0;
}
f = &(*fl)[(*sz) - 1];
assert(f != NULL);
- if (!flist_append(sess, f, &st, root)) {
+ if (!flist_append(f, &st, root)) {
ERRX1("flist_append");
return 0;
}
@@ -844,14 +843,14 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz,
if (!sess->opts->preserve_links) {
WARNX("%s: skipping symlink", root);
return 1;
- } else if (!flist_realloc(sess, fl, sz, max)) {
+ } else if (!flist_realloc(fl, sz, max)) {
ERRX1("flist_realloc");
return 0;
}
f = &(*fl)[(*sz) - 1];
assert(f != NULL);
- if (!flist_append(sess, f, &st, root)) {
+ if (!flist_append(f, &st, root)) {
ERRX1("flist_append");
return 0;
}
@@ -958,7 +957,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz,
/* Allocate a new file entry. */
- if (!flist_realloc(sess, fl, sz, max)) {
+ if (!flist_realloc(fl, sz, max)) {
ERRX1("flist_realloc");
goto out;
}
@@ -986,7 +985,7 @@ flist_gen_dirent(struct sess *sess, char *root, struct flist **fl, size_t *sz,
/* Optionally copy link information. */
if (S_ISLNK(ent->fts_statp->st_mode)) {
- f->link = symlink_read(sess, f->path);
+ f->link = symlink_read(f->path);
if (f->link == NULL) {
ERRX1("symlink_read");
goto out;
@@ -1102,7 +1101,7 @@ flist_gen_files(struct sess *sess, size_t argc, char **argv,
ERR("%s: unveil", argv[i]);
goto out;
}
- if (!flist_append(sess, f, &st, argv[i])) {
+ if (!flist_append(f, &st, argv[i])) {
ERRX1("flist_append");
goto out;
}
@@ -1149,7 +1148,7 @@ flist_gen(struct sess *sess, size_t argc, char **argv, struct flist **flp,
qsort(*flp, *sz, sizeof(struct flist), flist_cmp);
- if (flist_dedupe(sess, flp, sz)) {
+ if (flist_dedupe(flp, sz)) {
flist_topdirs(sess, *flp, *sz);
return 1;
}
@@ -1333,7 +1332,7 @@ flist_gen_dels(struct sess *sess, const char *root, struct flist **fl,
/* Not found: we'll delete it. */
- if (!flist_realloc(sess, fl, sz, &max)) {
+ if (!flist_realloc(fl, sz, &max)) {
ERRX1("flist_realloc");
goto out;
}
diff --git a/usr.bin/rsync/ids.c b/usr.bin/rsync/ids.c
index 3ab46125f82..a4b7480044c 100644
--- a/usr.bin/rsync/ids.c
+++ b/usr.bin/rsync/ids.c
@@ -1,4 +1,4 @@
-/* $Id: ids.c,v 1.12 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: ids.c,v 1.13 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -155,8 +155,7 @@ idents_remap(struct sess *sess, int isgid, struct ident *ids, size_t idsz)
* Return zero on failure, non-zero on success.
*/
int
-idents_add(struct sess *sess, int isgid,
- struct ident **ids, size_t *idsz, int32_t id)
+idents_add(int isgid, struct ident **ids, size_t *idsz, int32_t id)
{
struct group *grp;
struct passwd *usr;
diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c
index be6dc4f0ecc..18e483af259 100644
--- a/usr.bin/rsync/io.c
+++ b/usr.bin/rsync/io.c
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.16 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: io.c,v 1.17 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -33,7 +33,7 @@
* Returns <0 on failure, 0 if there's no data, >0 if there is.
*/
int
-io_read_check(struct sess *sess, int fd)
+io_read_check(int fd)
{
struct pollfd pfd;
@@ -53,7 +53,7 @@ io_read_check(struct sess *sess, int fd)
* On success, fills in "sz" with the amount written.
*/
static int
-io_write_nonblocking(struct sess *sess, int fd, const void *buf, size_t bsz,
+io_write_nonblocking(int fd, const void *buf, size_t bsz,
size_t *sz)
{
struct pollfd pfd;
@@ -103,13 +103,13 @@ io_write_nonblocking(struct sess *sess, int fd, const void *buf, size_t bsz,
* Returns 0 on failure, non-zero on success (all bytes written).
*/
static int
-io_write_blocking(struct sess *sess, int fd, const void *buf, size_t sz)
+io_write_blocking(int fd, const void *buf, size_t sz)
{
size_t wsz;
int c;
while (sz > 0) {
- c = io_write_nonblocking(sess, fd, buf, sz, &wsz);
+ c = io_write_nonblocking(fd, buf, sz, &wsz);
if (!c) {
ERRX1("io_write_nonblocking");
return 0;
@@ -137,7 +137,7 @@ io_write_buf(struct sess *sess, int fd, const void *buf, size_t sz)
int c;
if (!sess->mplex_writes) {
- c = io_write_blocking(sess, fd, buf, sz);
+ c = io_write_blocking(fd, buf, sz);
sess->total_write += sz;
return c;
}
@@ -146,11 +146,11 @@ io_write_buf(struct sess *sess, int fd, const void *buf, size_t sz)
wsz = sz & 0xFFFFFF;
tag = (7 << 24) + wsz;
tagbuf = htole32(tag);
- if (!io_write_blocking(sess, fd, &tagbuf, sizeof(tagbuf))) {
+ if (!io_write_blocking(fd, &tagbuf, sizeof(tagbuf))) {
ERRX1("io_write_blocking");
return 0;
}
- if (!io_write_blocking(sess, fd, buf, wsz)) {
+ if (!io_write_blocking(fd, buf, wsz)) {
ERRX1("io_write_blocking");
return 0;
}
@@ -185,8 +185,7 @@ io_write_line(struct sess *sess, int fd, const char *line)
* Returns zero on failure, non-zero on success (zero or more bytes).
*/
static int
-io_read_nonblocking(struct sess *sess,
- int fd, void *buf, size_t bsz, size_t *sz)
+io_read_nonblocking(int fd, void *buf, size_t bsz, size_t *sz)
{
struct pollfd pfd;
ssize_t rsz;
@@ -237,14 +236,13 @@ io_read_nonblocking(struct sess *sess,
* Returns 0 on failure, non-zero on success (all bytes read).
*/
static int
-io_read_blocking(struct sess *sess,
- int fd, void *buf, size_t sz)
+io_read_blocking(int fd, void *buf, size_t sz)
{
size_t rsz;
int c;
while (sz > 0) {
- c = io_read_nonblocking(sess, fd, buf, sz, &rsz);
+ c = io_read_nonblocking(fd, buf, sz, &rsz);
if (!c) {
ERRX1("io_read_nonblocking");
return 0;
@@ -286,7 +284,7 @@ io_read_flush(struct sess *sess, int fd)
* for the remaining data size.
*/
- if (!io_read_blocking(sess, fd, &tagbuf, sizeof(tagbuf))) {
+ if (!io_read_blocking(fd, &tagbuf, sizeof(tagbuf))) {
ERRX1("io_read_blocking");
return 0;
}
@@ -304,7 +302,7 @@ io_read_flush(struct sess *sess, int fd)
} else if (sess->mplex_read_remain == 0)
return 1;
- if (!io_read_blocking(sess, fd, mpbuf, sess->mplex_read_remain)) {
+ if (!io_read_blocking(fd, mpbuf, sess->mplex_read_remain)) {
ERRX1("io_read_blocking");
return 0;
}
@@ -347,7 +345,7 @@ io_read_buf(struct sess *sess, int fd, void *buf, size_t sz)
if (!sess->mplex_reads) {
assert(sess->mplex_read_remain == 0);
- c = io_read_blocking(sess, fd, buf, sz);
+ c = io_read_blocking(fd, buf, sz);
sess->total_read += sz;
return c;
}
@@ -363,7 +361,7 @@ io_read_buf(struct sess *sess, int fd, void *buf, size_t sz)
if (sess->mplex_read_remain) {
rsz = sess->mplex_read_remain < sz ?
sess->mplex_read_remain : sz;
- if (!io_read_blocking(sess, fd, buf, rsz)) {
+ if (!io_read_blocking(fd, buf, rsz)) {
ERRX1("io_read_blocking");
return 0;
}
@@ -460,8 +458,8 @@ io_write_int(struct sess *sess, int fd, int32_t val)
* is insufficient for the new data.
*/
void
-io_buffer_buf(struct sess *sess, void *buf,
- size_t *bufpos, size_t buflen, const void *val, size_t valsz)
+io_buffer_buf(void *buf, size_t *bufpos, size_t buflen, const void *val,
+ size_t valsz)
{
assert(*bufpos + valsz <= buflen);
@@ -484,7 +482,7 @@ io_lowbuffer_buf(struct sess *sess, void *buf,
return;
if (!sess->mplex_writes) {
- io_buffer_buf(sess, buf, bufpos, buflen, val, valsz);
+ io_buffer_buf(buf, bufpos, buflen, val, valsz);
return;
}
@@ -492,8 +490,8 @@ io_lowbuffer_buf(struct sess *sess, void *buf,
assert(valsz == (valsz & 0xFFFFFF));
tagbuf = htole32((7 << 24) + valsz);
- io_buffer_int(sess, buf, bufpos, buflen, tagbuf);
- io_buffer_buf(sess, buf, bufpos, buflen, val, valsz);
+ io_buffer_int(buf, bufpos, buflen, tagbuf);
+ io_buffer_buf(buf, bufpos, buflen, val, valsz);
}
/*
@@ -544,12 +542,11 @@ io_lowbuffer_int(struct sess *sess, void *buf,
* Like io_buffer_buf(), but for a single integer.
*/
void
-io_buffer_int(struct sess *sess, void *buf,
- size_t *bufpos, size_t buflen, int32_t val)
+io_buffer_int(void *buf, size_t *bufpos, size_t buflen, int32_t val)
{
int32_t nv = htole32(val);
- io_buffer_buf(sess, buf, bufpos, buflen, &nv, sizeof(int32_t));
+ io_buffer_buf(buf, bufpos, buflen, &nv, sizeof(int32_t));
}
/*
@@ -659,8 +656,8 @@ io_read_int(struct sess *sess, int fd, int32_t *val)
* Increases "bufpos" to the new position.
*/
void
-io_unbuffer_buf(struct sess *sess, const void *buf,
- size_t *bufpos, size_t bufsz, void *val, size_t valsz)
+io_unbuffer_buf(const void *buf, size_t *bufpos, size_t bufsz, void *val,
+ size_t valsz)
{
assert(*bufpos + valsz <= bufsz);
@@ -672,12 +669,11 @@ io_unbuffer_buf(struct sess *sess, const void *buf,
* Calls io_unbuffer_buf() and converts.
*/
void
-io_unbuffer_int(struct sess *sess, const void *buf,
- size_t *bufpos, size_t bufsz, int32_t *val)
+io_unbuffer_int(const void *buf, size_t *bufpos, size_t bufsz, int32_t *val)
{
int32_t oval;
- io_unbuffer_buf(sess, buf, bufpos, bufsz, &oval, sizeof(int32_t));
+ io_unbuffer_buf(buf, bufpos, bufsz, &oval, sizeof(int32_t));
*val = le32toh(oval);
}
@@ -685,12 +681,11 @@ io_unbuffer_int(struct sess *sess, const void *buf,
* Calls io_unbuffer_buf() and converts.
*/
int
-io_unbuffer_size(struct sess *sess, const void *buf,
- size_t *bufpos, size_t bufsz, size_t *val)
+io_unbuffer_size(const void *buf, size_t *bufpos, size_t bufsz, size_t *val)
{
int32_t oval;
- io_unbuffer_int(sess, buf, bufpos, bufsz, &oval);
+ io_unbuffer_int(buf, bufpos, bufsz, &oval);
if (oval < 0) {
ERRX("io_unbuffer_size: negative value");
return 0;
diff --git a/usr.bin/rsync/mkpath.c b/usr.bin/rsync/mkpath.c
index f27e031290c..c8c7bd4477e 100644
--- a/usr.bin/rsync/mkpath.c
+++ b/usr.bin/rsync/mkpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkpath.c,v 1.3 2019/05/08 20:00:25 benno Exp $ */
+/* $OpenBSD: mkpath.c,v 1.4 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,7 +42,7 @@
* path - path
*/
int
-mkpath(struct sess *sess, char *path)
+mkpath(char *path)
{
struct stat sb;
char *slash;
diff --git a/usr.bin/rsync/mktemp.c b/usr.bin/rsync/mktemp.c
index ad95ba8bfba..ab81cc5a067 100644
--- a/usr.bin/rsync/mktemp.c
+++ b/usr.bin/rsync/mktemp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mktemp.c,v 1.9 2019/05/08 20:00:25 benno Exp $ */
+/* $OpenBSD: mktemp.c,v 1.10 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 1996-1998, 2008 Theo de Raadt
* Copyright (c) 1997, 2008-2009 Todd C. Miller
@@ -283,7 +283,7 @@ mkstempsock(const char *root, char *path)
* (excluding the final '\0').
*/
int
-mktemplate(struct sess *sess, char **ret, const char *path, int recursive)
+mktemplate(char **ret, const char *path, int recursive)
{
int n, dirlen;
const char *cp;
diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c
index 5d353e3a0c9..5ffd3458b74 100644
--- a/usr.bin/rsync/receiver.c
+++ b/usr.bin/rsync/receiver.c
@@ -1,4 +1,4 @@
-/* $Id: receiver.c,v 1.23 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: receiver.c,v 1.24 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -243,7 +243,7 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root)
if ((tofree = strdup(root)) == NULL) {
ERR("strdup");
goto out;
- } else if (mkpath(sess, tofree) < 0) {
+ } else if (mkpath(tofree) < 0) {
ERRX1("%s: mkpath", root);
free(tofree);
goto out;
@@ -312,8 +312,9 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root)
pfd[PFD_DOWNLOADER_IN].events = POLLIN;
pfd[PFD_SENDER_OUT].events = POLLOUT;
- ul = upload_alloc(sess, root, dfd, fdout,
- CSUM_LENGTH_PHASE1, fl, flsz, oumask);
+ ul = upload_alloc(root, dfd, fdout, CSUM_LENGTH_PHASE1, fl, flsz,
+ oumask);
+
if (ul == NULL) {
ERRX1("upload_alloc");
goto out;
diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c
index d6613daa80c..d3a8b954947 100644
--- a/usr.bin/rsync/sender.c
+++ b/usr.bin/rsync/sender.c
@@ -1,4 +1,4 @@
-/* $Id: sender.c,v 1.22 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: sender.c,v 1.23 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -260,7 +260,7 @@ send_up_fsm(struct sess *sess, size_t *phase,
return 0;
}
assert(sizeof(buf) == 20);
- blk_recv_ack(sess, buf, up->cur->blks, up->cur->idx);
+ blk_recv_ack(buf, up->cur->blks, up->cur->idx);
io_lowbuffer_buf(sess, *wb, &pos, *wbsz, buf, 20);
LOG3("%s: primed for %jd B total",
@@ -480,7 +480,7 @@ rsync_sender(struct sess *sess, int fdin,
ERRX1("io_read_flush");
goto out;
} else if (sess->mplex_read_remain == 0) {
- c = io_read_check(sess, fdin);
+ c = io_read_check(fdin);
if (c < 0) {
ERRX1("io_read_check");
goto out;
@@ -507,7 +507,7 @@ rsync_sender(struct sess *sess, int fdin,
ERRX1("send_dl_enqueue");
goto out;
}
- c = io_read_check(sess, fdin);
+ c = io_read_check(fdin);
if (c < 0) {
ERRX1("io_read_check");
goto out;
diff --git a/usr.bin/rsync/server.c b/usr.bin/rsync/server.c
index 2a7fff2ac9d..2423637a276 100644
--- a/usr.bin/rsync/server.c
+++ b/usr.bin/rsync/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.11 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: server.c,v 1.12 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -27,7 +27,7 @@
#include "extern.h"
static int
-fcntl_nonblock(struct sess *sess, int fd)
+fcntl_nonblock(int fd)
{
int fl;
@@ -64,8 +64,8 @@ rsync_server(const struct opts *opts, size_t argc, char *argv[])
/* Begin by making descriptors non-blocking. */
- if (!fcntl_nonblock(&sess, fdin) ||
- !fcntl_nonblock(&sess, fdout)) {
+ if (!fcntl_nonblock(fdin) ||
+ !fcntl_nonblock(fdout)) {
ERRX1("fcntl_nonblock");
goto out;
}
diff --git a/usr.bin/rsync/socket.c b/usr.bin/rsync/socket.c
index 7e5dc67779e..1a0844f1313 100644
--- a/usr.bin/rsync/socket.c
+++ b/usr.bin/rsync/socket.c
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.23 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: socket.c,v 1.24 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -50,8 +50,7 @@ struct source {
* Return <0 on failure, 0 on try another address, >0 on success.
*/
static int
-inet_connect(struct sess *sess, int *sd,
- const struct source *src, const char *host)
+inet_connect(int *sd, const struct source *src, const char *host)
{
int c, flags;
@@ -196,7 +195,8 @@ inet_resolve(struct sess *sess, const char *host, size_t *sz)
* Return <0 on failure, 0 on try more lines, >0 on finished.
*/
static int
-protocol_line(struct sess *sess, const char *host, const char *cp)
+protocol_line(struct sess *sess, __attribute__((unused)) const char *host,
+ const char *cp)
{
int major, minor;
@@ -274,7 +274,7 @@ rsync_connect(const struct opts *opts, int *sd, const struct fargs *f)
assert(srcsz);
for (i = 0; i < srcsz; i++) {
- c = inet_connect(&sess, sd, &src[i], f->host);
+ c = inet_connect(sd, &src[i], f->host);
if (c < 0) {
ERRX1("inet_connect");
goto out;
diff --git a/usr.bin/rsync/symlinks.c b/usr.bin/rsync/symlinks.c
index 5f706686b2d..da23b66033e 100644
--- a/usr.bin/rsync/symlinks.c
+++ b/usr.bin/rsync/symlinks.c
@@ -1,4 +1,4 @@
-/* $Id: symlinks.c,v 1.4 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: symlinks.c,v 1.5 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -29,7 +29,7 @@
* The buffer must be passed to free() by the caller.
*/
char *
-symlink_read(struct sess *sess, const char *path)
+symlink_read(const char *path)
{
char *buf = NULL;
size_t sz;
@@ -68,7 +68,7 @@ symlink_read(struct sess *sess, const char *path)
* The buffer must be passed to free() by the caller.
*/
char *
-symlinkat_read(struct sess *sess, int fd, const char *path)
+symlinkat_read(int fd, const char *path)
{
char *buf = NULL;
size_t sz;
diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c
index 7e283c71c33..fd07b22caeb 100644
--- a/usr.bin/rsync/uploader.c
+++ b/usr.bin/rsync/uploader.c
@@ -1,4 +1,4 @@
-/* $Id: uploader.c,v 1.21 2019/05/08 20:00:25 benno Exp $ */
+/* $Id: uploader.c,v 1.22 2019/05/08 21:30:11 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2019 Florian Obser <florian@openbsd.org>
@@ -215,7 +215,7 @@ pre_link(struct upload *p, struct sess *sess)
*/
if (rc != -1) {
- b = symlinkat_read(sess, p->rootfd, f->path);
+ b = symlinkat_read(p->rootfd, f->path);
if (b == NULL) {
ERRX1("symlinkat_read");
return -1;
@@ -237,8 +237,7 @@ pre_link(struct upload *p, struct sess *sess)
if (rc == -1 || updatelink) {
LOG3("%s: creating symlink: %s", f->path, f->link);
- if (mktemplate(sess, &temp,
- f->path, sess->opts->recursive) == -1) {
+ if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) {
ERRX1("mktemplate");
return -1;
}
@@ -325,8 +324,7 @@ pre_dev(struct upload *p, struct sess *sess)
if (rc == -1 || updatedev) {
newdev = 1;
- if (mktemplate(sess, &temp, f->path,
- sess->opts->recursive) == -1) {
+ if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) {
ERRX1("mktemplate");
return -1;
}
@@ -339,7 +337,7 @@ pre_dev(struct upload *p, struct sess *sess)
}
rsync_set_metadata_at(sess, newdev,
- p->rootfd, f, newdev ? temp : f->path);
+ p->rootfd, f, newdev ? temp : f->path);
if (newdev) {
if (renameat(p->rootfd, temp, p->rootfd, f->path) == -1) {
@@ -402,8 +400,7 @@ pre_fifo(struct upload *p, struct sess *sess)
if (rc == -1) {
newfifo = 1;
- if (mktemplate(sess, &temp, f->path,
- sess->opts->recursive) == -1) {
+ if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) {
ERRX1("mktemplate");
return -1;
}
@@ -478,8 +475,7 @@ pre_sock(struct upload *p, struct sess *sess)
if (rc == -1) {
newsock = 1;
- if (mktemplate(sess, &temp, f->path,
- sess->opts->recursive) == -1) {
+ if (mktemplate(&temp, f->path, sess->opts->recursive) == -1) {
ERRX1("mktemplate");
return -1;
}
@@ -682,7 +678,7 @@ pre_file(const struct upload *p, int *filefd, struct sess *sess)
* On success, upload_free() must be called with the allocated pointer.
*/
struct upload *
-upload_alloc(struct sess *sess, const char *root, int rootfd, int fdout,
+upload_alloc(const char *root, int rootfd, int fdout,
size_t clen, const struct flist *fl, size_t flsz, mode_t msk)
{
struct upload *p;
@@ -980,15 +976,15 @@ rsync_uploader(struct upload *u, int *fileinfd,
}
u->bufpos = pos = 0;
- io_buffer_int(sess, u->buf, &pos, u->bufsz, u->idx);
- io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.blksz);
- io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.len);
- io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.csum);
- io_buffer_int(sess, u->buf, &pos, u->bufsz, blk.rem);
+ io_buffer_int(u->buf, &pos, u->bufsz, u->idx);
+ io_buffer_int(u->buf, &pos, u->bufsz, blk.blksz);
+ io_buffer_int(u->buf, &pos, u->bufsz, blk.len);
+ io_buffer_int(u->buf, &pos, u->bufsz, blk.csum);
+ io_buffer_int(u->buf, &pos, u->bufsz, blk.rem);
for (i = 0; i < blk.blksz; i++) {
- io_buffer_int(sess, u->buf, &pos, u->bufsz,
+ io_buffer_int(u->buf, &pos, u->bufsz,
blk.blks[i].chksum_short);
- io_buffer_buf(sess, u->buf, &pos, u->bufsz,
+ io_buffer_buf(u->buf, &pos, u->bufsz,
blk.blks[i].chksum_long, blk.csum);
}
assert(pos == u->bufsz);