diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-17 00:32:29 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-17 00:43:09 +0100 |
commit | f5fb7c713ea443469406a691e60a6f4567a4cb75 (patch) | |
tree | b16d979915b5ad7e32ffe77ca5f5006dc639a16e | |
parent | dd3048b2e483f66571cfa1b2ccebb2091b9ad990 (diff) | |
download | hurd-f5fb7c713ea443469406a691e60a6f4567a4cb75.tar.gz hurd-f5fb7c713ea443469406a691e60a6f4567a4cb75.tar.bz2 hurd-f5fb7c713ea443469406a691e60a6f4567a4cb75.zip |
Fix const warnings
Now that the RPCs have const, this forces us cleaning our const-meant
functions.
69 files changed, 250 insertions, 247 deletions
diff --git a/acpi/netfs_impl.c b/acpi/netfs_impl.c index 38ff5e17..e37c7f6d 100644 --- a/acpi/netfs_impl.c +++ b/acpi/netfs_impl.c @@ -114,7 +114,7 @@ get_dirents (struct acpifs_dirent *dir, } static struct acpifs_dirent * -lookup (struct node *np, char *name) +lookup (struct node *np, const char *name) { int i; struct acpifs_dirent *ret = 0, *e; @@ -167,7 +167,7 @@ destroy_node (struct node *node) locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser * user, struct node * dir, - char *name, mode_t mode, struct node ** node) + const char *name, mode_t mode, struct node ** node) { *node = 0; pthread_mutex_unlock (&dir->lock); @@ -249,7 +249,7 @@ netfs_get_dirents (struct iouser * cred, struct node * dir, what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err = 0; struct acpifs_dirent *entry; @@ -345,7 +345,7 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir, /* Delete NAME in DIR for USER. */ error_t -netfs_attempt_unlink (struct iouser * user, struct node * dir, char *name) +netfs_attempt_unlink (struct iouser * user, struct node * dir, const char *name) { return EOPNOTSUPP; } @@ -353,8 +353,8 @@ netfs_attempt_unlink (struct iouser * user, struct node * dir, char *name) /* Note that in this one call, neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser * user, struct node * fromdir, - char *fromname, struct node * todir, - char *toname, int excl) + const char *fromname, struct node * todir, + const char *toname, int excl) { return EOPNOTSUPP; } @@ -363,14 +363,14 @@ netfs_attempt_rename (struct iouser * user, struct node * fromdir, MODE. */ error_t netfs_attempt_mkdir (struct iouser * user, struct node * dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EOPNOTSUPP; } /* Attempt to remove directory named NAME in DIR for USER. */ error_t -netfs_attempt_rmdir (struct iouser * user, struct node * dir, char *name) +netfs_attempt_rmdir (struct iouser * user, struct node * dir, const char *name) { return EOPNOTSUPP; } @@ -406,7 +406,7 @@ netfs_attempt_chmod (struct iouser * cred, struct node * node, mode_t mode) /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t -netfs_attempt_mksymlink (struct iouser * cred, struct node * node, char *name) +netfs_attempt_mksymlink (struct iouser * cred, struct node * node, const char *name) { return EOPNOTSUPP; } @@ -462,7 +462,7 @@ netfs_attempt_syncfs (struct iouser * cred, int wait) return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser * user, struct node * dir, - struct node * file, char *name, int excl) + struct node * file, const char *name, int excl) { return EOPNOTSUPP; } @@ -509,7 +509,7 @@ netfs_attempt_read (struct iouser * cred, struct node * node, return. */ error_t netfs_attempt_write (struct iouser * cred, struct node * node, - off_t offset, size_t * len, void *data) + off_t offset, size_t * len, const void *data) { return EOPNOTSUPP; } diff --git a/boot/boot.c b/boot/boot.c index d45d8bb9..1b10c86b 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -342,7 +342,7 @@ add_dev_map (const char *dev_name, const char *dev_file) return map; } -static struct dev_map *lookup_dev (char *dev_name) +static struct dev_map *lookup_dev (const char *dev_name) { struct dev_map *map; @@ -1057,7 +1057,7 @@ ds_device_write_inband (device_t device, mach_msg_type_name_t reply_type, dev_mode_t mode, recnum_t recnum, - const_io_buf_ptr_inband_t data, + const io_buf_ptr_inband_t data, size_t datalen, int *bytes_written) { diff --git a/console-client/current-vcs.c b/console-client/current-vcs.c index fb053799..ce90de4f 100644 --- a/console-client/current-vcs.c +++ b/console-client/current-vcs.c @@ -107,9 +107,10 @@ vcs_read (struct protid *user, char **data, /* Making a link to set current vcs. Relative values perform relative switches. */ static error_t -vcs_mksymlink (struct iouser *user, struct node *np, char *name) +vcs_mksymlink (struct iouser *user, struct node *np, const char *name) { - char *c, *d; + const char *c; + char *d; int vt, delta = 0; c = strrchr (name, '/'); diff --git a/console-client/trans.c b/console-client/trans.c index 17cface0..fe4b9ca4 100644 --- a/console-client/trans.c +++ b/console-client/trans.c @@ -137,7 +137,7 @@ netfs_attempt_chmod (struct iouser *cred, struct node *np, /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *np, - char *name) + const char *name) { if (!np->nn->node) { @@ -244,7 +244,7 @@ netfs_attempt_syncfs (struct iouser *cred, int wait) what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err; consnode_t cn; @@ -383,7 +383,7 @@ netfs_S_io_select_timeout (struct protid *user, mach_port_t reply, /* Delete NAME in DIR (which is locked) for USER. */ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, - char *name) + const char *name) { error_t err; consnode_t cn; @@ -408,8 +408,8 @@ netfs_attempt_unlink (struct iouser *user, struct node *dir, of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return EOPNOTSUPP; } @@ -419,7 +419,7 @@ netfs_attempt_rename (struct iouser *user, struct node *fromdir, locked) for USER with mode MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EOPNOTSUPP; } @@ -429,7 +429,7 @@ netfs_attempt_mkdir (struct iouser *user, struct node *dir, USER. */ error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) + struct node *dir, const char *name) { return EOPNOTSUPP; } @@ -440,7 +440,7 @@ netfs_attempt_rmdir (struct iouser *user, target. Return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { error_t err; consnode_t cn; @@ -506,7 +506,7 @@ netfs_attempt_mkfile (struct iouser *user, struct node *dir, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **np) + const char *name, mode_t mode, struct node **np) { *np = 0; pthread_mutex_unlock (&dir->lock); @@ -567,7 +567,7 @@ netfs_attempt_read (struct iouser *cred, struct node *np, io_write, which is overridden. */ error_t netfs_attempt_write (struct iouser *cred, struct node *np, - loff_t offset, size_t *len, void *data) + loff_t offset, size_t *len, const void *data) { return EOPNOTSUPP; } diff --git a/console-client/trans.h b/console-client/trans.h index 9891cf3f..c7ca6a79 100644 --- a/console-client/trans.h +++ b/console-client/trans.h @@ -37,7 +37,7 @@ struct consnode /* Read data to a node. This is exactly the same as io_write does. */ - error_t (*write) (struct protid *user, char *data, + error_t (*write) (struct protid *user, const char *data, mach_msg_type_number_t datalen, off_t offset, mach_msg_type_number_t *amount); @@ -59,7 +59,7 @@ struct consnode error_t (*readlink) (struct iouser *user, struct node *np, char *buf); /* Called when the symlink is written */ - error_t (*mksymlink) (struct iouser *cred, struct node *np, char *name); + error_t (*mksymlink) (struct iouser *cred, struct node *np, const char *name); struct consnode *next; }; diff --git a/console/console.c b/console/console.c index ad31fba2..443f3f77 100644 --- a/console/console.c +++ b/console/console.c @@ -471,7 +471,7 @@ netfs_node_norefs (struct node *np) before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **np) + const char *name, mode_t mode, struct node **np) { /* We create virtual consoles dynamically on the fly, so there is no need for an explicit create operation. */ @@ -563,7 +563,7 @@ netfs_attempt_sync (struct iouser *cred, struct node *np, int wait) should unlock DIR no matter what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err; @@ -1031,7 +1031,7 @@ netfs_attempt_chmod (struct iouser *cred, struct node *node, mode_t mode) /* The user must define this function. Attempt to turn locked node NP (user CRED) into a symlink with target NAME. */ error_t -netfs_attempt_mksymlink (struct iouser *cred, struct node *np, char *name) +netfs_attempt_mksymlink (struct iouser *cred, struct node *np, const char *name) { return EOPNOTSUPP; } @@ -1070,35 +1070,35 @@ netfs_attempt_statfs (struct iouser *cred, struct node *np, struct statfs *st) error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EOPNOTSUPP; } error_t -netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) +netfs_attempt_unlink (struct iouser *user, struct node *dir, const char *name) { return EOPNOTSUPP; } error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return EOPNOTSUPP; } error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) + struct node *dir, const char *name) { return EOPNOTSUPP; } error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { return EOPNOTSUPP; } @@ -1162,7 +1162,7 @@ netfs_attempt_read (struct iouser *cred, struct node *np, error_t netfs_attempt_write (struct iouser *cred, struct node *np, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { error_t err = 0; vcons_t vcons = np->nn->vcons; diff --git a/console/display.c b/console/display.c index ec1462d9..c59e74f0 100644 --- a/console/display.c +++ b/console/display.c @@ -2015,7 +2015,7 @@ display_get_owner (display_t display, pid_t *pid) NONBLOCK is not zero, return with -1 and set errno to EWOULDBLOCK if operation would block for a long time. */ ssize_t -display_output (display_t display, int nonblock, char *data, size_t datalen) +display_output (display_t display, int nonblock, const char *data, size_t datalen) { output_t output = &display->output; error_t err; @@ -2075,7 +2075,7 @@ display_output (display_t display, int nonblock, char *data, size_t datalen) } else { - buffer = data; + buffer = (char*) data; buffer_size = datalen; } amount = buffer_size; diff --git a/console/display.h b/console/display.h index d64cf69e..3445fb98 100644 --- a/console/display.h +++ b/console/display.h @@ -59,7 +59,7 @@ error_t display_get_owner (display_t display, pid_t *pid); be smaller than DATALEN) or -1 and the error number in errno. If NONBLOCK is not zero, return with -1 and set errno to EWOULDBLOCK if operation would block for a long time. */ -ssize_t display_output (display_t display, int nonblock, char *data, +ssize_t display_output (display_t display, int nonblock, const char *data, size_t datalen); mach_port_t display_get_filemap (display_t display, vm_prot_t prot); diff --git a/console/input.c b/console/input.c index c6f99743..8e561fb9 100644 --- a/console/input.c +++ b/console/input.c @@ -87,7 +87,7 @@ void input_destroy (input_t input) DATALEN) or -1 and the error number in errno. If NONBLOCK is not zero, return with -1 and set errno to EWOULDBLOCK if operation would block for a long time. */ -ssize_t input_enqueue (input_t input, int nonblock, char *data, +ssize_t input_enqueue (input_t input, int nonblock, const char *data, size_t datalen) { error_t err = 0; @@ -154,7 +154,7 @@ ssize_t input_enqueue (input_t input, int nonblock, char *data, } else { - buffer = data; + buffer = (char*) data; buffer_size = datalen; } /* Prepare output buffer for iconv. */ diff --git a/console/input.h b/console/input.h index 3f66e1dd..2f1c37c2 100644 --- a/console/input.h +++ b/console/input.h @@ -40,7 +40,7 @@ void input_destroy (input_t input); DATALEN) or -1 and the error number in errno. If NONBLOCK is not zero, return with -1 and set errno to EWOULDBLOCK if operation would block for a long time. */ -ssize_t input_enqueue (input_t input, int nonblock, char *data, +ssize_t input_enqueue (input_t input, int nonblock, const char *data, size_t datalen); /* Remove DATALEN characters from the input queue and put them in the diff --git a/devnode/devnode.c b/devnode/devnode.c index 7ec4f209..bf3378ea 100644 --- a/devnode/devnode.c +++ b/devnode/devnode.c @@ -192,7 +192,7 @@ ds_device_write (device_t device, mach_port_t reply_port, kern_return_t ds_device_write_inband (device_t device, mach_port_t reply_port, mach_msg_type_name_t reply_type, dev_mode_t mode, - recnum_t recnum, const_io_buf_ptr_inband_t data, + recnum_t recnum, const io_buf_ptr_inband_t data, size_t datalen, int *bytes_written) { return D_INVALID_OPERATION; diff --git a/doc/hurd.texi b/doc/hurd.texi index 54c9049b..b713850c 100644 --- a/doc/hurd.texi +++ b/doc/hurd.texi @@ -2186,7 +2186,7 @@ Redefining this is the normal way to add option parsing to a trivfs program. @end deftypevar -@deftypefun error_t trivfs_set_options (@w{struct trivfs_control *@var{fsys}}, @w{char *@var{argz}}, @w{size_t @var{argz_len}}) +@deftypefun error_t trivfs_set_options (@w{struct trivfs_control *@var{fsys}}, @w{const char *@var{argz}}, @w{size_t @var{argz_len}}) Set runtime options for @var{fsys} to @var{argz} and @var{argz_len}. The default definition for this routine simply uses @var{trivfs_runtime_argp} (supplying @var{fsys} as the argp input @@ -2356,7 +2356,7 @@ If these variables is non-zero, they will be called every time a protid or peropen structure is about to be destroyed. @end deftypefn -@deftypefn {Variable} error_t (*trivfs_getroot_hook) (@w{struct trivfs_control *@var{cntl}}, @w{mach_port_t @var{reply_port}}, @w{mach_msg_type_name_t @var{reply_port_type}}, @w{mach_port_t @var{dotdot}}, @w{uid_t *@var{uids}}, @w{u_int @var{nuids}}, @w{uid_t *@var{gids}}, @w{u_int @var{ngids}}, @w{int @var{flags}}, @w{retry_type *@var{do_retry}}, @w{char *@var{retry_name}}, @w{mach_port_t *@var{node}}, @w{mach_msg_type_name_t *@var{node_type}}) +@deftypefn {Variable} error_t (*trivfs_getroot_hook) (@w{struct trivfs_control *@var{cntl}}, @w{mach_port_t @var{reply_port}}, @w{mach_msg_type_name_t @var{reply_port_type}}, @w{mach_port_t @var{dotdot}}, @w{const uid_t *@var{uids}}, @w{u_int @var{nuids}}, @w{const uid_t *@var{gids}}, @w{u_int @var{ngids}}, @w{int @var{flags}}, @w{retry_type *@var{do_retry}}, @w{char *@var{retry_name}}, @w{mach_port_t *@var{node}}, @w{mach_msg_type_name_t *@var{node_type}}) If this variable is set, it will be called by @code{trivfs_S_fsys_getroot} before any other processing takes place. If the return value is @code{EAGAIN}, normal trivfs getroot processing continues, otherwise the @@ -3981,7 +3981,7 @@ If @code{@var{np}->dn_set_ctime} is set, then modify operations for @code{st_atim} and @code{st_mtim} as well. @end deftypefun -@deftypefun {struct node *} diskfs_check_lookup_cache (@w{struct node *@var{dir}}, @w{char *@var{name}}) +@deftypefun {struct node *} diskfs_check_lookup_cache (@w{struct node *@var{dir}}, @w{const char *@var{name}}) Scan the cache looking for @var{name} inside @var{dir}. If we don't know any entries at all, then return zero. If the entry is confirmed to not exist, then return -1. Otherwise, return @var{np} for the entry, @@ -3992,7 +3992,7 @@ with a newly-allocated reference. Return the node corresponding to @var{cache_id} in @code{*@var{npp}}. @end deftypefun -@deftypefun void diskfs_enter_lookup_cache (@w{struct node *@var{dir}}, @w{struct node *@var{np}}, @w{char *@var{name}}) +@deftypefun void diskfs_enter_lookup_cache (@w{struct node *@var{dir}}, @w{struct node *@var{np}}, @w{const char *@var{name}}) Node @var{np} has just been found in @var{dir} with @var{name}. If @var{np} is null, that means that this name has been confirmed as absent in the directory. diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c index b6c30840..a6e6f59c 100644 --- a/eth-multiplexer/device_impl.c +++ b/eth-multiplexer/device_impl.c @@ -121,7 +121,7 @@ ds_device_write (struct vether_device *vdev, mach_port_t reply_port, kern_return_t ds_device_write_inband (struct vether_device *vdev, mach_port_t reply_port, mach_msg_type_name_t reply_type, dev_mode_t mode, - recnum_t recnum, const_io_buf_ptr_inband_t data, + recnum_t recnum, const io_buf_ptr_inband_t data, size_t datalen, int *bytes_written) { if (vdev == NULL) diff --git a/eth-multiplexer/netfs_impl.c b/eth-multiplexer/netfs_impl.c index 040512a0..1573d6f3 100644 --- a/eth-multiplexer/netfs_impl.c +++ b/eth-multiplexer/netfs_impl.c @@ -81,7 +81,7 @@ new_node (struct lnode *ln, struct node **np) } struct node * -lookup (char *name) +lookup (const char *name) { struct lnode *ln = (struct lnode *) lookup_dev_by_name (name); @@ -107,7 +107,7 @@ lookup (char *name) locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **node) + const char *name, mode_t mode, struct node **node) { debug(""); *node = 0; @@ -279,7 +279,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, (*NODE, if found, should be locked, this call should unlock DIR no matter what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err = 0; @@ -312,7 +312,7 @@ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, /* Delete NAME in DIR for USER. */ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, - char *name) + const char *name) { debug(""); return EOPNOTSUPP; @@ -320,8 +320,8 @@ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, /* Note that in this one call, neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { debug(""); return EOPNOTSUPP; @@ -330,7 +330,7 @@ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, /* Attempt to create a new directory named NAME in DIR for USER with mode MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { debug(""); return EOPNOTSUPP; @@ -338,7 +338,7 @@ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, /* Attempt to remove directory named NAME in DIR for USER. */ error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) + struct node *dir, const char *name) { debug(""); return EOPNOTSUPP; @@ -387,7 +387,7 @@ error_t netfs_attempt_chmod (struct iouser *cred, struct node *node, /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *node, - char *name) + const char *name) { debug(""); return EOPNOTSUPP; @@ -405,7 +405,7 @@ error_t netfs_attempt_mkdev (struct iouser *cred, struct node *node, /* Attempt to set the passive translator record for FILE to ARGZ (of length ARGZLEN) for user CRED. */ error_t netfs_set_translator (struct iouser *cred, struct node *node, - char *argz, size_t argzlen) + const char *argz, size_t argzlen) { debug(""); return EOPNOTSUPP; @@ -450,7 +450,7 @@ error_t netfs_attempt_syncfs (struct iouser *cred, int wait) DIR nor FILE are locked. If EXCL is set, do not delete the target, but return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { debug(""); return EOPNOTSUPP; @@ -488,7 +488,7 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *node, to *LEN bytes from DATA. Set *LEN to the amount seccessfully written upon return. */ error_t netfs_attempt_write (struct iouser *cred, struct node *node, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { debug(""); return EOPNOTSUPP; diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c index c76cfbfd..8ff39744 100644 --- a/eth-multiplexer/vdev.c +++ b/eth-multiplexer/vdev.c @@ -74,7 +74,7 @@ get_dev_num () } struct vether_device * -lookup_dev_by_name (char *name) +lookup_dev_by_name (const char *name) { struct vether_device *vdev; pthread_mutex_lock (&dev_list_lock); diff --git a/eth-multiplexer/vdev.h b/eth-multiplexer/vdev.h index 5a3011ad..113bb514 100644 --- a/eth-multiplexer/vdev.h +++ b/eth-multiplexer/vdev.h @@ -63,7 +63,7 @@ typedef int (*dev_act_func) (struct vether_device *); int serv_connect (mach_port_t port); int serv_disconnect (); -struct vether_device *lookup_dev_by_name (char *name); +struct vether_device *lookup_dev_by_name (const char *name); int remove_dead_port_from_dev (mach_port_t dead_port); struct vether_device *add_vdev (char *name, size_t size); void destroy_vdev (void *port); diff --git a/exec/exec.c b/exec/exec.c index 06589df9..a50ea632 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -788,8 +788,8 @@ static error_t do_exec (file_t file, task_t oldtask, int flags, - char *path, - char *abspath, + const_string_t path, + const_string_t abspath, char *argv, mach_msg_type_number_t argvlen, boolean_t argv_copy, char *envp, mach_msg_type_number_t envplen, boolean_t envp_copy, mach_port_t *dtable, mach_msg_type_number_t dtablesize, @@ -797,8 +797,8 @@ do_exec (file_t file, mach_port_t *portarray, mach_msg_type_number_t nports, boolean_t portarray_copy, int *intarray, mach_msg_type_number_t nints, boolean_t intarray_copy, - mach_port_t *deallocnames, mach_msg_type_number_t ndeallocnames, - mach_port_t *destroynames, mach_msg_type_number_t ndestroynames) + const mach_port_t *deallocnames, mach_msg_type_number_t ndeallocnames, + const mach_port_t *destroynames, mach_msg_type_number_t ndestroynames) { struct execdata e, interp; task_t newtask = MACH_PORT_NULL; @@ -1585,12 +1585,14 @@ S_exec_exec_paths (struct trivfs_protid *protid, /* There were no user-specified exec servers, or none of them could be found. */ + /* For some of the arrays, we deallocate by hand, thus dropping const. */ + return do_exec (file, oldtask, flags, path, abspath, - argv, argvlen, argv_copy, - envp, envplen, envp_copy, - dtable, dtablesize, dtable_copy, - portarray, nports, portarray_copy, - intarray, nints, intarray_copy, + (char*) argv, argvlen, argv_copy, + (char*) envp, envplen, envp_copy, + (mach_port_t*) dtable, dtablesize, dtable_copy, + (mach_port_t*) portarray, nports, portarray_copy, + (int*) intarray, nints, intarray_copy, deallocnames, ndeallocnames, destroynames, ndestroynames); } @@ -1609,13 +1611,13 @@ S_exec_setexecdata (struct trivfs_protid *protid, return EINVAL; /* */ err = 0; - ports = servercopy (ports, nports * sizeof (mach_port_t), ports_copy, &err); + ports = servercopy ((mach_port_t*) ports, nports * sizeof (mach_port_t), ports_copy, &err); if (err) return err; - ints = servercopy (ints, nints * sizeof (int), ints_copy, &err); + ints = servercopy ((int*) ints, nints * sizeof (int), ints_copy, &err); if (err) { - munmap (ports, nports * sizeof (mach_port_t)); + munmap ((void*) ports, nports * sizeof (mach_port_t)); return err; } @@ -1629,13 +1631,13 @@ S_exec_setexecdata (struct trivfs_protid *protid, munmap (std_ports, std_nports * sizeof (mach_port_t)); } - std_ports = ports; + std_ports = (mach_port_t*) ports; std_nports = nports; if (std_ints) munmap (std_ints, std_nints * sizeof (int)); - std_ints = ints; + std_ints = (int*) ints; std_nints = nints; pthread_rwlock_unlock (&std_lock); diff --git a/exec/hashexec.c b/exec/hashexec.c index 71c02386..9cd5392b 100644 --- a/exec/hashexec.c +++ b/exec/hashexec.c @@ -36,14 +36,14 @@ check_hashbang (struct execdata *e, file_t file, task_t oldtask, int flags, - char *file_name_exec, + const char *file_name_exec, char *argv, u_int argvlen, boolean_t argv_copy, char *envp, u_int envplen, boolean_t envp_copy, mach_port_t *dtable, u_int dtablesize, boolean_t dtable_copy, mach_port_t *portarray, u_int nports, boolean_t portarray_copy, int *intarray, u_int nints, boolean_t intarray_copy, - mach_port_t *deallocnames, u_int ndeallocnames, - mach_port_t *destroynames, u_int ndestroynames) + const mach_port_t *deallocnames, u_int ndeallocnames, + const mach_port_t *destroynames, u_int ndestroynames) { char *p; char *interp, *arg; /* Interpreter file name, and first argument */ diff --git a/exec/priv.h b/exec/priv.h index 07df6e8c..6077932c 100644 --- a/exec/priv.h +++ b/exec/priv.h @@ -136,7 +136,7 @@ void check_hashbang (struct execdata *e, file_t file, task_t oldtask, int flags, - char *filename, + const char *filename, char *argv, u_int argvlen, boolean_t argv_copy, char *envp, u_int envplen, boolean_t envp_copy, mach_port_t *dtable, u_int dtablesize, @@ -144,8 +144,8 @@ void check_hashbang (struct execdata *e, mach_port_t *portarray, u_int nports, boolean_t portarray_copy, int *intarray, u_int nints, boolean_t intarray_copy, - mach_port_t *deallocnames, u_int ndeallocnames, - mach_port_t *destroynames, u_int ndestroynames); + const mach_port_t *deallocnames, u_int ndeallocnames, + const mach_port_t *destroynames, u_int ndestroynames); /* Standard exec data for secure execs. */ diff --git a/ftpfs/netfs.c b/ftpfs/netfs.c index b0c80db1..fb48cbda 100644 --- a/ftpfs/netfs.c +++ b/ftpfs/netfs.c @@ -38,7 +38,7 @@ locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **node) + const char *name, mode_t mode, struct node **node) { *node = 0; pthread_mutex_unlock (&dir->lock); @@ -271,7 +271,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, (*NODE, if found, should be locked, this call should unlock DIR no matter what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err = ftpfs_refresh_node (dir); if (! err) @@ -281,15 +281,15 @@ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, /* Delete NAME in DIR for USER. */ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, - char *name) + const char *name) { return EROFS; } /* Note that in this one call, neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return EROFS; } @@ -297,14 +297,14 @@ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, /* Attempt to create a new directory named NAME in DIR for USER with mode MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EROFS; } /* Attempt to remove directory named NAME in DIR for USER. */ error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) + struct node *dir, const char *name) { return EROFS; } @@ -338,7 +338,7 @@ error_t netfs_attempt_chmod (struct iouser *cred, struct node *node, /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *node, - char *name) + const char *name) { return EROFS; } @@ -354,7 +354,7 @@ error_t netfs_attempt_mkdev (struct iouser *cred, struct node *node, /* Attempt to set the passive translator record for FILE to ARGZ (of length ARGZLEN) for user CRED. */ error_t netfs_set_translator (struct iouser *cred, struct node *node, - char *argz, size_t argzlen) + const char *argz, size_t argzlen) { return EROFS; } @@ -398,7 +398,7 @@ error_t netfs_attempt_syncfs (struct iouser *cred, int wait) DIR nor FILE are locked. If EXCL is set, do not delete the target, but return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { return EROFS; } @@ -453,7 +453,7 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *node, to *LEN bytes from DATA. Set *LEN to the amount seccessfully written upon return. */ error_t netfs_attempt_write (struct iouser *cred, struct node *node, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { return EROFS; } diff --git a/hostmux/mux.c b/hostmux/mux.c index ddca89d1..90630dec 100644 --- a/hostmux/mux.c +++ b/hostmux/mux.c @@ -53,7 +53,7 @@ static error_t lookup_host (struct hostmux *mux, const char *host, what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err; diff --git a/hostmux/node.c b/hostmux/node.c index f1e17769..3f629c30 100644 --- a/hostmux/node.c +++ b/hostmux/node.c @@ -43,7 +43,7 @@ netfs_node_norefs (struct node *node) locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **node) + const char *name, mode_t mode, struct node **node) { *node = 0; pthread_mutex_unlock (&dir->lock); diff --git a/hostmux/stubs.c b/hostmux/stubs.c index 1d94f219..e7399976 100644 --- a/hostmux/stubs.c +++ b/hostmux/stubs.c @@ -22,7 +22,7 @@ /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t -netfs_attempt_mksymlink (struct iouser *cred, struct node *node, char *name) +netfs_attempt_mksymlink (struct iouser *cred, struct node *node, const char *name) { return EOPNOTSUPP; } @@ -40,7 +40,7 @@ netfs_attempt_mkdev (struct iouser *cred, struct node *node, ARGZLEN) for user CRED. */ error_t netfs_set_translator (struct iouser *cred, struct node *node, - char *argz, size_t argzlen) + const char *argz, size_t argzlen) { return EOPNOTSUPP; } @@ -72,7 +72,7 @@ netfs_attempt_statfs (struct iouser *cred, struct node *node, /* Delete NAME in DIR for USER. */ error_t -netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) +netfs_attempt_unlink (struct iouser *user, struct node *dir, const char *name) { return EOPNOTSUPP; } @@ -80,8 +80,8 @@ netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) /* Note that in this one call, neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return EOPNOTSUPP; } @@ -90,15 +90,15 @@ netfs_attempt_rename (struct iouser *user, struct node *fromdir, MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EOPNOTSUPP; } /* Attempt to remove directory named NAME in DIR for USER. */ error_t -netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) +netfs_attempt_rmdir (struct iouser *user, + struct node *dir, const char *name) { return EOPNOTSUPP; } @@ -108,7 +108,7 @@ netfs_attempt_rmdir (struct iouser *user, return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { return EOPNOTSUPP; } @@ -139,7 +139,7 @@ netfs_attempt_read (struct iouser *cred, struct node *node, return. */ error_t netfs_attempt_write (struct iouser *cred, struct node *node, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { return EOPNOTSUPP; } diff --git a/libcons/dir-changed.c b/libcons/dir-changed.c index 9701b056..a4f2eb4a 100644 --- a/libcons/dir-changed.c +++ b/libcons/dir-changed.c @@ -29,7 +29,7 @@ static error_t -add_one (cons_t cons, char *name) +add_one (cons_t cons, const char *name) { unsigned long int nr; char *tail; @@ -45,7 +45,7 @@ add_one (cons_t cons, char *name) } static error_t -lookup_one (cons_t cons, char *name, vcons_list_t *vcons_entry) +lookup_one (cons_t cons, const char *name, vcons_list_t *vcons_entry) { unsigned long int nr; char *tail; diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c index 55439b08..b39868ae 100644 --- a/libdiskfs/dir-lookup.c +++ b/libdiskfs/dir-lookup.c @@ -76,7 +76,7 @@ diskfs_S_dir_lookup (struct protid *dircred, /* Keep a pointer to the start of the filename for length calculations. */ - char *filename_start = filename; + const char *filename_start = filename; *retry_port_type = MACH_MSG_TYPE_MAKE_SEND; *do_retry = FS_RETRY_NORMAL; diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c index b55967f9..36f0c3b8 100644 --- a/libdiskfs/file-set-trans.c +++ b/libdiskfs/file-set-trans.c @@ -198,7 +198,7 @@ diskfs_S_file_set_translator (struct protid *cred, if (!diskfs_create_symlink_hook || err == EINVAL) /* Store the argument in the file as the target of the link */ - err = diskfs_node_rdwr (np, arg, 0, strlen (arg), + err = diskfs_node_rdwr (np, (char*) arg, 0, strlen (arg), 1, cred, 0); if (err) { diff --git a/libdiskfs/io-write.c b/libdiskfs/io-write.c index fa451d8b..154bc887 100644 --- a/libdiskfs/io-write.c +++ b/libdiskfs/io-write.c @@ -76,7 +76,7 @@ diskfs_S_io_write (struct protid *cred, } *amt = datalen; - err = _diskfs_rdwr_internal (np, data, off, amt, 1, 0); + err = _diskfs_rdwr_internal (np, (char*) data, off, amt, 1, 0); if (!err && offset == -1) cred->po->filepointer += *amt; diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c index da17a2d3..87874dc5 100644 --- a/libnetfs/dir-lookup.c +++ b/libnetfs/dir-lookup.c @@ -67,7 +67,7 @@ netfs_S_dir_lookup (struct protid *dircred, /* Keep a pointer to the start of the filename for length calculations. */ - char *filename_start = filename; + const char *filename_start = filename; *retry_port_type = MACH_MSG_TYPE_MAKE_SEND; *do_retry = FS_RETRY_NORMAL; diff --git a/libnetfs/fsys-set-options.c b/libnetfs/fsys-set-options.c index 08af9c3c..2b7e07e0 100644 --- a/libnetfs/fsys-set-options.c +++ b/libnetfs/fsys-set-options.c @@ -28,7 +28,7 @@ struct args { - char *data; + const char *data; mach_msg_type_number_t len; int do_children; }; diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h index b877f0c6..3bab63cd 100644 --- a/libnetfs/netfs.h +++ b/libnetfs/netfs.h @@ -142,7 +142,7 @@ error_t netfs_attempt_chmod (struct iouser *cred, struct node *np, /* The user must define this function. Attempt to turn locked node NP (user CRED) into a symlink with target NAME. */ error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *np, - char *name); + const char *name); /* The user must define this function. Attempt to turn NODE (user CRED) into a device. TYPE is either S_IFBLK or S_IFCHR. NP is @@ -154,7 +154,7 @@ error_t netfs_attempt_mkdev (struct iouser *cred, struct node *np, translator record for FILE to ARGZ (of length ARGZLEN) for user CRED. NP is locked. */ error_t netfs_set_translator (struct iouser *cred, struct node *np, - char *argz, size_t argzlen); + const char *argz, size_t argzlen); /* The user may define this function (but should define it together with netfs_set_translator). For locked node NODE with S_IPTRANS @@ -205,30 +205,30 @@ error_t netfs_attempt_syncfs (struct iouser *cred, int wait); (*NP, if found, should be locked and a reference to it generated. This call should unlock DIR no matter what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **np); + const char *name, struct node **np); /* The user must define this function. Delete NAME in DIR (which is locked) for USER. */ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, - char *name); + const char *name); /* The user must define this function. Attempt to rename the directory FROMDIR to TODIR. Note that neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl); + const char *fromname, struct node *todir, + const char *toname, int excl); /* The user must define this function. Attempt to create a new directory named NAME in DIR (which is locked) for USER with mode MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode); + const char *name, mode_t mode); /* The user must define this function. Attempt to remove directory named NAME in DIR (which is locked) for USER. */ error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name); + struct node *dir, const char *name); /* The user must define this function. Create a link in DIR with name @@ -236,7 +236,7 @@ error_t netfs_attempt_rmdir (struct iouser *user, locked. If EXCL is set, do not delete the target. Return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl); + struct node *file, const char *name, int excl); /* The user must define this function. Attempt to create an anonymous file related to DIR (which is locked) for USER with MODE. Set *NP @@ -249,7 +249,7 @@ error_t netfs_attempt_mkfile (struct iouser *user, struct node *dir, new node upon return. On any error, clear *NP. *NP should be locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **np); + const char *name, mode_t mode, struct node **np); /* The user must define this function. Read the contents of locked node NP (a symlink), for USER, into BUF. */ @@ -275,7 +275,7 @@ error_t netfs_attempt_read (struct iouser *cred, struct node *np, from DATA. Set *LEN to the amount successfully written upon return. */ error_t netfs_attempt_write (struct iouser *cred, struct node *np, - loff_t offset, size_t *len, void *data); + loff_t offset, size_t *len, const void *data); /* The user must define this function. Return the valid access types (bitwise OR of O_READ, O_WRITE, and O_EXEC) in *TYPES for @@ -335,7 +335,7 @@ error_t netfs_get_source (char *source, size_t source_len); /* Parse and execute the runtime options in ARGZ & ARGZ_LEN. EINVAL is returned if some option is unrecognized. The default definition of this routine will parse them using NETFS_RUNTIME_ARGP. */ -error_t netfs_set_options (char *argz, size_t argz_len); +error_t netfs_set_options (const char *argz, size_t argz_len); /* Append to the malloced string *ARGZ of length *ARGZ_LEN a NUL-separated list of the arguments to this translator. The default definition of this diff --git a/libnetfs/set-get-trans.c b/libnetfs/set-get-trans.c index c0a4370e..52e68ac7 100644 --- a/libnetfs/set-get-trans.c +++ b/libnetfs/set-get-trans.c @@ -30,7 +30,7 @@ CRED. */ error_t __attribute__ ((weak)) netfs_set_translator (struct iouser *cred, struct node *np, - char *argz, size_t argzlen) + const char *argz, size_t argzlen) { return EOPNOTSUPP; } diff --git a/libnetfs/set-options.c b/libnetfs/set-options.c index 416d9123..924c570f 100644 --- a/libnetfs/set-options.c +++ b/libnetfs/set-options.c @@ -21,7 +21,7 @@ #include "netfs.h" error_t -netfs_set_options (char *argz, size_t argz_len) +netfs_set_options (const char *argz, size_t argz_len) { if (netfs_runtime_argp) return fshelp_set_options (netfs_runtime_argp, 0, argz, argz_len, 0); diff --git a/libpipe/dgram.c b/libpipe/dgram.c index 30695f1e..96731ff2 100644 --- a/libpipe/dgram.c +++ b/libpipe/dgram.c @@ -25,9 +25,9 @@ /* See the definition of struct pipe_class in "pipe.h" for documentation. */ -static error_t +static error_t dgram_write (struct pq *pq, void *source, - char *data, size_t data_len, size_t *amount) + const char *data, size_t data_len, size_t *amount) { struct packet *packet = pq_queue (pq, PACKET_TYPE_DATA, source); if (!packet) diff --git a/libpipe/pipe.c b/libpipe/pipe.c index 8713a069..53b761d2 100644 --- a/libpipe/pipe.c +++ b/libpipe/pipe.c @@ -328,9 +328,9 @@ pipe_pair_select (struct pipe *rpipe, struct pipe *wpipe, returned, nothing is done. */ error_t pipe_send (struct pipe *pipe, int noblock, void *source, - char *data, size_t data_len, - char *control, size_t control_len, - mach_port_t *ports, size_t num_ports, + const char *data, size_t data_len, + const char *control, size_t control_len, + const mach_port_t *ports, size_t num_ports, size_t *amount) { error_t err; diff --git a/libpipe/pipe.h b/libpipe/pipe.h index eda38d24..1b1ef82f 100644 --- a/libpipe/pipe.h +++ b/libpipe/pipe.h @@ -51,7 +51,7 @@ struct pipe_class char **data, size_t *data_len, size_t amount); /* Write DATA &c into the packet queue PQ. */ error_t (*write)(struct pq *pq, void *source, - char *data, size_t data_len, size_t *amount); + const char *data, size_t data_len, size_t *amount); }; /* pipe_class flags */ @@ -377,9 +377,9 @@ pipe_drain (struct pipe *pipe) of the data, to be provided to any readers of it; if no reader ever reads it, it's deallocated by calling pipe_dealloc_addr. */ error_t pipe_send (struct pipe *pipe, int noblock, void *source, - char *data, size_t data_len, - char *control, size_t control_len, - mach_port_t *ports, size_t num_ports, + const char *data, size_t data_len, + const char *control, size_t control_len, + const mach_port_t *ports, size_t num_ports, size_t *amount); /* Writes up to LEN bytes of DATA, to PIPE, which should be locked, and diff --git a/libpipe/pq.c b/libpipe/pq.c index fe7dd8ae..af380274 100644 --- a/libpipe/pq.c +++ b/libpipe/pq.c @@ -292,7 +292,7 @@ packet_dealloc_ports (struct packet *packet) if a memory allocation error occurred, otherwise, 0. */ error_t packet_set_ports (struct packet *packet, - mach_port_t *ports, size_t num_ports) + const mach_port_t *ports, size_t num_ports) { if (packet->num_ports > 0) packet_dealloc_ports (packet); @@ -333,7 +333,7 @@ packet_read_ports (struct packet *packet, and return the amount appended in AMOUNT if that's not the null pointer. */ error_t packet_write (struct packet *packet, - char *data, size_t data_len, size_t *amount) + const char *data, size_t data_len, size_t *amount) { error_t err = packet_ensure (packet, data_len); diff --git a/libpipe/pq.h b/libpipe/pq.h index 7238ace0..c2f64613 100644 --- a/libpipe/pq.h +++ b/libpipe/pq.h @@ -68,7 +68,7 @@ struct packet /* Sets PACKET's ports to be PORTS, of length NUM_PORTS. ENOMEM is returned if a memory allocation error occurred, otherwise, 0. */ error_t packet_set_ports (struct packet *packet, - mach_port_t *ports, size_t num_ports); + const mach_port_t *ports, size_t num_ports); /* If PACKET has any ports, deallocates them. */ void packet_dealloc_ports (struct packet *packet); @@ -89,7 +89,7 @@ packet_readable (struct packet *packet) /* Append the bytes in DATA, of length DATA_LEN, to what's already in PACKET, and return the amount appended in AMOUNT if that's not the null pointer. */ error_t packet_write (struct packet *packet, - char *data, size_t data_len, size_t *amount); + const char *data, size_t data_len, size_t *amount); /* Removes up to AMOUNT bytes from the beginning of the data in PACKET, and puts it into *DATA, and the amount read into DATA_LEN. If more than the diff --git a/libpipe/seqpack.c b/libpipe/seqpack.c index 041abb74..e34a5379 100644 --- a/libpipe/seqpack.c +++ b/libpipe/seqpack.c @@ -28,9 +28,9 @@ /* This type of pipe is the same as a SOCK_STREAM, but maintains record boundaries. */ -static error_t +static error_t seqpack_write (struct pq *pq, void *source, - char *data, size_t data_len, size_t *amount) + const char *data, size_t data_len, size_t *amount) { struct packet *packet = pq_queue (pq, PACKET_TYPE_DATA, source); if (!packet) diff --git a/libpipe/stream.c b/libpipe/stream.c index 671907e7..758ebb64 100644 --- a/libpipe/stream.c +++ b/libpipe/stream.c @@ -31,9 +31,9 @@ static inline int page_aligned (vm_offset_t num) return trunc_page (num) == num; } -static error_t +static error_t stream_write (struct pq *pq, void *source, - char *data, size_t data_len, size_t *amount) + const char *data, size_t data_len, size_t *amount) { struct packet *packet = pq_tail (pq, PACKET_TYPE_DATA, source); diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c index 446f9ff0..cf44657c 100644 --- a/libtrivfs/fsys-getroot.c +++ b/libtrivfs/fsys-getroot.c @@ -70,7 +70,7 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl, flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS); struct idvec idvec = { - .ids = uids, + .ids = (id_t*) uids, .num = nuids, .alloced = nuids, }; diff --git a/libtrivfs/priv.c b/libtrivfs/priv.c index ec2bcdfc..f4d9898f 100644 --- a/libtrivfs/priv.c +++ b/libtrivfs/priv.c @@ -54,7 +54,7 @@ error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl, mach_port_t reply_port, mach_msg_type_name_t reply_port_type, mach_port_t dotdot, - uid_t *uids, u_int nuids, uid_t *gids, u_int ngids, + const uid_t *uids, u_int nuids, const uid_t *gids, u_int ngids, int flags, retry_type *do_retry, char *retry_name, mach_port_t *node, mach_msg_type_name_t *node_type) diff --git a/libtrivfs/set-options.c b/libtrivfs/set-options.c index af5355f1..8477beb8 100644 --- a/libtrivfs/set-options.c +++ b/libtrivfs/set-options.c @@ -24,7 +24,7 @@ /* Set runtime options for FSYS to ARGZ & ARGZ_LEN. */ error_t -trivfs_set_options (struct trivfs_control *fsys, char *argz, size_t argz_len) +trivfs_set_options (struct trivfs_control *fsys, const char *argz, size_t argz_len) { if (trivfs_runtime_argp) return fshelp_set_options (trivfs_runtime_argp, 0, argz, argz_len, fsys); diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h index 4b96f224..c9e5defa 100644 --- a/libtrivfs/trivfs.h +++ b/libtrivfs/trivfs.h @@ -154,7 +154,7 @@ extern error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl, mach_port_t reply_port, mach_msg_type_name_t reply_port_type, mach_port_t dotdot, - uid_t *uids, u_int nuids, uid_t *gids, u_int ngids, + const uid_t *uids, u_int nuids, const uid_t *gids, u_int ngids, int flags, retry_type *do_retry, char *retry_name, mach_port_t *node, mach_msg_type_name_t *node_type); @@ -234,7 +234,7 @@ extern struct argp *trivfs_runtime_argp; for this routine simply uses TRIVFS_RUNTIME_ARGP (supply FSYS as the argp input field). */ error_t trivfs_set_options (struct trivfs_control *fsys, - char *argz, size_t argz_len); + const char *argz, size_t argz_len); /* Append to the malloced string *ARGZ of length *ARGZ_LEN a NUL-separated list of the arguments to this translator. The default definition of this diff --git a/lwip/iioctl-ops.c b/lwip/iioctl-ops.c index 041da106..d0fe464c 100644 --- a/lwip/iioctl-ops.c +++ b/lwip/iioctl-ops.c @@ -33,7 +33,7 @@ /* Get the interface from its name */ static struct netif * -get_if (char *name) +get_if (const char *name) { char ifname[IFNAMSIZ]; struct netif *netif; diff --git a/lwip/socket-ops.c b/lwip/socket-ops.c index 005e41d3..5b50f58c 100644 --- a/lwip/socket-ops.c +++ b/lwip/socket-ops.c @@ -346,7 +346,7 @@ lwip_S_socket_send (struct sock_user * user, { int sent; int sockflags; - struct iovec iov = { data, datalen }; + struct iovec iov = { (char*) data, datalen }; struct msghdr m = { msg_name:addr ? &addr->address : 0, msg_namelen:addr ? addr->address.sa.sa_len : 0, msg_flags:flags, diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 4afe9a76..fd3a7b22 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -1833,7 +1833,7 @@ void pager_port_list_delete(ds) */ kern_return_t destroy_paging_partition(name, pp_private) - char *name; + const char *name; void **pp_private; { unsigned int id = part_id(name); diff --git a/mach-defpager/default_pager.h b/mach-defpager/default_pager.h index 3f872cc8..9de3b551 100644 --- a/mach-defpager/default_pager.h +++ b/mach-defpager/default_pager.h @@ -28,11 +28,11 @@ void partition_init(); void create_paging_partition(const char *name, struct file_direct *fdp, int isa_file, int linux_signature); -kern_return_t destroy_paging_partition(char *name, void **pp_private); +kern_return_t destroy_paging_partition(const char *name, void **pp_private); kern_return_t add_paging_file(mach_port_t master_device_port, - char *file_name, int linux_signature); -kern_return_t remove_paging_file (char *file_name); + const char *file_name, int linux_signature); +kern_return_t remove_paging_file (const char *file_name); void paging_space_info(vm_size_t *totp, vm_size_t *freep); void no_paging_space(boolean_t out_of_memory); diff --git a/mach-defpager/setup.c b/mach-defpager/setup.c index ffd75c20..a1e7fe4e 100644 --- a/mach-defpager/setup.c +++ b/mach-defpager/setup.c @@ -242,14 +242,14 @@ page_write_file_direct(struct file_direct *fdp, kern_return_t add_paging_file(master_device_port, file_name, linux_signature) mach_port_t master_device_port; - char *file_name; + const char *file_name; int linux_signature; { error_t err; mach_port_t dev; int sizes[DEV_GET_SIZE_COUNT]; natural_t count; - char *devname = file_name; + const char *devname = file_name; assert_backtrace (linux_signature == 0); @@ -292,7 +292,7 @@ add_paging_file(master_device_port, file_name, linux_signature) * Destroy a paging_partition given a file name */ kern_return_t -remove_paging_file (char *file_name) +remove_paging_file (const char *file_name) { struct file_direct *fdp = 0; kern_return_t kr; diff --git a/nfs/name-cache.c b/nfs/name-cache.c index 7553d7c0..73bcc071 100644 --- a/nfs/name-cache.c +++ b/nfs/name-cache.c @@ -107,7 +107,7 @@ find_cache (char *dir, size_t len, const char *name, size_t name_len) name has been confirmed as absent in the directory. DIR is the fhandle of the directory and LEN is its length. */ void -enter_lookup_cache (char *dir, size_t len, struct node *np, char *name) +enter_lookup_cache (char *dir, size_t len, struct node *np, const char *name) { struct lookup_cache *c; size_t name_len = strlen (name); @@ -146,7 +146,7 @@ enter_lookup_cache (char *dir, size_t len, struct node *np, char *name) /* Purge all references in the cache to NAME within directory DIR. */ void -purge_lookup_cache (struct node *dp, char *name, size_t namelen) +purge_lookup_cache (struct node *dp, const char *name, size_t namelen) { struct lookup_cache *c, *next; @@ -245,7 +245,7 @@ register_miss () unlock DIR->LOCK before returning. For positive hits, lock the returned node. */ struct node * -check_lookup_cache (struct node *dir, char *name) +check_lookup_cache (struct node *dir, const char *name) { struct lookup_cache *c; @@ -140,7 +140,7 @@ hurd_mode_to_nfs_type (mode_t mode) /* Encode an NFS file handle. */ int * -xdr_encode_fhandle (int *p, struct fhandle *fhandle) +xdr_encode_fhandle (int *p, const struct fhandle *fhandle) { if (protocol_version == 2) { @@ -153,7 +153,7 @@ xdr_encode_fhandle (int *p, struct fhandle *fhandle) /* Encode uninterpreted bytes. */ int * -xdr_encode_data (int *p, char *data, size_t len) +xdr_encode_data (int *p, const char *data, size_t len) { int nints = INTSIZE (len); @@ -174,7 +174,7 @@ xdr_encode_64bit (int *p, long long n) /* Encode a C string. */ int * -xdr_encode_string (int *p, char *string) +xdr_encode_string (int *p, const char *string) { return xdr_encode_data (p, string, strlen (string)); } @@ -266,7 +266,7 @@ xdr_encode_sattr_size (int *p, off_t size) /* Encode ATIME and MTIME into an otherwise empty sattr. */ int * -xdr_encode_sattr_times (int *p, struct timespec *atime, struct timespec *mtime) +xdr_encode_sattr_times (int *p, const struct timespec *atime, const struct timespec *mtime) { if (protocol_version == 2) { @@ -357,7 +357,7 @@ xdr_encode_create_state (int *p, /* Encode ST into an sattr. */ int * xdr_encode_sattr_stat (int *p, - struct stat *st) + const struct stat *st) { if (protocol_version == 2) { @@ -162,14 +162,14 @@ extern int protocol_version; /* nfs.c */ int hurd_mode_to_nfs_type (mode_t); -int *xdr_encode_fhandle (int *, struct fhandle *); -int *xdr_encode_data (int *, char *, size_t); -int *xdr_encode_string (int *, char *); +int *xdr_encode_fhandle (int *, const struct fhandle *); +int *xdr_encode_data (int *, const char *, size_t); +int *xdr_encode_string (int *, const char *); int *xdr_encode_sattr_mode (int *, mode_t); int *xdr_encode_sattr_ids (int *, u_int, u_int); int *xdr_encode_sattr_size (int *, off_t); -int *xdr_encode_sattr_times (int *, struct timespec *, struct timespec *); -int *xdr_encode_sattr_stat (int *, struct stat *); +int *xdr_encode_sattr_times (int *, const struct timespec *, const struct timespec *); +int *xdr_encode_sattr_stat (int *, const struct stat *); int *xdr_encode_create_state (int *, mode_t, uid_t); int *xdr_decode_fattr (int *, struct stat *); int *xdr_decode_string (int *, char *); @@ -197,9 +197,9 @@ void lookup_fhandle (struct fhandle *, struct node **); int *recache_handle (int *, struct node *); /* name-cache.c */ -void enter_lookup_cache (char *, size_t, struct node *, char *); -void purge_lookup_cache (struct node *, char *, size_t); -struct node *check_lookup_cache (struct node *, char *); +void enter_lookup_cache (char *, size_t, struct node *, const char *); +void purge_lookup_cache (struct node *, const char *, size_t); +struct node *check_lookup_cache (struct node *, const char *); void purge_lookup_cache_node (struct node *); #endif /* NFS_NFS_H */ @@ -516,7 +516,7 @@ netfs_attempt_read (struct iouser *cred, struct node *np, <hurd/netfs.h>. */ error_t netfs_attempt_write (struct iouser *cred, struct node *np, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { int *p; void *rpcbuf; @@ -592,7 +592,7 @@ netfs_attempt_write (struct iouser *cred, struct node *np, /* See if NAME exists in DIR for CRED. If so, return EEXIST. */ error_t verify_nonexistent (struct iouser *cred, struct node *dir, - char *name) + const char *name) { int *p; void *rpcbuf; @@ -630,7 +630,7 @@ verify_nonexistent (struct iouser *cred, struct node *dir, <hurd/netfs.h>. */ error_t netfs_attempt_lookup (struct iouser *cred, struct node *np, - char *name, struct node **newnp) + const char *name, struct node **newnp) { int *p; void *rpcbuf; @@ -704,7 +704,7 @@ netfs_attempt_lookup (struct iouser *cred, struct node *np, <hurd/netfs.h>. */ error_t netfs_attempt_mkdir (struct iouser *cred, struct node *np, - char *name, mode_t mode) + const char *name, mode_t mode) { int *p; void *rpcbuf; @@ -762,7 +762,7 @@ netfs_attempt_mkdir (struct iouser *cred, struct node *np, <hurd/netfs.h>. */ error_t netfs_attempt_rmdir (struct iouser *cred, struct node *np, - char *name) + const char *name) { int *p; void *rpcbuf; @@ -797,7 +797,7 @@ netfs_attempt_rmdir (struct iouser *cred, struct node *np, <hurd/netfs.h>. */ error_t netfs_attempt_link (struct iouser *cred, struct node *dir, - struct node *np, char *name, int excl) + struct node *np, const char *name, int excl) { int *p; void *rpcbuf; @@ -1141,7 +1141,7 @@ netfs_attempt_mkfile (struct iouser *cred, struct node *dir, <hurd/netfs.h>. */ error_t netfs_attempt_create_file (struct iouser *cred, struct node *np, - char *name, mode_t mode, struct node **newnp) + const char *name, mode_t mode, struct node **newnp) { int *p; void *rpcbuf; @@ -1233,7 +1233,7 @@ netfs_attempt_create_file (struct iouser *cred, struct node *np, <hurd/netfs.h>. */ error_t netfs_attempt_unlink (struct iouser *cred, struct node *dir, - char *name) + const char *name) { int *p; void *rpcbuf; @@ -1339,7 +1339,7 @@ netfs_attempt_unlink (struct iouser *cred, struct node *dir, <hurd/netfs.h>. */ error_t netfs_attempt_rename (struct iouser *cred, struct node *fromdir, - char *fromname, struct node *todir, char *toname, + const char *fromname, struct node *todir, const char *toname, int excl) { int *p; @@ -1882,7 +1882,7 @@ netfs_get_dirents (struct iouser *cred, struct node *np, error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *np, - char *arg) + const char *arg) { if (np->nn->dtrans == NOT_POSSIBLE) return EOPNOTSUPP; diff --git a/pci-arbiter/netfs_impl.c b/pci-arbiter/netfs_impl.c index db35d268..b2630f01 100644 --- a/pci-arbiter/netfs_impl.c +++ b/pci-arbiter/netfs_impl.c @@ -120,7 +120,7 @@ get_dirents (struct pcifs_dirent *dir, } static struct pcifs_dirent * -lookup (struct node *np, char *name) +lookup (struct node *np, const char *name) { int i; struct pcifs_dirent *ret = 0, *e; @@ -173,7 +173,7 @@ destroy_node (struct node *node) locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser * user, struct node * dir, - char *name, mode_t mode, struct node ** node) + const char *name, mode_t mode, struct node ** node) { *node = 0; pthread_mutex_unlock (&dir->lock); @@ -255,7 +255,7 @@ netfs_get_dirents (struct iouser * cred, struct node * dir, what.) */ error_t netfs_attempt_lookup (struct iouser * user, struct node * dir, - char *name, struct node ** node) + const char *name, struct node ** node) { error_t err = 0; struct pcifs_dirent *entry; @@ -351,7 +351,7 @@ netfs_attempt_lookup (struct iouser * user, struct node * dir, /* Delete NAME in DIR for USER. */ error_t -netfs_attempt_unlink (struct iouser * user, struct node * dir, char *name) +netfs_attempt_unlink (struct iouser * user, struct node * dir, const char *name) { return EOPNOTSUPP; } @@ -359,8 +359,8 @@ netfs_attempt_unlink (struct iouser * user, struct node * dir, char *name) /* Note that in this one call, neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser * user, struct node * fromdir, - char *fromname, struct node * todir, - char *toname, int excl) + const char *fromname, struct node * todir, + const char *toname, int excl) { return EOPNOTSUPP; } @@ -369,14 +369,14 @@ netfs_attempt_rename (struct iouser * user, struct node * fromdir, MODE. */ error_t netfs_attempt_mkdir (struct iouser * user, struct node * dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EOPNOTSUPP; } /* Attempt to remove directory named NAME in DIR for USER. */ error_t -netfs_attempt_rmdir (struct iouser * user, struct node * dir, char *name) +netfs_attempt_rmdir (struct iouser * user, struct node * dir, const char *name) { return EOPNOTSUPP; } @@ -412,7 +412,7 @@ netfs_attempt_chmod (struct iouser * cred, struct node * node, mode_t mode) /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t -netfs_attempt_mksymlink (struct iouser * cred, struct node * node, char *name) +netfs_attempt_mksymlink (struct iouser * cred, struct node * node, const char *name) { return EOPNOTSUPP; } @@ -468,7 +468,7 @@ netfs_attempt_syncfs (struct iouser * cred, int wait) return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser * user, struct node * dir, - struct node * file, char *name, int excl) + struct node * file, const char *name, int excl) { return EOPNOTSUPP; } @@ -533,14 +533,14 @@ netfs_attempt_read (struct iouser * cred, struct node * node, return. */ error_t netfs_attempt_write (struct iouser * cred, struct node * node, - off_t offset, size_t * len, void *data) + off_t offset, size_t * len, const void *data) { error_t err; if (!strncmp (node->nn->ln->name, FILE_CONFIG_NAME, NAME_SIZE)) { err = - io_config_file (node->nn->ln->device, offset, len, data, + io_config_file (node->nn->ln->device, offset, len, (void*) data, (pci_io_op_t) pci_device_cfg_write); if (!err) { @@ -551,7 +551,7 @@ netfs_attempt_write (struct iouser * cred, struct node * node, else if (!strncmp (node->nn->ln->name, FILE_REGION_NAME, strlen (FILE_REGION_NAME))) { - err = io_region_file (node->nn->ln, offset, len, data, 0); + err = io_region_file (node->nn->ln, offset, len, (void*) data, 0); if (!err) /* Update atime */ UPDATE_TIMES (node->nn->ln, TOUCH_MTIME | TOUCH_CTIME); diff --git a/pfinet/iioctl-ops.c b/pfinet/iioctl-ops.c index bccc5e6b..191c6591 100644 --- a/pfinet/iioctl-ops.c +++ b/pfinet/iioctl-ops.c @@ -47,7 +47,7 @@ extern void inquire_device (struct device *dev, uint32_t *addr, uint32_t *broadcast); /* Truncate name, take the global lock and find device with this name. */ -struct device *get_dev (char *name) +struct device *get_dev (const char *name) { char ifname[IFNAMSIZ]; struct device *dev; diff --git a/procfs/netfs.c b/procfs/netfs.c index 9410bddd..f68435d4 100644 --- a/procfs/netfs.c +++ b/procfs/netfs.c @@ -205,7 +205,7 @@ error_t netfs_get_dirents (struct iouser *cred, struct node *dir, (*NP, if found, should be locked and a reference to it generated. This call should unlock DIR no matter what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **np) + const char *name, struct node **np) { error_t err; @@ -309,7 +309,7 @@ error_t netfs_attempt_chmod (struct iouser *cred, struct node *np, /* The user must define this function. Attempt to turn locked node NP (user CRED) into a symlink with target NAME. */ error_t netfs_attempt_mksymlink (struct iouser *cred, struct node *np, - char *name) + const char *name) { return EROFS; } @@ -382,7 +382,7 @@ error_t netfs_attempt_syncfs (struct iouser *cred, int wait) /* The user must define this function. Delete NAME in DIR (which is locked) for USER. */ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, - char *name) + const char *name) { return EROFS; } @@ -391,8 +391,8 @@ error_t netfs_attempt_unlink (struct iouser *user, struct node *dir, directory FROMDIR to TODIR. Note that neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return EROFS; } @@ -401,7 +401,7 @@ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, directory named NAME in DIR (which is locked) for USER with mode MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EROFS; } @@ -409,7 +409,7 @@ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, /* The user must define this function. Attempt to remove directory named NAME in DIR (which is locked) for USER. */ error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) + struct node *dir, const char *name) { return EROFS; } @@ -420,7 +420,7 @@ error_t netfs_attempt_rmdir (struct iouser *user, locked. If EXCL is set, do not delete the target. Return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { return EROFS; } @@ -439,7 +439,7 @@ error_t netfs_attempt_mkfile (struct iouser *user, struct node *dir, new node upon return. On any error, clear *NP. *NP should be locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **np) + const char *name, mode_t mode, struct node **np) { return EROFS; } @@ -449,7 +449,7 @@ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, from DATA. Set *LEN to the amount successfully written upon return. */ error_t netfs_attempt_write (struct iouser *cred, struct node *np, - loff_t offset, size_t *len, void *data) + loff_t offset, size_t *len, const void *data) { return EROFS; } diff --git a/rumpdisk/block-rump.c b/rumpdisk/block-rump.c index 946792a5..c14ca7af 100644 --- a/rumpdisk/block-rump.c +++ b/rumpdisk/block-rump.c @@ -74,7 +74,7 @@ static struct block_data *block_head; static struct machdev_device_emulation_ops rump_block_emulation_ops; static struct block_data * -search_bd (char *name) +search_bd (const char *name) { struct block_data *bd = block_head; @@ -90,13 +90,13 @@ search_bd (char *name) /* BSD name of whole disk device is /dev/rwdXd * but we will receive wdX as the name */ static void -translate_name (char *output, int len, char *name) +translate_name (char *output, int len, const char *name) { snprintf (output, len - 1, "/dev/r%sd", name); } static boolean_t -is_disk_device (char *name) +is_disk_device (const char *name) { const char *dev; const char *allowed_devs[MAX_DISK_DEV] = { diff --git a/storeio/dev.c b/storeio/dev.c index c229f37b..8726c94c 100644 --- a/storeio/dev.c +++ b/storeio/dev.c @@ -342,7 +342,7 @@ dev_rw (struct dev *dev, off_t offs, size_t len, size_t *amount, AMOUNT. If successful, 0 is returned, otherwise an error code is returned. */ error_t -dev_write (struct dev *dev, off_t offs, void *buf, size_t len, +dev_write (struct dev *dev, off_t offs, const void *buf, size_t len, size_t *amount) { error_t buf_write (size_t buf_offs, size_t io_offs, size_t len) diff --git a/storeio/dev.h b/storeio/dev.h index 139668a7..eda7a93d 100644 --- a/storeio/dev.h +++ b/storeio/dev.h @@ -115,7 +115,7 @@ error_t dev_sync (struct dev *dev, int wait); /* Write LEN bytes from BUF to DEV, returning the amount actually written in AMOUNT. If successful, 0 is returned, otherwise an error code is returned. */ -error_t dev_write (struct dev *dev, off_t offs, void *buf, size_t len, +error_t dev_write (struct dev *dev, off_t offs, const void *buf, size_t len, size_t *amount); /* Read up to AMOUNT bytes from DEV, returned in BUF and LEN in the with the diff --git a/storeio/io.c b/storeio/io.c index 94bd559a..634185f7 100644 --- a/storeio/io.c +++ b/storeio/io.c @@ -134,7 +134,7 @@ trivfs_S_io_write (struct trivfs_protid *cred, return EBADF; else return open_write ((struct open *)cred->po->hook, - offs, (void *)data, data_len, amount); + offs, data, data_len, amount); } /* Change current read/write offset */ diff --git a/storeio/open.c b/storeio/open.c index f6a641d7..4c2870c6 100644 --- a/storeio/open.c +++ b/storeio/open.c @@ -52,7 +52,7 @@ open_free (struct open *open) and returns the number of bytes written in AMOUNT. If no error occurs, zero is returned, otherwise the error code is returned. */ error_t -open_write (struct open *open, off_t offs, void *buf, size_t len, +open_write (struct open *open, off_t offs, const void *buf, size_t len, vm_size_t *amount) { error_t err; diff --git a/storeio/open.h b/storeio/open.h index 78ad95ca..6be930a6 100644 --- a/storeio/open.h +++ b/storeio/open.h @@ -50,7 +50,7 @@ void open_free (struct open *open); (which may be ignored if the device doesn't support random access), and returns the number of bytes written in AMOUNT. If no error occurs, zero is returned, otherwise the error code is returned. */ -error_t open_write (struct open *open, off_t offs, void *buf, size_t len, +error_t open_write (struct open *open, off_t offs, const void *buf, size_t len, size_t *amount); /* Reads up to AMOUNT bytes from the device into BUF and BUF_LEN using the diff --git a/storeio/storeio.c b/storeio/storeio.c index 7ed82379..872b388f 100644 --- a/storeio/storeio.c +++ b/storeio/storeio.c @@ -200,7 +200,7 @@ getroot_hook (struct trivfs_control *cntl, mach_port_t reply_port, mach_msg_type_name_t reply_port_type, mach_port_t dotdot, - uid_t *uids, u_int nuids, uid_t *gids, u_int ngids, + const uid_t *uids, u_int nuids, const uid_t *gids, u_int ngids, int flags, retry_type *do_retry, char *retry_name, mach_port_t *node, mach_msg_type_name_t *node_type) @@ -386,7 +386,7 @@ error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl, mach_port_t reply_port, mach_msg_type_name_t reply_port_type, mach_port_t dotdot, - uid_t *uids, u_int nuids, uid_t *gids, u_int ngids, + const uid_t *uids, u_int nuids, const uid_t *gids, u_int ngids, int flags, retry_type *do_retry, char *retry_name, mach_port_t *node, mach_msg_type_name_t *node_type) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index c43a1c00..944fafdb 100644 --- a/trans/fakeroot.c +++ b/trans/fakeroot.c @@ -517,7 +517,7 @@ netfs_S_dir_lookup (struct protid *diruser, CRED. */ error_t netfs_set_translator (struct iouser *cred, struct node *np, - char *argz, size_t argzlen) + const char *argz, size_t argzlen) { return file_set_translator (netfs_node_netnode (np)->file, FS_TRANS_EXCL|FS_TRANS_SET, @@ -530,7 +530,7 @@ netfs_set_translator (struct iouser *cred, struct node *np, which we do not use. But the shared library requires us to define them. */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **np) + const char *name, struct node **np) { assert_backtrace (! "should not be here"); return EIEIO; @@ -538,7 +538,7 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir, error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **np) + const char *name, mode_t mode, struct node **np) { assert_backtrace (! "should not be here"); return EIEIO; @@ -640,7 +640,7 @@ netfs_attempt_chmod (struct iouser *cred, struct node *np, mode_t mode) /* The user must define this function. Attempt to turn locked node NP (user CRED) into a symlink with target NAME. */ error_t -netfs_attempt_mksymlink (struct iouser *cred, struct node *np, char *name) +netfs_attempt_mksymlink (struct iouser *cred, struct node *np, const char *name) { int namelen = strlen (name) + 1; char trans[sizeof _HURD_SYMLINK + namelen]; @@ -755,7 +755,7 @@ netfs_attempt_syncfs (struct iouser *cred, int wait) error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return dir_mkdir (netfs_node_netnode (dir)->file, name, mode | S_IRWXU); } @@ -767,15 +767,15 @@ netfs_attempt_mkdir (struct iouser *user, struct node *dir, */ error_t -netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) +netfs_attempt_unlink (struct iouser *user, struct node *dir, const char *name) { return dir_unlink (netfs_node_netnode (dir)->file, name); } error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return dir_rename (netfs_node_netnode (fromdir)->file, fromname, netfs_node_netnode (todir)->file, toname, excl); @@ -783,14 +783,14 @@ netfs_attempt_rename (struct iouser *user, struct node *fromdir, error_t netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) + struct node *dir, const char *name) { return dir_rmdir (netfs_node_netnode (dir)->file, name); } error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { return dir_link (netfs_node_netnode (dir)->file, netfs_node_netnode (file)->file, name, excl); } @@ -861,7 +861,7 @@ netfs_attempt_read (struct iouser *cred, struct node *np, error_t netfs_attempt_write (struct iouser *cred, struct node *np, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { return io_write (netfs_node_netnode (np)->file, data, *len, offset, len); } diff --git a/trans/firmlink.c b/trans/firmlink.c index dba5e4ef..8a5d01a8 100644 --- a/trans/firmlink.c +++ b/trans/firmlink.c @@ -140,7 +140,7 @@ static error_t getroot (struct trivfs_control *cntl, mach_port_t reply_port, mach_msg_type_name_t reply_port_type, mach_port_t dotdot, - uid_t *uids, u_int nuids, uid_t *gids, u_int ngids, + const uid_t *uids, u_int nuids, const uid_t *gids, u_int ngids, int flags, retry_type *do_retry, char *retry_name, mach_port_t *node, mach_msg_type_name_t *node_type) diff --git a/trans/magic.c b/trans/magic.c index bc23e719..4e534e7a 100644 --- a/trans/magic.c +++ b/trans/magic.c @@ -150,7 +150,7 @@ magic_getroot (struct trivfs_control *cntl, mach_port_t reply_port, mach_msg_type_name_t reply_port_type, mach_port_t dotdot, - uid_t *uids, u_int nuids, uid_t *gids, u_int ngids, + const uid_t *uids, u_int nuids, const uid_t *gids, u_int ngids, int flags, retry_type *do_retry, char *retry_name, mach_port_t *node, mach_msg_type_name_t *node_type) diff --git a/trans/streamio.c b/trans/streamio.c index 566f0aa5..30b8b20e 100644 --- a/trans/streamio.c +++ b/trans/streamio.c @@ -143,7 +143,7 @@ buffer_read (struct buffer *b, void *data, size_t len) /* Write LEN bytes from DATA to B, returning the amount actually written. */ static inline size_t -buffer_write (struct buffer *b, void *data, size_t len) +buffer_write (struct buffer *b, const void *data, size_t len) { size_t size = buffer_writable (b); @@ -182,7 +182,7 @@ error_t dev_readable (size_t *amount); in AMOUNT. If NOWAIT is non-zero and the buffer is full, then returns EWOULDBLOCK. If an error occurs, the error code is returned, otherwise 0. */ -error_t dev_write (void *buf, size_t len, size_t *amount, int nowait); +error_t dev_write (const void *buf, size_t len, size_t *amount, int nowait); /* Try and write out any pending writes to the device. If WAIT is non-zero, will wait for any activity to cease. */ @@ -532,7 +532,7 @@ trivfs_S_io_write (struct trivfs_protid *cred, return EBADF; pthread_mutex_lock (&global_lock); - err = dev_write ((void *)data, data_len, amount, cred->po->openmodes & O_NONBLOCK); + err = dev_write (data, data_len, amount, cred->po->openmodes & O_NONBLOCK); pthread_mutex_unlock (&global_lock); return err; } @@ -1092,7 +1092,7 @@ start_output (int nowait) otherwise 0. */ /* Be careful that the global lock is already locked. */ error_t -dev_write (void *buf, size_t len, size_t *amount, int nowait) +dev_write (const void *buf, size_t len, size_t *amount, int nowait) { if (err) return err; diff --git a/usermux/mux.c b/usermux/mux.c index 7c57f940..c0bda94f 100644 --- a/usermux/mux.c +++ b/usermux/mux.c @@ -55,7 +55,7 @@ static error_t lookup_user (struct usermux *mux, const char *user, what.) */ error_t netfs_attempt_lookup (struct iouser *user, struct node *dir, - char *name, struct node **node) + const char *name, struct node **node) { error_t err; diff --git a/usermux/node.c b/usermux/node.c index 66bf79b1..4d02c242 100644 --- a/usermux/node.c +++ b/usermux/node.c @@ -45,7 +45,7 @@ netfs_node_norefs (struct node *node) locked on success; no matter what, unlock DIR before returning. */ error_t netfs_attempt_create_file (struct iouser *user, struct node *dir, - char *name, mode_t mode, struct node **node) + const char *name, mode_t mode, struct node **node) { *node = 0; pthread_mutex_unlock (&dir->lock); diff --git a/usermux/stubs.c b/usermux/stubs.c index b1992b02..9943f379 100644 --- a/usermux/stubs.c +++ b/usermux/stubs.c @@ -22,7 +22,7 @@ /* Attempt to turn NODE (user CRED) into a symlink with target NAME. */ error_t -netfs_attempt_mksymlink (struct iouser *cred, struct node *node, char *name) +netfs_attempt_mksymlink (struct iouser *cred, struct node *node, const char *name) { return EOPNOTSUPP; } @@ -40,7 +40,7 @@ netfs_attempt_mkdev (struct iouser *cred, struct node *node, ARGZLEN) for user CRED. */ error_t netfs_set_translator (struct iouser *cred, struct node *node, - char *argz, size_t argzlen) + const char *argz, size_t argzlen) { return EOPNOTSUPP; } @@ -72,7 +72,7 @@ netfs_attempt_statfs (struct iouser *cred, struct node *node, /* Delete NAME in DIR for USER. */ error_t -netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) +netfs_attempt_unlink (struct iouser *user, struct node *dir, const char *name) { return EOPNOTSUPP; } @@ -80,8 +80,8 @@ netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) /* Note that in this one call, neither of the specific nodes are locked. */ error_t netfs_attempt_rename (struct iouser *user, struct node *fromdir, - char *fromname, struct node *todir, - char *toname, int excl) + const char *fromname, struct node *todir, + const char *toname, int excl) { return EOPNOTSUPP; } @@ -90,15 +90,15 @@ netfs_attempt_rename (struct iouser *user, struct node *fromdir, MODE. */ error_t netfs_attempt_mkdir (struct iouser *user, struct node *dir, - char *name, mode_t mode) + const char *name, mode_t mode) { return EOPNOTSUPP; } /* Attempt to remove directory named NAME in DIR for USER. */ error_t -netfs_attempt_rmdir (struct iouser *user, - struct node *dir, char *name) +netfs_attempt_rmdir (struct iouser *user, + struct node *dir, const char *name) { return EOPNOTSUPP; } @@ -108,7 +108,7 @@ netfs_attempt_rmdir (struct iouser *user, return EEXIST if NAME is already found in DIR. */ error_t netfs_attempt_link (struct iouser *user, struct node *dir, - struct node *file, char *name, int excl) + struct node *file, const char *name, int excl) { return EOPNOTSUPP; } @@ -137,7 +137,7 @@ netfs_attempt_read (struct iouser *cred, struct node *node, return. */ error_t netfs_attempt_write (struct iouser *cred, struct node *node, - off_t offset, size_t *len, void *data) + off_t offset, size_t *len, const void *data) { return EOPNOTSUPP; } |