Commit ab3f35b2 authored by wuzhouhui's avatar wuzhouhui Committed by Changpeng Liu
Browse files

lib/notify: rename spdk_notify_get_events to spdk_notify_foreach_event



And change type name of callback as well. The new name is more accurate.

Change-Id: I13b63f7d33f60ecea7fdf6e50f57aa6a391a4562
Signed-off-by: default avatarwuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453151


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 87201f17
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -10,8 +10,9 @@ receive queue is predicated on hardware support when this flag is not used.

### notify

The function `spdk_notify_get_types()` was renamed to `spdk_notify_foreach_type()`.
And update type name of callback accordingly.
The function `spdk_notify_get_types()` and `spdk_notify_get_events()` were
renamed to `spdk_notify_foreach_type()` and `spdk_notify_foreach_event()`,
respectively. And update type name of callback accordingly.

## v19.04:

+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ about notification.

# Get new events {#notify_listen}

A consumer can get events by calling function `spdk_notify_get_events`.
A consumer can get events by calling function `spdk_notify_foreach_event`.
The caller should specify last received event and the maximum number of invocations.
There might be multiple consumers of each event. The event bus is implemented as a
circular buffer, so older events may be overwritten by newer ones.
+4 −4
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ struct spdk_notify_event {
 * \param ctx User context
 * \return Non zero to break iteration.
 */
typedef int (*spdk_notify_get_event_cb)(uint64_t idx, const struct spdk_notify_event *event,
typedef int (*spdk_notify_foreach_event_cb)(uint64_t idx, const struct spdk_notify_event *event,
		void *ctx);

/**
@@ -116,8 +116,8 @@ uint64_t spdk_notify_send(const char *type, const char *ctx);
 * \param ctx User context
 * \return Number of user callback invocations
 */
uint64_t spdk_notify_get_events(uint64_t start_idx, uint64_t max, spdk_notify_get_event_cb cb_fn,
				void *ctx);
uint64_t spdk_notify_foreach_event(uint64_t start_idx, uint64_t max,
				   spdk_notify_foreach_event_cb cb_fn, void *ctx);

#ifdef __cplusplus
}
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ spdk_rpc_get_notifications(struct spdk_jsonrpc_request *request,
	}

	spdk_json_write_array_begin(req.w);
	spdk_notify_get_events(req.id, req.max, get_notifications_cb, &req);
	spdk_notify_foreach_event(req.id, req.max, get_notifications_cb, &req);
	spdk_json_write_array_end(req.w);

	spdk_jsonrpc_end_result(request, req.w);
+2 −1
Original line number Diff line number Diff line
@@ -128,7 +128,8 @@ spdk_notify_send(const char *type, const char *ctx)
}

uint64_t
spdk_notify_get_events(uint64_t start_idx, uint64_t max, spdk_notify_get_event_cb cb_fn, void *ctx)
spdk_notify_foreach_event(uint64_t start_idx, uint64_t max,
			  spdk_notify_foreach_event_cb cb_fn, void *ctx)
{
	uint64_t i;

Loading