aboutsummaryrefslogtreecommitdiffstats
path: root/lib/errseq.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/errseq.c')
-rw-r--r--lib/errseq.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/lib/errseq.c b/lib/errseq.c
index 79cc66897db4..df782418b333 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -46,14 +46,14 @@
46 * @eseq: errseq_t field that should be set 46 * @eseq: errseq_t field that should be set
47 * @err: error to set (must be between -1 and -MAX_ERRNO) 47 * @err: error to set (must be between -1 and -MAX_ERRNO)
48 * 48 *
49 * This function sets the error in *eseq, and increments the sequence counter 49 * This function sets the error in @eseq, and increments the sequence counter
50 * if the last sequence was sampled at some point in the past. 50 * if the last sequence was sampled at some point in the past.
51 * 51 *
52 * Any error set will always overwrite an existing error. 52 * Any error set will always overwrite an existing error.
53 * 53 *
54 * We do return the latest value here, primarily for debugging purposes. The 54 * Return: The previous value, primarily for debugging purposes. The
55 * return value should not be used as a previously sampled value in later calls 55 * return value should not be used as a previously sampled value in later
56 * as it will not have the SEEN flag set. 56 * calls as it will not have the SEEN flag set.
57 */ 57 */
58errseq_t errseq_set(errseq_t *eseq, int err) 58errseq_t errseq_set(errseq_t *eseq, int err)
59{ 59{
@@ -108,11 +108,13 @@ errseq_t errseq_set(errseq_t *eseq, int err)
108EXPORT_SYMBOL(errseq_set); 108EXPORT_SYMBOL(errseq_set);
109 109
110/** 110/**
111 * errseq_sample - grab current errseq_t value 111 * errseq_sample() - Grab current errseq_t value.
112 * @eseq: pointer to errseq_t to be sampled 112 * @eseq: Pointer to errseq_t to be sampled.
113 * 113 *
114 * This function allows callers to sample an errseq_t value, marking it as 114 * This function allows callers to sample an errseq_t value, marking it as
115 * "seen" if required. 115 * "seen" if required.
116 *
117 * Return: The current errseq value.
116 */ 118 */
117errseq_t errseq_sample(errseq_t *eseq) 119errseq_t errseq_sample(errseq_t *eseq)
118{ 120{
@@ -134,15 +136,15 @@ errseq_t errseq_sample(errseq_t *eseq)
134EXPORT_SYMBOL(errseq_sample); 136EXPORT_SYMBOL(errseq_sample);
135 137
136/** 138/**
137 * errseq_check - has an error occurred since a particular sample point? 139 * errseq_check() - Has an error occurred since a particular sample point?
138 * @eseq: pointer to errseq_t value to be checked 140 * @eseq: Pointer to errseq_t value to be checked.
139 * @since: previously-sampled errseq_t from which to check 141 * @since: Previously-sampled errseq_t from which to check.
140 * 142 *
141 * Grab the value that eseq points to, and see if it has changed "since" 143 * Grab the value that eseq points to, and see if it has changed @since
142 * the given value was sampled. The "since" value is not advanced, so there 144 * the given value was sampled. The @since value is not advanced, so there
143 * is no need to mark the value as seen. 145 * is no need to mark the value as seen.
144 * 146 *
145 * Returns the latest error set in the errseq_t or 0 if it hasn't changed. 147 * Return: The latest error set in the errseq_t or 0 if it hasn't changed.
146 */ 148 */
147int errseq_check(errseq_t *eseq, errseq_t since) 149int errseq_check(errseq_t *eseq, errseq_t since)
148{ 150{
@@ -155,11 +157,11 @@ int errseq_check(errseq_t *eseq, errseq_t since)
155EXPORT_SYMBOL(errseq_check); 157EXPORT_SYMBOL(errseq_check);
156 158
157/** 159/**
158 * errseq_check_and_advance - check an errseq_t and advance to current value 160 * errseq_check_and_advance() - Check an errseq_t and advance to current value.
159 * @eseq: pointer to value being checked and reported 161 * @eseq: Pointer to value being checked and reported.
160 * @since: pointer to previously-sampled errseq_t to check against and advance 162 * @since: Pointer to previously-sampled errseq_t to check against and advance.
161 * 163 *
162 * Grab the eseq value, and see whether it matches the value that "since" 164 * Grab the eseq value, and see whether it matches the value that @since
163 * points to. If it does, then just return 0. 165 * points to. If it does, then just return 0.
164 * 166 *
165 * If it doesn't, then the value has changed. Set the "seen" flag, and try to 167 * If it doesn't, then the value has changed. Set the "seen" flag, and try to
@@ -170,6 +172,9 @@ EXPORT_SYMBOL(errseq_check);
170 * value. The caller must provide that if necessary. Because of this, callers 172 * value. The caller must provide that if necessary. Because of this, callers
171 * may want to do a lockless errseq_check before taking the lock and calling 173 * may want to do a lockless errseq_check before taking the lock and calling
172 * this. 174 * this.
175 *
176 * Return: Negative errno if one has been stored, or 0 if no new error has
177 * occurred.
173 */ 178 */
174int errseq_check_and_advance(errseq_t *eseq, errseq_t *since) 179int errseq_check_and_advance(errseq_t *eseq, errseq_t *since)
175{ 180{