From: <n-...@us...> - 2016-08-17 07:08:10
|
Revision: 10198 http://sourceforge.net/p/gfarm/code/10198 Author: n-soda Date: 2016-08-17 07:08:08 +0000 (Wed, 17 Aug 2016) Log Message: ----------- rename some enumeration functions from OBJECT_all() to OBJECT_forearch() for consistency. this is purely cosmetic and no functional change. Modified Paths: -------------- gfarm_v2/branches/2.6.dirquota/server/gfmd/dirset.c gfarm_v2/branches/2.6.dirquota/server/gfmd/group.c gfarm_v2/branches/2.6.dirquota/server/gfmd/group.h gfarm_v2/branches/2.6.dirquota/server/gfmd/host.c gfarm_v2/branches/2.6.dirquota/server/gfmd/quota.c gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.c gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.h gfarm_v2/branches/2.6.dirquota/server/gfmd/user.c gfarm_v2/branches/2.6.dirquota/server/gfmd/user.h Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/dirset.c =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/dirset.c 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/dirset.c 2016-08-17 07:08:08 UTC (rev 10198) @@ -318,7 +318,7 @@ } static void -dirset_all_for_dirsets(struct dirsets *sets, +dirset_foreach_in_dirsets(struct dirsets *sets, void *closure, void (*callback)(void *, struct dirset *)) { struct gfarm_hash_iterator it; @@ -453,7 +453,7 @@ sets = user_get_dirsets(u); if (sets != NULL) - dirset_all_for_dirsets(sets, client, dirset_reply_one); + dirset_foreach_in_dirsets(sets, client, dirset_reply_one); } gfarm_error_t @@ -489,7 +489,7 @@ /* XXX FIXME too long giant lock */ count = 0; if (all_users) { - user_all(&count, dirset_count_add, 1); + user_foreach(&count, dirset_count_add, 1); } else { dirset_count_add(&count, u); } @@ -500,7 +500,8 @@ ; } else { if (all_users) { - user_all(peer_get_conn(peer), dirset_reply, 1); + user_foreach(peer_get_conn(peer), + dirset_reply, 1); } else { dirset_reply(peer_get_conn(peer), u); } @@ -724,7 +725,7 @@ struct quota_dir_list_closure *c = closure; c->ds = ds; - quota_dir_all_for_dirset(ds->dir_list, c, dir_reply_quota_dir); + quota_dir_foreach_in_dirset(ds->dir_list, c, dir_reply_quota_dir); } static void @@ -738,7 +739,8 @@ if (all_dirsets) { sets = user_get_dirsets(u); if (sets != NULL) - dirset_all_for_dirsets(sets, c, dir_count_add_dirset); + dirset_foreach_in_dirsets( + sets, c, dir_count_add_dirset); } else { ds = user_lookup_dirset(u, c->dirsetname); if (ds != NULL) @@ -757,7 +759,7 @@ if (all_dirsets) { sets = user_get_dirsets(u); if (sets != NULL) - dirset_all_for_dirsets(sets, c, dir_reply_dirset); + dirset_foreach_in_dirsets(sets, c, dir_reply_dirset); } else { ds = user_lookup_dirset(u, c->dirsetname); if (ds != NULL) @@ -807,7 +809,7 @@ closure.count = 0; closure.dirsetname = dirsetname; if (all_users) { - user_all(&closure, dir_count_add, 1); + user_foreach(&closure, dir_count_add, 1); } else { dir_count_add(&closure, u); } @@ -818,7 +820,7 @@ ; } else { if (all_users) { - user_all(&closure, dir_reply, 1); + user_foreach(&closure, dir_reply, 1); } else { dir_reply(&closure, u); } Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/group.c =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/group.c 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/group.c 2016-08-17 07:08:08 UTC (rev 10198) @@ -286,7 +286,7 @@ } void -group_all(void *closure, void (*callback)(void *, struct group *), +group_foreach(void *closure, void (*callback)(void *, struct group *), int valid_only) { struct gfarm_hash_iterator it; Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/group.h =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/group.h 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/group.h 2016-08-17 07:08:08 UTC (rev 10198) @@ -27,7 +27,7 @@ int group_is_invalid(struct group *); int group_is_valid(struct group *); -void group_all(void *, void (*)(void *, struct group *), int); +void group_foreach(void *, void (*)(void *, struct group *), int); struct gfarm_group_info; gfarm_error_t group_info_add(struct gfarm_group_info *); Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/host.c =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/host.c 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/host.c 2016-08-17 07:08:08 UTC (rev 10198) @@ -112,7 +112,7 @@ static void host_free(struct host *); /* NOTE: each entry should be checked by host_is_valid(h) too */ -#define FOR_ALL_HOSTS(it) \ +#define HOST_FOREACH(it) \ for (gfarm_hash_iterator_begin(host_hashtab, (it)); \ !gfarm_hash_iterator_is_end(it); \ gfarm_hash_iterator_next(it)) @@ -266,7 +266,7 @@ /* XXX FIXME - this is too damn slow */ - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { h = host_iterator_access(&it); if (!host_is_valid(h)) continue; @@ -1162,7 +1162,7 @@ struct gfarm_hash_iterator it; nhosts = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { h = host_iterator_access(&it); if (host_is_valid(h)) ++nhosts; @@ -1173,7 +1173,7 @@ return (GFARM_ERR_NO_MEMORY); i = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { if (i >= nhosts) /* always false due to giant_lock */ break; h = host_iterator_access(&it); @@ -1219,7 +1219,7 @@ struct host *h; int nhosts = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { h = host_iterator_access(&it); if (host_is_valid(h)) ++nhosts; @@ -1475,7 +1475,7 @@ char *match; nhosts = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { h = host_iterator_access(&it); ++nhosts; } @@ -1492,7 +1492,7 @@ "%s: no memory for %d hosts", diag, nhosts); } else { i = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { if (i >= nhosts) /* always false due to giant_lock */ break; h = host_iterator_access(&it); @@ -1517,7 +1517,7 @@ /* if network error doesn't happen, e2 == e here */ if (e2 == GFARM_ERR_NO_ERROR) { i = answered = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { if (i >= nhosts || answered >= nmatch) break; h = host_iterator_access(&it); @@ -2142,7 +2142,7 @@ size_t sz; nhosts = 0; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { h = host_iterator_access(&it); if (host_is_valid(h)) nhosts++; @@ -2160,7 +2160,7 @@ nmatches = 0; p = ret; - FOR_ALL_HOSTS(&it) { + HOST_FOREACH(&it) { if (nmatches >= nhosts) break; h = host_iterator_access(&it); Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/quota.c =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/quota.c 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/quota.c 2016-08-17 07:08:08 UTC (rev 10198) @@ -194,8 +194,8 @@ static void usage_tmp_clear(void) { - user_all(NULL, usage_tmp_clear_user, 0); - group_all(NULL, usage_tmp_clear_group, 0); + user_foreach(NULL, usage_tmp_clear_user, 0); + group_foreach(NULL, usage_tmp_clear_group, 0); } static void @@ -246,8 +246,8 @@ static void quota_update_usage(void) { - user_all(NULL, quota_update_usage_user, 0); - group_all(NULL, quota_update_usage_group, 0); + user_foreach(NULL, quota_update_usage_user, 0); + group_foreach(NULL, quota_update_usage_group, 0); } static gfarm_time_t Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.c =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.c 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.c 2016-08-17 07:08:08 UTC (rev 10198) @@ -103,7 +103,7 @@ } void -quota_dir_all_for_dirset(struct quota_dir *list_head, +quota_dir_foreach_in_dirset(struct quota_dir *list_head, void *closure, void (*callback)(void *, struct quota_dir *)) { struct quota_dir *i, *tmp; Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.h =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.h 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/quota_dir.h 2016-08-17 07:08:08 UTC (rev 10198) @@ -11,7 +11,7 @@ /* private interface between quota_dir and dirset */ struct quota_dir *quota_dir_list_new(void); void quota_dir_list_free(struct quota_dir *); -void quota_dir_all_for_dirset(struct quota_dir *, +void quota_dir_foreach_in_dirset(struct quota_dir *, void *closure, void (*)(void *, struct quota_dir *)); gfarm_error_t gfm_server_quota_dir_get(struct peer *, int, int); Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/user.c =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/user.c 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/user.c 2016-08-17 07:08:08 UTC (rev 10198) @@ -404,7 +404,7 @@ } void -user_all(void *closure, void (*callback)(void *, struct user *), +user_foreach(void *closure, void (*callback)(void *, struct user *), int valid_only) { struct gfarm_hash_iterator it; Modified: gfarm_v2/branches/2.6.dirquota/server/gfmd/user.h =================================================================== --- gfarm_v2/branches/2.6.dirquota/server/gfmd/user.h 2016-08-17 06:46:02 UTC (rev 10197) +++ gfarm_v2/branches/2.6.dirquota/server/gfmd/user.h 2016-08-17 07:08:08 UTC (rev 10198) @@ -16,7 +16,7 @@ gfarm_error_t user_modify(struct user *, struct gfarm_user_info *); gfarm_error_t user_remove_in_cache(const char *); -void user_all(void *, void (*)(void *, struct user *), int); +void user_foreach(void *, void (*)(void *, struct user *), int); struct quota; struct quota *user_quota(struct user *); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |