diff options
-rw-r--r-- | lnode.c | 6 | ||||
-rw-r--r-- | lnode.h | 4 | ||||
-rw-r--r-- | node.c | 5 | ||||
-rw-r--r-- | node.h | 4 | ||||
-rw-r--r-- | nsmux.c | 32 | ||||
-rw-r--r-- | nsmux.h | 28 |
6 files changed, 42 insertions, 37 deletions
@@ -27,6 +27,8 @@ /*---------------------------------------------------------------------------*/ #define _GNU_SOURCE /*---------------------------------------------------------------------------*/ +#include <assert.h> +/*---------------------------------------------------------------------------*/ #include "lnode.h" #include "debug.h" #include "node.h" @@ -67,7 +69,7 @@ void lnode_ref_remove (lnode_t * node) /*---------------------------------------------------------------------------*/ /*Creates a new lnode with `name`; the new node is locked and contains a single reference*/ -error_t lnode_create (char *name, lnode_t ** node) +error_t lnode_create (const char *name, lnode_t ** node) { /*Allocate the memory for the node */ lnode_t *node_new = malloc (sizeof (lnode_t)); @@ -223,7 +225,7 @@ error_t lnode_path_construct (lnode_t * node, char **path) /*---------------------------------------------------------------------------*/ /*Gets a light node by its name, locks it and increments its refcount*/ error_t lnode_get (lnode_t * dir, /*search here */ - char *name, /*search for this name */ + const char *name, /*search for this name */ lnode_t ** node /*put the result here */ ) { @@ -107,7 +107,7 @@ void lnode_ref_remove (lnode_t * node); /*---------------------------------------------------------------------------*/ /*Creates a new lnode with `name`; the new node is locked and contains a single reference*/ -error_t lnode_create (char *name, lnode_t ** node); +error_t lnode_create (const char *name, lnode_t ** node); /*---------------------------------------------------------------------------*/ /*Destroys the given lnode*/ void lnode_destroy (lnode_t * node); @@ -119,7 +119,7 @@ error_t lnode_path_construct (lnode_t * node, char **path); /*---------------------------------------------------------------------------*/ /*Gets a light node by its name, locks it and increments its refcount*/ error_t lnode_get (lnode_t * dir, /*search here */ - char *name, /*search for this name */ + const char *name, /*search for this name */ lnode_t ** node /*put the result here */ ); /*---------------------------------------------------------------------------*/ @@ -34,6 +34,7 @@ #include <stdio.h> #include <argz.h> #include <hurd/fsys.h> +#include <assert.h> /*---------------------------------------------------------------------------*/ #include "debug.h" #include "node.h" @@ -728,8 +729,8 @@ error_t node_unlink_file (node_t * dir, char *name) of the translator opened as `flags.`*/ error_t node_set_translator - (struct protid * diruser, node_t * np, char * trans, int flags, - char * filename, mach_port_t * port) + (struct protid * diruser, node_t * np, const char * trans, int flags, + const char * filename, mach_port_t * port) { error_t err; mach_port_t p; @@ -151,8 +151,8 @@ error_t node_unlink_file (node_t * dir, char *name); of the translator opened as `flags.`*/ error_t node_set_translator - (struct protid *diruser, node_t * np, char * trans, int flags, - char * filename, mach_port_t * port); + (struct protid *diruser, node_t * np, const char * trans, int flags, + const char * filename, mach_port_t * port); /*---------------------------------------------------------------------------*/ /*Gets the port to the supplied node. */ error_t @@ -35,6 +35,8 @@ #include <fcntl.h> #include <hurd/paths.h> #include <hurd/fsys.h> +#include <assert.h> +#include <sys/sysmacros.h> /*---------------------------------------------------------------------------*/ #include "debug.h" #include "options.h" @@ -75,7 +77,7 @@ FILE *nsmux_dbg; error_t netfs_attempt_create_file (struct iouser *user, - struct node *dir, char *name, mode_t mode, struct node **node) + struct node *dir, const char *name, mode_t mode, struct node **node) { LOG_MSG ("netfs_attempt_create_file"); @@ -456,7 +458,7 @@ error_t /*Looks up `name` under `dir` for `user`*/ error_t netfs_attempt_lookup - (struct iouser * user, struct node * dir, char *name, struct node ** node) + (struct iouser * user, struct node * dir, const char *name, struct node ** node) { LOG_MSG ("netfs_attempt_lookup"); @@ -474,7 +476,7 @@ error_t create a proxy node and return it in `node`.*/ error_t netfs_attempt_lookup_improved - (struct iouser * user, struct node * dir, char *name, int flags, + (struct iouser * user, struct node * dir, const char *name, int flags, int lastcomp, node_t ** node, file_t * file, int proxy) { LOG_MSG ("netfs_attempt_lookup_improved: '%s'", name); @@ -588,7 +590,7 @@ error_t } /*finalize */ /*Performs a usual lookup */ - error_t lookup (char *name, /*lookup this */ + error_t lookup (const char *name, /*lookup this */ int flags, /*lookup `name` in the this way */ int proxy /*should a proxy node be created */ ) @@ -745,7 +747,7 @@ error_t error_t netfs_S_dir_lookup (struct protid * diruser, - char *filename, + const char *filename, int flags, mode_t mode, retry_type * do_retry, @@ -1109,8 +1111,8 @@ error_t if (asprintf (argz, "%s%c%d%c%d", (S_ISCHR (np->nn_translated) ? _HURD_CHRDEV : _HURD_BLKDEV), - 0, major (np->nn_stat.st_rdev), - 0, minor (np->nn_stat.st_rdev)) < 0) + 0, gnu_dev_major (np->nn_stat.st_rdev), + 0, gnu_dev_minor (np->nn_stat.st_rdev)) < 0) return ENOMEM; *argz_len = strlen (*argz) + 1; *argz_len += strlen (*argz + *argz_len) + 1; @@ -1341,7 +1343,7 @@ out: /*---------------------------------------------------------------------------*/ /*Deletes `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) { LOG_MSG ("netfs_attempt_unlink"); @@ -1354,7 +1356,7 @@ 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) { LOG_MSG ("netfs_attempt_rename"); @@ -1366,7 +1368,7 @@ error_t /*Attempts to create a new directory*/ error_t netfs_attempt_mkdir - (struct iouser * user, struct node * dir, char *name, mode_t mode) + (struct iouser * user, struct node * dir, const char *name, mode_t mode) { LOG_MSG ("netfs_attempt_mkdir"); @@ -1376,7 +1378,7 @@ error_t /*---------------------------------------------------------------------------*/ /*Attempts to remove directory `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) { LOG_MSG ("netfs_attempt_rmdir"); @@ -1422,7 +1424,7 @@ error_t /*Attempts to turn `node` into a symlink targetting `name`*/ error_t netfs_attempt_mksymlink - (struct iouser * cred, struct node * node, char *name) + (struct iouser * cred, struct node * node, const char *name) { LOG_MSG ("netfs_attempt_mksymlink"); @@ -1447,7 +1449,7 @@ error_t /*Attempts to set the passive translator record for `file` passing `argz`*/ error_t netfs_set_translator - (struct iouser * cred, struct node * node, char *argz, size_t arglen) + (struct iouser * cred, struct node * node, const char *argz, size_t arglen) { LOG_MSG ("netfs_set_translator"); @@ -1505,7 +1507,7 @@ error_t netfs_attempt_syncfs (struct iouser * cred, int wait) error_t netfs_attempt_link (struct iouser * user, - struct node * dir, struct node * file, char *name, int excl) + struct node * dir, struct node * file, const char *name, int excl) { LOG_MSG ("netfs_attempt_link"); @@ -1576,7 +1578,7 @@ error_t error_t netfs_attempt_write (struct iouser * cred, - struct node * node, loff_t offset, size_t * len, void *data) + struct node * node, loff_t offset, size_t * len, const void *data) { /*Write the supplied data into the file and return the result */ return io_write (node->nn->port, data, *len, offset, len); @@ -64,8 +64,8 @@ extern mach_port_t underlying_node; extern io_statbuf_t underlying_node_stat; /*---------------------------------------------------------------------------*/ /*The translator callbacks required by netfs_S_dir_lookup*/ -fshelp_fetch_root_callback1_t _netfs_translator_callback1; -fshelp_fetch_root_callback2_t _netfs_translator_callback2; +extern fshelp_fetch_root_callback1_t _netfs_translator_callback1; +extern fshelp_fetch_root_callback2_t _netfs_translator_callback2; /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -74,7 +74,7 @@ fshelp_fetch_root_callback2_t _netfs_translator_callback2; error_t netfs_attempt_create_file (struct iouser *user, - struct node *dir, char *name, mode_t mode, struct node **node); + struct node *dir, const char *name, mode_t mode, struct node **node); /*---------------------------------------------------------------------------*/ /*Returns an error if the process of opening a file should not be allowed to complete because of insufficient permissions*/ @@ -112,7 +112,7 @@ error_t /*Looks up `name` under `dir` for `user`*/ error_t netfs_attempt_lookup - (struct iouser *user, struct node *dir, char *name, struct node **node); + (struct iouser *user, struct node *dir, const char *name, struct node **node); /*---------------------------------------------------------------------------*/ /*Performs an advanced lookup of file `name` under `dir`. If the lookup of the last component of the path is requested (`lastcomp` is @@ -122,14 +122,14 @@ error_t proxy node and return it in `node`.*/ error_t netfs_attempt_lookup_improved - (struct iouser * user, struct node * dir, char *name, int flags, + (struct iouser * user, struct node * dir, const char *name, int flags, int lastcomp, node_t ** node, file_t * file, int proxy); /*---------------------------------------------------------------------------*/ /*Responds to the RPC dir_lookup*/ error_t netfs_S_dir_lookup (struct protid *diruser, - char *filename, + const char *filename, int flags, mode_t mode, retry_type * do_retry, @@ -138,23 +138,23 @@ error_t /*---------------------------------------------------------------------------*/ /*Deletes `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); /*---------------------------------------------------------------------------*/ /*Attempts to rename `fromdir`/`fromname` to `todir`/`toname`*/ 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); /*---------------------------------------------------------------------------*/ /*Attempts to create a new directory*/ error_t netfs_attempt_mkdir - (struct iouser *user, struct node *dir, char *name, mode_t mode); + (struct iouser *user, struct node *dir, const char *name, mode_t mode); /*---------------------------------------------------------------------------*/ /*Attempts to remove directory `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); /*---------------------------------------------------------------------------*/ /*Attempts to change the owner of `node` for user `cred` to `uid`:`gid`*/ error_t @@ -173,7 +173,7 @@ error_t /*Attempts to turn `node` into a symlink targetting `name`*/ error_t netfs_attempt_mksymlink - (struct iouser *cred, struct node *node, char *name); + (struct iouser *cred, struct node *node, const char *name); /*---------------------------------------------------------------------------*/ /*Attempts to turn `node` into a device; type can be either S_IFBLK or S_IFCHR*/ error_t @@ -183,7 +183,7 @@ error_t /*Attempts to set the passive translator record for `file` passing `argz`*/ error_t netfs_set_translator - (struct iouser *cred, struct node *node, char *argz, size_t arglen); + (struct iouser *cred, struct node *node, const char *argz, size_t arglen); /*---------------------------------------------------------------------------*/ /*Attempts to call chflags for `node`*/ error_t @@ -206,7 +206,7 @@ error_t netfs_attempt_syncfs (struct iouser *cred, int wait); error_t netfs_attempt_link (struct iouser *user, - struct node *dir, struct node *file, char *name, int excl); + struct node *dir, struct node *file, const char *name, int excl); /*---------------------------------------------------------------------------*/ /*Attempts to create an anonymous file related to `dir` with `mode`*/ error_t @@ -227,7 +227,7 @@ error_t error_t netfs_attempt_write (struct iouser *cred, - struct node *node, loff_t offset, size_t * len, void *data); + struct node *node, loff_t offset, size_t * len, const void *data); /*---------------------------------------------------------------------------*/ /*Frees all storage associated with the node*/ void netfs_node_norefs (struct node *np); |