summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-10-03 21:34:37 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-10-03 21:34:37 +0200
commit6998d850c067a18eac3130f534309089f5e3da76 (patch)
tree5f9366119f7077ab74421fb5222e8b52a60526b6
parent516cc3dfe4cd44fe85ad999910f0abf0aff7f6ad (diff)
Fix buildtarfs/master
-rw-r--r--backend.h8
-rw-r--r--cache.c2
-rw-r--r--cache.h2
-rw-r--r--fs.c10
-rw-r--r--fs.h2
5 files changed, 13 insertions, 11 deletions
diff --git a/backend.h b/backend.h
index 82bbee77b..ca7d649df 100644
--- a/backend.h
+++ b/backend.h
@@ -61,7 +61,7 @@ struct fs_backend
error_t (*get_args)(char **argz, unsigned *argz_len);
/* Set options (see netfs_set_options()). */
- error_t (*set_options)(char *argz, size_t argz_len);
+ error_t (*set_options)(const char *argz, size_t argz_len);
/*
@@ -87,21 +87,21 @@ struct fs_backend
/* Changing a node */
error_t (* write_node) (struct node *np, off_t offset,
- size_t *len, void* data);
+ size_t *len, const void* data);
/* Change NP's stats. */
error_t (* change_stat)(struct node *np, const io_statbuf_t *new_stat);
/* Creates a node named NAME in DIR which is locked. */
error_t (* create_node) (struct node **new, struct node *dir,
- char *name, mode_t m);
+ const char *name, mode_t m);
/* Unlinks NODE. NODE can be a directory in which case it is empty. */
error_t (* unlink_node) (struct node *node);
/* Tries to create a hard link named NAME in DIR to file NODE. */
error_t (* link_node) (struct node *dir, struct node *target,
- char *name, int excl); /* Same as netfs semantics */
+ const char *name, int excl); /* Same as netfs semantics */
/* Makes NODE a symlink to TARGET. */
error_t (* symlink_node) (struct node *node, const char *target);
diff --git a/cache.c b/cache.c
index fefc36857..bbba4bc5b 100644
--- a/cache.c
+++ b/cache.c
@@ -367,7 +367,7 @@ cache_set_size (struct node *node, size_t size)
/* Writes at most LEN bytes from NODE at OFFSET into BUF.
Returns the amount of data actually written in AMOUNT. */
error_t
-cache_write (struct node *node, off_t offset, void *data,
+cache_write (struct node *node, off_t offset, const void *data,
size_t len, size_t *amount)
{
error_t err = 0;
diff --git a/cache.h b/cache.h
index 0c3659ea8..b2efdbfbf 100644
--- a/cache.h
+++ b/cache.h
@@ -69,7 +69,7 @@ extern error_t cache_read (struct node *node, off_t offset,
/* Writes at most LEN bytes from NODE at OFFSET into BUF.
Returns the amount of data actually written in AMOUNT. */
extern error_t cache_write (struct node *node, off_t offset,
- void *data, size_t len, size_t *amount);
+ const void *data, size_t len, size_t *amount);
/* Sets the size of NODE and reduce/grow its cache. */
extern error_t cache_set_size (struct node *node, size_t size);
diff --git a/fs.c b/fs.c
index acfbc172d..744f1674b 100644
--- a/fs.c
+++ b/fs.c
@@ -135,7 +135,7 @@ filter_node_name (char* name)
/* Returns either NULL or a pointer to a node if found. */
static inline struct node*
-_find_node (struct node *dir, char *name)
+_find_node (struct node *dir, const char *name)
{
struct node *node = NULL;
@@ -176,7 +176,7 @@ _find_node (struct node *dir, char *name)
}
struct node *
-fs_find_node (struct node *dir, char *name)
+fs_find_node (struct node *dir, const char *name)
{
return _find_node (dir, name);
}
@@ -461,9 +461,10 @@ fs_get_path_from_root (struct node *root, struct node *node)
if (strlen (path) + strlen (n->nn->name) + 1 + 1 > len)
{
char* new;
+ size_t offset = ptr - path;
len *= 2;
new = realloc (path, len);
- ptr = new + (ptr - path);
+ ptr = new + offset;
path = new;
}
REVERSE_COPY (ptr, n->nn->name);
@@ -507,9 +508,10 @@ fs_get_path_to_root (struct node *root, struct node *node)
if (strlen (path) + 3 + 1 > len)
{
char* new;
+ size_t offset = ptr - path;
len *= 2;
new = realloc (path, len);
- ptr = new + (ptr - path);
+ ptr = new + offset;
path = new;
}
strncpy (ptr, "../", 3);
diff --git a/fs.h b/fs.h
index 34bcd40c4..a825ba885 100644
--- a/fs.h
+++ b/fs.h
@@ -48,7 +48,7 @@ extern error_t fs_dir_last_entry (struct node *dir, struct node **last);
/* Returns either NULL or a pointer to a node if found. */
extern struct node*
-fs_find_node (struct node *dir, char *name);
+fs_find_node (struct node *dir, const char *name);
/* Looks for a node located at PATH, starting at directory N.
When looking for "/foo/bar":