From owner-svn-src-head@freebsd.org Fri Feb 23 20:18:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB086F1A251; Fri, 23 Feb 2018 20:18:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6016976538; Fri, 23 Feb 2018 20:18:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B15B1B3DC; Fri, 23 Feb 2018 20:18:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1NKIATa043962; Fri, 23 Feb 2018 20:18:10 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1NKI9Hc043953; Fri, 23 Feb 2018 20:18:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802232018.w1NKI9Hc043953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 23 Feb 2018 20:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329879 - in head/stand: libsa userboot/userboot zfs X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/stand: libsa userboot/userboot zfs X-SVN-Commit-Revision: 329879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 20:18:11 -0000 Author: cem Date: Fri Feb 23 20:18:09 2018 New Revision: 329879 URL: https://svnweb.freebsd.org/changeset/base/329879 Log: libsa: Const-ify buffer argument of write(2) analog Reported by: kevans Reviewed by: delphij, eadler, imp, kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14482 Modified: head/stand/libsa/cd9660.c head/stand/libsa/nfs.c head/stand/libsa/nullfs.c head/stand/libsa/stand.h head/stand/libsa/tftp.c head/stand/libsa/ufs.c head/stand/libsa/write.c head/stand/userboot/userboot/host.c head/stand/zfs/zfs.c Modified: head/stand/libsa/cd9660.c ============================================================================== --- head/stand/libsa/cd9660.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/cd9660.c Fri Feb 23 20:18:09 2018 (r329879) @@ -66,7 +66,7 @@ static int cd9660_open(const char *path, struct open_f static int cd9660_close(struct open_file *f); static int cd9660_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int cd9660_write(struct open_file *f, void *buf, size_t size, +static int cd9660_write(struct open_file *f, const void *buf, size_t size, size_t *resid); static off_t cd9660_seek(struct open_file *f, off_t offset, int where); static int cd9660_stat(struct open_file *f, struct stat *sb); @@ -557,7 +557,8 @@ again: } static int -cd9660_write(struct open_file *f __unused, void *start __unused, size_t size __unused, size_t *resid __unused) +cd9660_write(struct open_file *f __unused, const void *buf __unused, + size_t size __unused, size_t *resid __unused) { return EROFS; } Modified: head/stand/libsa/nfs.c ============================================================================== --- head/stand/libsa/nfs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/nfs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -126,7 +126,6 @@ struct nfs_iodesc { int nfs_open(const char *path, struct open_file *f); static int nfs_close(struct open_file *f); static int nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t nfs_seek(struct open_file *f, off_t offset, int where); static int nfs_stat(struct open_file *f, struct stat *sb); static int nfs_readdir(struct open_file *f, struct dirent *d); @@ -138,7 +137,7 @@ struct fs_ops nfs_fsops = { nfs_open, nfs_close, nfs_read, - nfs_write, + null_write, nfs_seek, nfs_stat, nfs_readdir @@ -713,15 +712,6 @@ ret: *resid = size; return (0); -} - -/* - * Not implemented. - */ -int -nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid) -{ - return (EROFS); } off_t Modified: head/stand/libsa/nullfs.c ============================================================================== --- head/stand/libsa/nullfs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/nullfs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -83,7 +83,7 @@ int null_read (struct open_file *f, void *buf, size_t return EIO; } -int null_write (struct open_file *f, void *buf, size_t size, size_t *resid) +int null_write (struct open_file *f, const void *buf, size_t size, size_t *resid) { return EIO; } Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/stand.h Fri Feb 23 20:18:09 2018 (r329879) @@ -105,7 +105,7 @@ struct fs_ops { int (*fo_close)(struct open_file *f); int (*fo_read)(struct open_file *f, void *buf, size_t size, size_t *resid); - int (*fo_write)(struct open_file *f, void *buf, + int (*fo_write)(struct open_file *f, const void *buf, size_t size, size_t *resid); off_t (*fo_seek)(struct open_file *f, off_t offset, int where); int (*fo_stat)(struct open_file *f, struct stat *sb); @@ -383,7 +383,7 @@ extern void nullsys(void); extern int null_open(const char *path, struct open_file *f); extern int null_close(struct open_file *f); extern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid); -extern int null_write(struct open_file *f, void *buf, size_t size, size_t *resid); +extern int null_write(struct open_file *f, const void *buf, size_t size, size_t *resid); extern off_t null_seek(struct open_file *f, off_t offset, int where); extern int null_stat(struct open_file *f, struct stat *sb); extern int null_readdir(struct open_file *f, struct dirent *d); Modified: head/stand/libsa/tftp.c ============================================================================== --- head/stand/libsa/tftp.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/tftp.c Fri Feb 23 20:18:09 2018 (r329879) @@ -69,7 +69,8 @@ static int tftp_open(const char *path, struct open_fil static int tftp_close(struct open_file *f); static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int tftp_write(struct open_file *f, void *buf, size_t size, size_t *resid); +static int tftp_write(struct open_file *f, const void *buf, size_t size, + size_t *resid); static off_t tftp_seek(struct open_file *f, off_t offset, int where); static int tftp_set_blksize(struct tftp_handle *h, const char *str); static int tftp_stat(struct open_file *f, struct stat *sb); @@ -574,8 +575,8 @@ tftp_close(struct open_file *f) } static int -tftp_write(struct open_file *f __unused, void *start __unused, size_t size __unused, - size_t *resid __unused /* out */) +tftp_write(struct open_file *f __unused, const void *start __unused, + size_t size __unused, size_t *resid __unused /* out */) { return (EROFS); } Modified: head/stand/libsa/ufs.c ============================================================================== --- head/stand/libsa/ufs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/ufs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -84,7 +84,8 @@ __FBSDID("$FreeBSD$"); #include "string.h" static int ufs_open(const char *path, struct open_file *f); -static int ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid); +static int ufs_write(struct open_file *f, const void *buf, size_t size, + size_t *resid); static int ufs_close(struct open_file *f); static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t ufs_seek(struct open_file *f, off_t offset, int where); @@ -131,7 +132,7 @@ struct file { static int read_inode(ino_t, struct open_file *); static int block_map(struct open_file *, ufs2_daddr_t, ufs2_daddr_t *); static int buf_read_file(struct open_file *, char **, size_t *); -static int buf_write_file(struct open_file *, char *, size_t *); +static int buf_write_file(struct open_file *, const char *, size_t *); static int search_directory(char *, struct open_file *, ino_t *); static int ufs_use_sa_read(void *, off_t, void **, int); @@ -306,7 +307,7 @@ block_map(f, file_block, disk_block_p) static int buf_write_file(f, buf_p, size_p) struct open_file *f; - char *buf_p; + const char *buf_p; size_t *size_p; /* out */ { struct file *fp = (struct file *)f->f_fsdata; @@ -770,14 +771,14 @@ ufs_read(f, start, size, resid) static int ufs_write(f, start, size, resid) struct open_file *f; - void *start; + const void *start; size_t size; size_t *resid; /* out */ { struct file *fp = (struct file *)f->f_fsdata; size_t csize; int rc = 0; - char *addr = start; + const char *addr = start; csize = size; while ((size != 0) && (csize != 0)) { Modified: head/stand/libsa/write.c ============================================================================== --- head/stand/libsa/write.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/libsa/write.c Fri Feb 23 20:18:09 2018 (r329879) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); ssize_t write(fd, dest, bcount) int fd; - void *dest; + const void *dest; size_t bcount; { struct open_file *f = &files[fd]; @@ -82,7 +82,8 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), bcount, dest, &resid); + btodb(f->f_offset), bcount, __DECONST(void *, dest), + &resid); if (errno) return (-1); f->f_offset += resid; Modified: head/stand/userboot/userboot/host.c ============================================================================== --- head/stand/userboot/userboot/host.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/userboot/userboot/host.c Fri Feb 23 20:18:09 2018 (r329879) @@ -74,16 +74,6 @@ host_read(struct open_file *f, void *start, size_t siz return (CALLBACK(read, f->f_fsdata, start, size, resid)); } -/* - * Don't be silly - the bootstrap has no business writing anything. - */ -static int -host_write(struct open_file *f, void *start, size_t size, size_t *resid) -{ - - return (EROFS); -} - static off_t host_seek(struct open_file *f, off_t offset, int where) { @@ -183,7 +173,7 @@ struct fs_ops host_fsops = { host_open, host_close, host_read, - host_write, + null_write, host_seek, host_stat, host_readdir Modified: head/stand/zfs/zfs.c ============================================================================== --- head/stand/zfs/zfs.c Fri Feb 23 20:15:19 2018 (r329878) +++ head/stand/zfs/zfs.c Fri Feb 23 20:18:09 2018 (r329879) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #define ZFS_BE_LAST 8 static int zfs_open(const char *path, struct open_file *f); -static int zfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static int zfs_close(struct open_file *f); static int zfs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t zfs_seek(struct open_file *f, off_t offset, int where); @@ -69,7 +68,7 @@ struct fs_ops zfs_fsops = { zfs_open, zfs_close, zfs_read, - zfs_write, + null_write, zfs_seek, zfs_stat, zfs_readdir @@ -171,16 +170,6 @@ zfs_read(struct open_file *f, void *start, size_t size *resid = size - n; return (0); -} - -/* - * Don't be silly - the bootstrap has no business writing anything. - */ -static int -zfs_write(struct open_file *f, void *start, size_t size, size_t *resid /* out */) -{ - - return (EROFS); } static off_t