Lines Matching +full:line +full:- +full:name
5 * SPDX-License-Identifier: Apache-2.0
24 int settings_line_write(const char *name, const char *value, size_t val_len, in settings_line_write() argument
31 /* base64 encoding size and write-block-size */ in settings_line_write()
38 rem = strlen(name); in settings_line_write()
41 len_field = settings_line_len_calc(name, val_len); in settings_line_write()
48 w_size = wbs - add; in settings_line_write()
53 memcpy(w_buf + sizeof(len_field), name, w_size); in settings_line_write()
54 name += w_size; in settings_line_write()
55 rem -= w_size; in settings_line_write()
62 return -EIO; in settings_line_write()
65 /* The Alternative to condition above mean that `rem == 0` as `name` */ in settings_line_write()
68 w_size = rem - rem % wbs; in settings_line_write()
71 rc = settings_io_cb.write_cb(cb_arg, w_loc, name, w_size); in settings_line_write()
73 name += w_size; in settings_line_write()
77 memcpy(w_buf, name, rem); in settings_line_write()
89 add = MIN(rem, sizeof(w_buf) - w_size); in settings_line_write()
92 rem -= add; in settings_line_write()
97 add = wbs - add; in settings_line_write()
109 return -EIO; in settings_line_write()
129 entry_ctx->seek += entry_ctx->len; /* to begin of next line */ in settings_next_line_ctx()
131 entry_ctx->len = 0; /* ask read handler to ignore len */ in settings_next_line_ctx()
138 rc = -ESPIPE; in settings_next_line_ctx()
141 entry_ctx->seek += sizeof(readout); in settings_next_line_ctx()
142 entry_ctx->len = readout; in settings_next_line_ctx()
150 int settings_line_len_calc(const char *name, size_t val_len) in settings_line_len_calc() argument
152 /* <name>=<value> */ in settings_line_len_calc()
153 return strlen(name) + 1 + val_len; in settings_line_len_calc()
158 * Read RAW settings line entry data until a char from the storage.
160 * @param seek offset from the line beginning.
161 * @param[out] out buffer for name
163 * @param[out] len_read length of read name
164 * @param[in] until_char pointer on char value until which all line data will
166 * @param[in] cb_arg settings line storage context expected by the
170 * -ERCODE on storage errors
177 char temp_buf[32]; /* buffer for fit read-block-size requirements */ in settings_line_raw_read_until()
181 int rc = -EINVAL; in settings_line_raw_read_until()
184 return -EINVAL; in settings_line_raw_read_until()
197 return -EIO; in settings_line_raw_read_until()
200 off = seek - off; in settings_line_raw_read_until()
201 len = read_size - off; in settings_line_raw_read_until()
208 len = pend - &temp_buf[off]; in settings_line_raw_read_until()
215 rem_size -= len; in settings_line_raw_read_until()
225 *len_read = len_req - rem_size; in settings_line_raw_read_until()
255 return len - val_off; in settings_line_val_get_len()
259 * @param line_loc offset of the settings line, expect that it is aligned to rbs physically.
260 * @param seek offset form the line beginning.
261 * @retval 0 : read proper name
262 * 1 : when read unproper name
263 * -ERCODE for storage errors
278 int rc = -EINVAL; in settings_line_entry_copy()
293 write_size += settings_io_cb.rwbs - in settings_line_entry_copy()
305 len -= chunk_size; in settings_line_entry_copy()
325 /* val_off - offset of value-string within line entries */
332 int rc = -EINVAL; in settings_line_cmp()
336 return -EINVAL; in settings_line_cmp()
339 for (rem = val_len; rem > 0; rem -= len_read) { in settings_line_cmp()
363 int settings_line_dup_check_cb(const char *name, void *val_read_cb_ctx, in settings_line_dup_check_cb() argument
370 if (strcmp(name, cdca->name)) { in settings_line_dup_check_cb()
375 if (len_read != cdca->val_len) { in settings_line_dup_check_cb()
376 cdca->is_dup = 0; in settings_line_dup_check_cb()
378 cdca->is_dup = 1; in settings_line_dup_check_cb()
380 if (!settings_line_cmp(cdca->val, cdca->val_len, in settings_line_dup_check_cb()
382 cdca->is_dup = 1; in settings_line_dup_check_cb()
384 cdca->is_dup = 0; in settings_line_dup_check_cb()
396 rc = settings_line_val_read(value_context->off, 0, data, len, in settings_line_read_cb()
398 value_context->read_cb_ctx); in settings_line_read_cb()
404 return -1; in settings_line_read_cb()
407 int settings_line_load_cb(const char *name, void *val_read_cb_ctx, off_t off, in settings_line_load_cb() argument
417 return settings_call_set_handler(name, len, settings_line_read_cb, in settings_line_load_cb()