diff options
author | kevans <kevans@FreeBSD.org> | 2018-04-06 19:21:36 +0000 |
---|---|---|
committer | kevans <kevans@FreeBSD.org> | 2018-04-06 19:21:36 +0000 |
commit | 223280ae127c2435236cc6af6e1d2c2c25c68645 (patch) | |
tree | 9545804499f2581879cd0ecf084d2614cd9cbee6 /stand | |
parent | 19dfc8ee1aecd5783a12179ad7c7ece094f8f244 (diff) | |
download | FreeBSD-src-223280ae127c2435236cc6af6e1d2c2c25c68645.zip FreeBSD-src-223280ae127c2435236cc6af6e1d2c2c25c68645.tar.gz |
MFC r329879, r329892
r329879:
libsa: Const-ify buffer argument of write(2) analog
r329892:
libsa: Change write(2)-alike prototype to match definition
Broken in r329879.
Apparently old GCC detects this, but modern GCC didn't. Mea culpa.
Diffstat (limited to 'stand')
-rw-r--r-- | stand/libsa/cd9660.c | 5 | ||||
-rw-r--r-- | stand/libsa/nfs.c | 12 | ||||
-rw-r--r-- | stand/libsa/nullfs.c | 2 | ||||
-rw-r--r-- | stand/libsa/stand.h | 6 | ||||
-rw-r--r-- | stand/libsa/tftp.c | 7 | ||||
-rw-r--r-- | stand/libsa/ufs.c | 11 | ||||
-rw-r--r-- | stand/libsa/write.c | 5 | ||||
-rw-r--r-- | stand/userboot/userboot/host.c | 12 | ||||
-rw-r--r-- | stand/zfs/zfs.c | 13 |
9 files changed, 23 insertions, 50 deletions
diff --git a/stand/libsa/cd9660.c b/stand/libsa/cd9660.c index a1711fb..5458c37 100644 --- a/stand/libsa/cd9660.c +++ b/stand/libsa/cd9660.c @@ -66,7 +66,7 @@ static int cd9660_open(const char *path, struct open_file *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; } diff --git a/stand/libsa/nfs.c b/stand/libsa/nfs.c index 7e2e1ab..5e160b5 100644 --- a/stand/libsa/nfs.c +++ b/stand/libsa/nfs.c @@ -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 @@ -715,15 +714,6 @@ ret: return (0); } -/* - * Not implemented. - */ -int -nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid) -{ - return (EROFS); -} - off_t nfs_seek(struct open_file *f, off_t offset, int where) { diff --git a/stand/libsa/nullfs.c b/stand/libsa/nullfs.c index e4c0b7c..211388a3 100644 --- a/stand/libsa/nullfs.c +++ b/stand/libsa/nullfs.c @@ -83,7 +83,7 @@ int null_read (struct open_file *f, void *buf, size_t size, size_t *resid) 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; } diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 6968c3e..b58fbb2 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -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); @@ -289,7 +289,7 @@ extern int open(const char *, int); extern int close(int); extern void closeall(void); extern ssize_t read(int, void *, size_t); -extern ssize_t write(int, void *, size_t); +extern ssize_t write(int, const void *, size_t); extern struct dirent *readdirfd(int); extern void srandom(u_long seed); @@ -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); diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index 2d4a982..c69821a 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -69,7 +69,8 @@ static int tftp_open(const char *path, struct open_file *f); 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); } diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c index 928a1d1..83f7a7b 100644 --- a/stand/libsa/ufs.c +++ b/stand/libsa/ufs.c @@ -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 *); /* @@ -301,7 +302,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; @@ -764,14 +765,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)) { diff --git a/stand/libsa/write.c b/stand/libsa/write.c index 9e02f08..608773b 100644 --- a/stand/libsa/write.c +++ b/stand/libsa/write.c @@ -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; diff --git a/stand/userboot/userboot/host.c b/stand/userboot/userboot/host.c index 94f8a3d..8618565 100644 --- a/stand/userboot/userboot/host.c +++ b/stand/userboot/userboot/host.c @@ -74,16 +74,6 @@ host_read(struct open_file *f, void *start, size_t size, size_t *resid) 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 diff --git a/stand/zfs/zfs.c b/stand/zfs/zfs.c index 0334bdd..a588f7e 100644 --- a/stand/zfs/zfs.c +++ b/stand/zfs/zfs.c @@ -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); @@ -67,7 +66,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, size_t *resid /* out */) 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 zfs_seek(struct open_file *f, off_t offset, int where) { |