And a few other related warning fixes.
Change-Id: I1a49b9ee04c2b1bf80bc943272f72ffd6de77ef6
#define SFFS_ATTR_MODE 0x20 /* get/set file mode */
struct sffs_table {
- int (*t_open)(char *path, int flags, int mode, sffs_file_t *handle);
+ int (*t_open)(const char *path, int flags, int mode, sffs_file_t *handle);
ssize_t (*t_read)(sffs_file_t handle, char *buf, size_t size, u64_t pos);
ssize_t (*t_write)(sffs_file_t handle, char *buf, size_t size, u64_t pos);
int (*t_close)(sffs_file_t handle);
size_t (*t_readbuf)(char **ptr);
size_t (*t_writebuf)(char **ptr);
- int (*t_opendir)(char *path, sffs_dir_t *handle);
+ int (*t_opendir)(const char *path, sffs_dir_t *handle);
int (*t_readdir)(sffs_dir_t handle, unsigned int index, char *buf,
size_t size, struct sffs_attr *attr);
int (*t_closedir)(sffs_dir_t handle);
- int (*t_getattr)(char *path, struct sffs_attr *attr);
- int (*t_setattr)(char *path, struct sffs_attr *attr);
+ int (*t_getattr)(const char *path, struct sffs_attr *attr);
+ int (*t_setattr)(const char *path, struct sffs_attr *attr);
- int (*t_mkdir)(char *path, int mode);
- int (*t_unlink)(char *path);
- int (*t_rmdir)(char *path);
- int (*t_rename)(char *opath, char *npath);
+ int (*t_mkdir)(const char *path, int mode);
+ int (*t_unlink)(const char *path);
+ int (*t_rmdir)(const char *path);
+ int (*t_rename)(const char *opath, const char *npath);
- int (*t_queryvol)(char *path, u64_t *free, u64_t *total);
+ int (*t_queryvol)(const char *path, u64_t *free, u64_t *total);
};
struct sffs_params {
extern int vbox_init(void);
-extern vbox_conn_t vbox_open(char *name);
+extern vbox_conn_t vbox_open(const char *name);
extern int vbox_close(vbox_conn_t conn);
extern int vbox_call(vbox_conn_t conn, u32_t function, vbox_param_t *param,
int count, int *code);
-NOGCCERROR=yes
-NOCLANGERROR=yes
-
# Makefile for HGFS library
LIB= hgfs
/*===========================================================================*
* hgfs_getattr *
*===========================================================================*/
-int hgfs_getattr(char *path, struct sffs_attr *attr)
+int hgfs_getattr(const char *path, struct sffs_attr *attr)
{
/* Get selected attributes of a file by path name.
*/
/*===========================================================================*
* hgfs_setattr *
*===========================================================================*/
-int hgfs_setattr(char *path, struct sffs_attr *attr)
+int hgfs_setattr(const char *path, struct sffs_attr *attr)
{
/* Set selected attributes of a file by path name.
*/
/*===========================================================================*
* hgfs_opendir *
*===========================================================================*/
-int hgfs_opendir(char *path, sffs_dir_t *handle)
+int hgfs_opendir(const char *path, sffs_dir_t *handle)
{
/* Open a directory. Store a directory handle upon success.
*/
* hgfs_open *
*===========================================================================*/
int hgfs_open(
- char *path, /* path name to open */
+ const char *path, /* path name to open */
int flags, /* open flags to use */
int mode, /* mode to create (user bits only) */
sffs_file_t *handle /* place to store resulting handle */
{
/* Read from an open file. Upon success, return the number of bytes read.
*/
- int r, len, max;
+ size_t len, max;
+ int r;
RPC_REQUEST(HGFS_REQ_READ);
RPC_NEXT32 = (u32_t)handle;
/*===========================================================================*
* hgfs_queryvol *
*===========================================================================*/
-int hgfs_queryvol(char *path, u64_t *free, u64_t *total)
+int hgfs_queryvol(const char *path, u64_t *free, u64_t *total)
{
/* Retrieve information about available and total volume space associated with
* a given path.
/*===========================================================================*
* hgfs_mkdir *
*===========================================================================*/
-int hgfs_mkdir(char *path, int mode)
+int hgfs_mkdir(const char *path, int mode)
{
/* Create a new directory.
*/
/*===========================================================================*
* hgfs_unlink *
*===========================================================================*/
-int hgfs_unlink(char *path)
+int hgfs_unlink(const char *path)
{
/* Delete a file.
*/
/*===========================================================================*
* hgfs_rmdir *
*===========================================================================*/
-int hgfs_rmdir(char *path)
+int hgfs_rmdir(const char *path)
{
/* Remove an empty directory.
*/
/*===========================================================================*
* hgfs_rename *
*===========================================================================*/
-int hgfs_rename(char *opath, char *npath)
+int hgfs_rename(const char *opath, const char *npath)
{
/* Rename a file or directory.
*/
/*===========================================================================*
* path_put *
*===========================================================================*/
-void path_put(char *path)
+void path_put(const char *path)
{
/* Append the given path name in HGFS format to the RPC buffer. Truncate it
* if it is longer than PATH_MAX bytes.
*/
- char *p, buf[PATH_MAX];
- int len;
+ const char *p;
+ char buf[PATH_MAX];
+ unsigned int len;
/* No leading slashes are allowed. */
for (p = path; *p == '/'; p++);
/* attr.c */
#define attr_get PREFIX(attr_get)
void attr_get(struct sffs_attr *attr);
-int hgfs_getattr(char *path, struct sffs_attr *attr);
-int hgfs_setattr(char *path, struct sffs_attr *attr);
+int hgfs_getattr(const char *path, struct sffs_attr *attr);
+int hgfs_setattr(const char *path, struct sffs_attr *attr);
/* backdoor.s */
#define backdoor PREFIX(backdoor)
int channel_recv(struct channel *ch, char *buf, int max);
/* dir.c */
-int hgfs_opendir(char *path, sffs_dir_t *handle);
+int hgfs_opendir(const char *path, sffs_dir_t *handle);
int hgfs_readdir(sffs_dir_t handle, unsigned int index, char *buf, size_t size,
struct sffs_attr *attr);
int hgfs_closedir(sffs_dir_t handle);
int error_convert(int err);
/* file.c */
-int hgfs_open(char *path, int flags, int mode, sffs_file_t *handle);
+int hgfs_open(const char *path, int flags, int mode, sffs_file_t *handle);
ssize_t hgfs_read(sffs_file_t handle, char *buf, size_t size, u64_t offset);
ssize_t hgfs_write(sffs_file_t handle, char *buf, size_t len, u64_t offset);
int hgfs_close(sffs_file_t handle);
size_t hgfs_writebuf(char **ptr);
/* info.c */
-int hgfs_queryvol(char *path, u64_t *free, u64_t *total);
+int hgfs_queryvol(const char *path, u64_t *free, u64_t *total);
/* link.c */
-int hgfs_mkdir(char *path, int mode);
-int hgfs_unlink(char *path);
-int hgfs_rmdir(char *path);
-int hgfs_rename(char *opath, char *npath);
+int hgfs_mkdir(const char *path, int mode);
+int hgfs_unlink(const char *path);
+int hgfs_rmdir(const char *path);
+int hgfs_rename(const char *opath, const char *npath);
/* path.c */
#define path_put PREFIX(path_put)
#define path_get PREFIX(path_get)
-void path_put(char *path);
+void path_put(const char *path);
int path_get(char *path, int max);
/* rpc.c */
return OK;
}
-vbox_conn_t vbox_open(char *name)
+vbox_conn_t vbox_open(const char *name)
{
/* Open a VirtualBox HGCM connection.
*/
-NOGCCERROR=yes
-NOCLANGERROR=yes
-
# Makefile for libvboxfs
.include <bsd.own.mk>
* Get file attributes.
*/
int
-vboxfs_getattr(char *path, struct sffs_attr *attr)
+vboxfs_getattr(const char *path, struct sffs_attr *attr)
{
vbox_param_t param[3];
vboxfs_path_t pathbuf;
* Set file size.
*/
static int
-set_size(char *path, u64_t size)
+set_size(const char *path, u64_t size)
{
vboxfs_objinfo_t info;
vboxfs_handle_t h;
* Set file attributes.
*/
int
-vboxfs_setattr(char *path, struct sffs_attr *attr)
+vboxfs_setattr(const char *path, struct sffs_attr *attr)
{
vboxfs_objinfo_t info;
vboxfs_handle_t h;
* Open a directory.
*/
int
-vboxfs_opendir(char *path, sffs_dir_t *handle)
+vboxfs_opendir(const char *path, sffs_dir_t *handle)
{
vboxfs_handle_t h;
int r;
* Open a file.
*/
int
-vboxfs_open(char *path, int flags, int mode, sffs_file_t *handle)
+vboxfs_open(const char *path, int flags, int mode, sffs_file_t *handle)
{
vboxfs_handle_t *handlep;
int r;
* Create or open a file or directory.
*/
int
-vboxfs_open_file(char *path, int flags, int mode, vboxfs_handle_t *handlep,
- vboxfs_objinfo_t *infop)
+vboxfs_open_file(const char *path, int flags, int mode,
+ vboxfs_handle_t *handlep, vboxfs_objinfo_t *infop)
{
vbox_param_t param[3];
vboxfs_path_t pathbuf;
* Query volume information.
*/
int
-vboxfs_query_vol(char *path, vboxfs_volinfo_t *volinfo)
+vboxfs_query_vol(const char *path, vboxfs_volinfo_t *volinfo)
{
vboxfs_handle_t h;
int r;
* Query volume information.
*/
int
-vboxfs_queryvol(char *path, u64_t *free, u64_t *total)
+vboxfs_queryvol(const char *path, u64_t *free, u64_t *total)
{
vboxfs_volinfo_t volinfo;
int r;
* Create a directory.
*/
int
-vboxfs_mkdir(char *path, int mode)
+vboxfs_mkdir(const char *path, int mode)
{
vboxfs_handle_t h;
int r;
* Remove a file or directory.
*/
static int
-remove_file(char *path, int dir)
+remove_file(const char *path, int dir)
{
vbox_param_t param[3];
vboxfs_path_t pathbuf;
* Unlink a file.
*/
int
-vboxfs_unlink(char *path)
+vboxfs_unlink(const char *path)
{
return remove_file(path, FALSE /*dir*/);
* Remove a directory.
*/
int
-vboxfs_rmdir(char *path)
+vboxfs_rmdir(const char *path)
{
return remove_file(path, TRUE /*dir*/);
* Rename a file or directory.
*/
static int
-rename_file(char *opath, char *npath, int dir)
+rename_file(const char *opath, const char *npath, int dir)
{
vbox_param_t param[4];
vboxfs_path_t opathbuf, npathbuf;
* Rename a file or directory.
*/
int
-vboxfs_rename(char *opath, char *npath)
+vboxfs_rename(const char *opath, const char *npath)
{
int r;
* will be initialized to the empty string.
*/
int
-vboxfs_set_path(vboxfs_path_t *path, char *name)
+vboxfs_set_path(vboxfs_path_t *path, const char *name)
{
size_t len;
/* attr.c */
void vboxfs_get_attr(struct sffs_attr *attr, vboxfs_objinfo_t *info);
-int vboxfs_getattr(char *path, struct sffs_attr *attr);
-int vboxfs_setattr(char *path, struct sffs_attr *attr);
+int vboxfs_getattr(const char *path, struct sffs_attr *attr);
+int vboxfs_setattr(const char *path, struct sffs_attr *attr);
/* dir.c */
-int vboxfs_opendir(char *path, sffs_dir_t *handle);
+int vboxfs_opendir(const char *path, sffs_dir_t *handle);
int vboxfs_readdir(sffs_dir_t handle, unsigned int index, char *buf,
size_t size, struct sffs_attr *attr);
int vboxfs_closedir(sffs_dir_t handle);
/* file.c */
-int vboxfs_open(char *path, int flags, int mode, sffs_file_t *handle);
+int vboxfs_open(const char *path, int flags, int mode, sffs_file_t *handle);
ssize_t vboxfs_read(sffs_file_t handle, char *buf, size_t size, u64_t pos);
ssize_t vboxfs_write(sffs_file_t handle, char *buf, size_t len, u64_t pos);
int vboxfs_close(sffs_file_t handle);
size_t vboxfs_buffer(char **ptr);
/* handle.c */
-int vboxfs_open_file(char *path, int flags, int mode, vboxfs_handle_t *handlep,
- vboxfs_objinfo_t *infop);
+int vboxfs_open_file(const char *path, int flags, int mode,
+ vboxfs_handle_t *handlep, vboxfs_objinfo_t *infop);
void vboxfs_close_file(vboxfs_handle_t handle);
/* info.c */
int vboxfs_getset_info(vboxfs_handle_t handle, u32_t flags, void *data,
size_t size);
-int vboxfs_query_vol(char *path, vboxfs_volinfo_t *volinfo);
-int vboxfs_queryvol(char *path, u64_t *free, u64_t *total);
+int vboxfs_query_vol(const char *path, vboxfs_volinfo_t *volinfo);
+int vboxfs_queryvol(const char *path, u64_t *free, u64_t *total);
/* link.c */
-int vboxfs_mkdir(char *path, int mode);
-int vboxfs_unlink(char *path);
-int vboxfs_rmdir(char *path);
-int vboxfs_rename(char *opath, char *npath);
+int vboxfs_mkdir(const char *path, int mode);
+int vboxfs_unlink(const char *path);
+int vboxfs_rmdir(const char *path);
+int vboxfs_rename(const char *opath, const char *npath);
/* path.c */
-int vboxfs_set_path(vboxfs_path_t *path, char *name);
+int vboxfs_set_path(vboxfs_path_t *path, const char *name);
int vboxfs_get_path(vboxfs_path_t *path, char *name, size_t size);
size_t vboxfs_get_path_size(vboxfs_path_t *path);