[Sheepdog] [PATCH 04/12] const correctness: change dir in main() from (char *) to (const char *)

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri May 21 13:42:31 CEST 2010


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/sheep.c      |    2 +-
 sheep/sheep_priv.h |    2 +-
 sheep/store.c      |   12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sheep/sheep.c b/sheep/sheep.c
index e507e48..dc9a320 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
 {
 	int ch, longindex;
 	int ret, port = SD_LISTEN_PORT;
-	char *dir = DEFAULT_OBJECT_DIR;
+	const char *dir = DEFAULT_OBJECT_DIR;
 	int is_daemon = 1;
 	int log_level = LOG_INFO;
 	char path[PATH_MAX];
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 338ba5a..8d1c6c0 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -125,7 +125,7 @@ extern struct cluster_info *sys;
 int create_listen_port(int port, void *data);
 
 int is_io_request(unsigned op);
-int init_store(char *dir);
+int init_store(const char *dir);
 
 int add_vdi(uint32_t epoch, char *data, int data_len, uint64_t size,
 	    uint32_t *new_vid, uint32_t base_vid, uint32_t copies,
diff --git a/sheep/store.c b/sheep/store.c
index da51d55..fac6d03 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -1563,7 +1563,7 @@ fail:
 	return -1;
 }
 
-static int init_path(char *d, int *new)
+static int init_path(const char *d, int *new)
 {
 	int ret, retry = 0;
 	struct stat s;
@@ -1635,7 +1635,7 @@ int get_nodeid(uint64_t *nodeid)
 	return attr(epoch_path, ANAME_NODEID, nodeid, sizeof(*nodeid), 0);
 }
 
-static int init_base_path(char *d)
+static int init_base_path(const char *d)
 {
 	int new = 0;
 
@@ -1644,7 +1644,7 @@ static int init_base_path(char *d)
 
 #define OBJ_PATH "/obj/"
 
-static int init_obj_path(char *base_path)
+static int init_obj_path(const char *base_path)
 {
 	int new;
 
@@ -1656,7 +1656,7 @@ static int init_obj_path(char *base_path)
 
 #define EPOCH_PATH "/epoch/"
 
-static int init_epoch_path(char *base_path)
+static int init_epoch_path(const char *base_path)
 {
 	int new, ret;
 	uint32_t epoch;
@@ -1707,7 +1707,7 @@ static int init_epoch_path(char *base_path)
 	return 0;
 }
 
-static int init_mnt_path(char *base_path)
+static int init_mnt_path(const char *base_path)
 {
 	int ret;
 	FILE *fp;
@@ -1738,7 +1738,7 @@ static int init_mnt_path(char *base_path)
 	return 0;
 }
 
-int init_store(char *d)
+int init_store(const char *d)
 {
 	int ret;
 
-- 
1.5.6.5




More information about the sheepdog mailing list