diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-03 21:34:37 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-03 21:34:37 +0200 |
commit | 6998d850c067a18eac3130f534309089f5e3da76 (patch) | |
tree | 5f9366119f7077ab74421fb5222e8b52a60526b6 | |
parent | 516cc3dfe4cd44fe85ad999910f0abf0aff7f6ad (diff) |
Fix buildtarfs/master
-rw-r--r-- | backend.h | 8 | ||||
-rw-r--r-- | cache.c | 2 | ||||
-rw-r--r-- | cache.h | 2 | ||||
-rw-r--r-- | fs.c | 10 | ||||
-rw-r--r-- | fs.h | 2 |
5 files changed, 13 insertions, 11 deletions
@@ -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); @@ -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; @@ -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); @@ -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); @@ -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": |