diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-07-18 13:33:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-07-18 13:33:10 +0000 |
commit | 957ba741a643ac853f7cd6c00f05f41cf57d8d59 (patch) | |
tree | 98acdb5bcf1e0cf959100e7e0416a14ccd270550 /src/datastore | |
parent | d38544730123a1f365ef287a7e88060d97b266b7 (diff) | |
download | gnunet-957ba741a643ac853f7cd6c00f05f41cf57d8d59.tar.gz gnunet-957ba741a643ac853f7cd6c00f05f41cf57d8d59.zip |
-adding missing 'const' decls, fixing indentation / doxygen a bit
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 57 | ||||
-rw-r--r-- | src/datastore/perf_plugin_datastore.c | 19 | ||||
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 31 |
3 files changed, 83 insertions, 24 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index f8012527a..77e96c94f 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -829,9 +829,21 @@ struct PutContext | |||
829 | }; | 829 | }; |
830 | 830 | ||
831 | 831 | ||
832 | /** | ||
833 | * Put continuation. | ||
834 | * | ||
835 | * @param cls closure | ||
836 | * @param key key for the item stored | ||
837 | * @param size size of the item stored | ||
838 | * @param status #GNUNET_OK or #GNUNET_SYSERROR | ||
839 | * @param msg error message on error | ||
840 | */ | ||
832 | static void | 841 | static void |
833 | put_continuation (void *cls, const struct GNUNET_HashCode *key, uint32_t size, | 842 | put_continuation (void *cls, |
834 | int status, char *msg) | 843 | const struct GNUNET_HashCode *key, |
844 | uint32_t size, | ||
845 | int status, | ||
846 | const char *msg) | ||
835 | { | 847 | { |
836 | struct GNUNET_SERVER_Client *client = cls; | 848 | struct GNUNET_SERVER_Client *client = cls; |
837 | 849 | ||
@@ -877,7 +889,9 @@ execute_put (struct GNUNET_SERVER_Client *client, const struct DataMessage *dm) | |||
877 | 889 | ||
878 | 890 | ||
879 | static void | 891 | static void |
880 | check_present_continuation (void *cls, int status, char *msg) | 892 | check_present_continuation (void *cls, |
893 | int status, | ||
894 | const char *msg) | ||
881 | { | 895 | { |
882 | struct GNUNET_SERVER_Client *client = cls; | 896 | struct GNUNET_SERVER_Client *client = cls; |
883 | 897 | ||
@@ -890,7 +904,7 @@ check_present_continuation (void *cls, int status, char *msg) | |||
890 | * Function that will check if the given datastore entry | 904 | * Function that will check if the given datastore entry |
891 | * matches the put and if none match executes the put. | 905 | * matches the put and if none match executes the put. |
892 | * | 906 | * |
893 | * @param cls closure, pointer to the client (of type 'struct PutContext'). | 907 | * @param cls closure, pointer to the client (of type `struct PutContext`). |
894 | * @param key key for the content | 908 | * @param key key for the content |
895 | * @param size number of bytes in data | 909 | * @param size number of bytes in data |
896 | * @param data content stored | 910 | * @param data content stored |
@@ -900,14 +914,18 @@ check_present_continuation (void *cls, int status, char *msg) | |||
900 | * @param expiration expiration time for the content | 914 | * @param expiration expiration time for the content |
901 | * @param uid unique identifier for the datum; | 915 | * @param uid unique identifier for the datum; |
902 | * maybe 0 if no unique identifier is available | 916 | * maybe 0 if no unique identifier is available |
903 | * | 917 | * @return #GNUNET_OK usually |
904 | * @return GNUNET_OK usually | 918 | * #GNUNET_NO to delete the item |
905 | * GNUNET_NO to delete the item | ||
906 | */ | 919 | */ |
907 | static int | 920 | static int |
908 | check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | 921 | check_present (void *cls, |
909 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 922 | const struct GNUNET_HashCode *key, |
910 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 923 | uint32_t size, |
924 | const void *data, | ||
925 | enum GNUNET_BLOCK_Type type, | ||
926 | uint32_t priority, | ||
927 | uint32_t anonymity, | ||
928 | struct GNUNET_TIME_Absolute expiration, | ||
911 | uint64_t uid) | 929 | uint64_t uid) |
912 | { | 930 | { |
913 | struct PutContext *pc = cls; | 931 | struct PutContext *pc = cls; |
@@ -932,10 +950,12 @@ check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
932 | if ((ntohl (dm->priority) > 0) || | 950 | if ((ntohl (dm->priority) > 0) || |
933 | (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us > | 951 | (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us > |
934 | expiration.abs_value_us)) | 952 | expiration.abs_value_us)) |
935 | plugin->api->update (plugin->api->cls, uid, | 953 | plugin->api->update (plugin->api->cls, |
954 | uid, | ||
936 | (int32_t) ntohl (dm->priority), | 955 | (int32_t) ntohl (dm->priority), |
937 | GNUNET_TIME_absolute_ntoh (dm->expiration), | 956 | GNUNET_TIME_absolute_ntoh (dm->expiration), |
938 | check_present_continuation, pc->client); | 957 | &check_present_continuation, |
958 | pc->client); | ||
939 | else | 959 | else |
940 | { | 960 | { |
941 | transmit_status (pc->client, GNUNET_NO, NULL); | 961 | transmit_status (pc->client, GNUNET_NO, NULL); |
@@ -1008,8 +1028,13 @@ handle_put (void *cls, struct GNUNET_SERVER_Client *client, | |||
1008 | pc->client = client; | 1028 | pc->client = client; |
1009 | GNUNET_SERVER_client_keep (client); | 1029 | GNUNET_SERVER_client_keep (client); |
1010 | memcpy (&pc[1], dm, size + sizeof (struct DataMessage)); | 1030 | memcpy (&pc[1], dm, size + sizeof (struct DataMessage)); |
1011 | plugin->api->get_key (plugin->api->cls, 0, &dm->key, &vhash, | 1031 | plugin->api->get_key (plugin->api->cls, |
1012 | ntohl (dm->type), &check_present, pc); | 1032 | 0, |
1033 | &dm->key, | ||
1034 | &vhash, | ||
1035 | ntohl (dm->type), | ||
1036 | &check_present, | ||
1037 | pc); | ||
1013 | return; | 1038 | return; |
1014 | } | 1039 | } |
1015 | execute_put (client, dm); | 1040 | execute_put (client, dm); |
@@ -1069,7 +1094,9 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
1069 | 1094 | ||
1070 | 1095 | ||
1071 | static void | 1096 | static void |
1072 | update_continuation (void *cls, int status, char *msg) | 1097 | update_continuation (void *cls, |
1098 | int status, | ||
1099 | const char *msg) | ||
1073 | { | 1100 | { |
1074 | struct GNUNET_SERVER_Client *client = cls; | 1101 | struct GNUNET_SERVER_Client *client = cls; |
1075 | 1102 | ||
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index d31d5facf..a91ec19ed 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -99,12 +99,25 @@ disk_utilization_change_cb (void *cls, int delta) | |||
99 | 99 | ||
100 | 100 | ||
101 | static void | 101 | static void |
102 | test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 102 | test (void *cls, |
103 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
103 | 104 | ||
104 | 105 | ||
106 | /** | ||
107 | * Put continuation. | ||
108 | * | ||
109 | * @param cls closure | ||
110 | * @param key key for the item stored | ||
111 | * @param size size of the item stored | ||
112 | * @param status #GNUNET_OK or #GNUNET_SYSERROR | ||
113 | * @param msg error message on error | ||
114 | */ | ||
105 | static void | 115 | static void |
106 | put_continuation (void *cls, const struct GNUNET_HashCode *key, | 116 | put_continuation (void *cls, |
107 | uint32_t size, int status, char *msg) | 117 | const struct GNUNET_HashCode *key, |
118 | uint32_t size, | ||
119 | int status, | ||
120 | const char *msg) | ||
108 | { | 121 | { |
109 | struct CpsRunContext *crc = cls; | 122 | struct CpsRunContext *crc = cls; |
110 | 123 | ||
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index b367b1a7f..d60dc3cc2 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c | |||
@@ -84,12 +84,25 @@ disk_utilization_change_cb (void *cls, int delta) | |||
84 | 84 | ||
85 | 85 | ||
86 | static void | 86 | static void |
87 | test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 87 | test (void *cls, |
88 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
88 | 89 | ||
89 | 90 | ||
91 | /** | ||
92 | * Put continuation. | ||
93 | * | ||
94 | * @param cls closure | ||
95 | * @param key key for the item stored | ||
96 | * @param size size of the item stored | ||
97 | * @param status #GNUNET_OK or #GNUNET_SYSERROR | ||
98 | * @param msg error message on error | ||
99 | */ | ||
90 | static void | 100 | static void |
91 | put_continuation (void *cls, const struct GNUNET_HashCode *key, | 101 | put_continuation (void *cls, |
92 | uint32_t size, int status, char *msg) | 102 | const struct GNUNET_HashCode *key, |
103 | uint32_t size, | ||
104 | int status, | ||
105 | const char *msg) | ||
93 | { | 106 | { |
94 | struct CpsRunContext *crc = cls; | 107 | struct CpsRunContext *crc = cls; |
95 | static unsigned long long os; | 108 | static unsigned long long os; |
@@ -238,7 +251,9 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
238 | 251 | ||
239 | 252 | ||
240 | static void | 253 | static void |
241 | update_continuation (void *cls, int status, char *msg) | 254 | update_continuation (void *cls, |
255 | int status, | ||
256 | const char *msg) | ||
242 | { | 257 | { |
243 | struct CpsRunContext *crc = cls; | 258 | struct CpsRunContext *crc = cls; |
244 | 259 | ||
@@ -285,8 +300,12 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
285 | GNUNET_BLOCK_TYPE_ANY, &iterate_one_shot, crc); | 300 | GNUNET_BLOCK_TYPE_ANY, &iterate_one_shot, crc); |
286 | break; | 301 | break; |
287 | case RP_UPDATE: | 302 | case RP_UPDATE: |
288 | crc->api->update (crc->api->cls, guid, 1, GNUNET_TIME_UNIT_ZERO_ABS, | 303 | crc->api->update (crc->api->cls, |
289 | update_continuation, crc); | 304 | guid, |
305 | 1, | ||
306 | GNUNET_TIME_UNIT_ZERO_ABS, | ||
307 | &update_continuation, | ||
308 | crc); | ||
290 | break; | 309 | break; |
291 | 310 | ||
292 | case RP_ITER_ZERO: | 311 | case RP_ITER_ZERO: |