Lines Matching full:field
13 static void __eeprom_field_print_bin(const struct eeprom_field *field, in __eeprom_field_print_bin() argument
17 int from = reverse ? field->size - 1 : 0; in __eeprom_field_print_bin()
18 int to = reverse ? 0 : field->size - 1; in __eeprom_field_print_bin()
20 printf(PRINT_FIELD_SEGMENT, field->name); in __eeprom_field_print_bin()
22 printf("%02x%s", field->buf[i], delimiter); in __eeprom_field_print_bin()
24 printf("%02x\n", field->buf[i]); in __eeprom_field_print_bin()
27 static int __eeprom_field_update_bin(struct eeprom_field *field, in __eeprom_field_update_bin() argument
36 if (len > field->size * 2) in __eeprom_field_update_bin()
39 memset(field->buf, 0, field->size); in __eeprom_field_update_bin()
42 for (j = 0; j < field->size; j++) { in __eeprom_field_update_bin()
62 field->buf[j] = byte; in __eeprom_field_update_bin()
69 static int __eeprom_field_update_bin_delim(struct eeprom_field *field, in __eeprom_field_update_bin_delim() argument
85 if (count > field->size) in __eeprom_field_update_bin_delim()
89 for (i = 0; tok && i < field->size; i++) { in __eeprom_field_update_bin_delim()
95 field->buf[i] = (unsigned char)val; in __eeprom_field_update_bin_delim()
103 * eeprom_field_print_bin() - print a field which contains binary data
105 * Treat the field data as simple binary data, and print it as two digit
108 * Field Name 0102030405060708090a
110 * @field: an initialized field to print
112 void eeprom_field_print_bin(const struct eeprom_field *field) in eeprom_field_print_bin() argument
114 __eeprom_field_print_bin(field, "", false); in eeprom_field_print_bin()
118 * eeprom_field_update_bin() - Update field with new data in binary form
120 * @field: an initialized field
123 int eeprom_field_update_bin(struct eeprom_field *field, char *value) in eeprom_field_update_bin() argument
125 return __eeprom_field_update_bin(field, value, false); in eeprom_field_update_bin()
129 * eeprom_field_update_reserved() - Update reserved field with new data in
132 * @field: an initialized field
135 int eeprom_field_update_reserved(struct eeprom_field *field, char *value) in eeprom_field_update_reserved() argument
137 return __eeprom_field_update_bin_delim(field, value, " "); in eeprom_field_update_reserved()
141 * eeprom_field_print_bin_rev() - print a field which contains binary data in
144 * Treat the field data as simple binary data, and print it in reverse order
147 * Data in field:
150 * Field Name 0a090807060504030201
152 * @field: an initialized field to print
154 void eeprom_field_print_bin_rev(const struct eeprom_field *field) in eeprom_field_print_bin_rev() argument
156 __eeprom_field_print_bin(field, "", true); in eeprom_field_print_bin_rev()
160 * eeprom_field_update_bin_rev() - Update field with new data in binary form,
164 * in the field in the reverse order. i.e. if the input string was "1234",
165 * "3412" will be written to the field.
167 * @field: an initialized field
170 int eeprom_field_update_bin_rev(struct eeprom_field *field, char *value) in eeprom_field_update_bin_rev() argument
172 return __eeprom_field_update_bin(field, value, true); in eeprom_field_update_bin_rev()
176 * eeprom_field_print_mac_addr() - print a field which contains a mac address
178 * Treat the field data as simple binary data, and print it formatted as a MAC
181 * Field Name 01:02:03:04:05:06
183 * @field: an initialized field to print
185 void eeprom_field_print_mac(const struct eeprom_field *field) in eeprom_field_print_mac() argument
187 __eeprom_field_print_bin(field, ":", false); in eeprom_field_print_mac()
191 * eeprom_field_update_mac() - Update a mac address field which contains binary
194 * @field: an initialized field
197 int eeprom_field_update_mac(struct eeprom_field *field, char *value) in eeprom_field_update_mac() argument
199 return __eeprom_field_update_bin_delim(field, value, ":"); in eeprom_field_update_mac()
203 * eeprom_field_print_ascii() - print a field which contains ASCII data
204 * @field: an initialized field to print
206 void eeprom_field_print_ascii(const struct eeprom_field *field) in eeprom_field_print_ascii() argument
210 sprintf(format, "%%.%ds\n", field->size); in eeprom_field_print_ascii()
211 printf(PRINT_FIELD_SEGMENT, field->name); in eeprom_field_print_ascii()
212 printf(format, field->buf); in eeprom_field_print_ascii()
216 * eeprom_field_update_ascii() - Update field with new data in ASCII form
217 * @field: an initialized field
222 int eeprom_field_update_ascii(struct eeprom_field *field, char *value) in eeprom_field_update_ascii() argument
224 if (strlen(value) >= field->size) { in eeprom_field_update_ascii()
225 printf("%s: new data too long\n", field->name); in eeprom_field_update_ascii()
229 strncpy((char *)field->buf, value, field->size - 1); in eeprom_field_update_ascii()
230 field->buf[field->size - 1] = '\0'; in eeprom_field_update_ascii()
236 * eeprom_field_print_reserved() - print the "Reserved fields" field
243 * @field: an initialized field to print
245 void eeprom_field_print_reserved(const struct eeprom_field *field) in eeprom_field_print_reserved() argument
248 printf("(%d bytes)\n", field->size); in eeprom_field_print_reserved()