• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/sys/dev/bhnd/nvram/

Lines Matching defs:iobuf

52  * iobuf instances are gauranteed to provide persistent references to its
65 BHND_NVRAM_IOPS_DEFN(iobuf)
89 struct bhnd_nvram_iobuf *iobuf;
97 /* Would sizeof(iobuf)+capacity overflow? */
98 if (SIZE_MAX - sizeof(*iobuf) < capacity) {
100 iosz = sizeof(*iobuf);
103 iosz = sizeof(*iobuf) + capacity;
107 iobuf = bhnd_nv_malloc(iosz);
108 if (iobuf == NULL)
111 iobuf->io.iops = &bhnd_nvram_iobuf_ops;
112 iobuf->buf = NULL;
113 iobuf->size = size;
114 iobuf->capacity = capacity;
119 iobuf->buf = &iobuf->data;
121 iobuf->buf = bhnd_nv_malloc(iobuf->capacity);
123 if (iobuf->buf == NULL) {
124 bhnd_nv_free(iobuf);
128 return (&iobuf->io);
147 struct bhnd_nvram_iobuf *iobuf;
149 /* Allocate the iobuf */
153 /* Copy the input to our new iobuf instance */
154 iobuf = (struct bhnd_nvram_iobuf *)io;
155 memcpy(iobuf->buf, buffer, iobuf->size);
200 struct bhnd_nvram_iobuf *iobuf;
207 /* Allocate the iobuf instance */
212 iobuf = (struct bhnd_nvram_iobuf *)io;
213 if ((error = bhnd_nvram_io_read(src, offset, iobuf->buf, size))) {
214 bhnd_nvram_io_free(&iobuf->io);
224 struct bhnd_nvram_iobuf *iobuf = (struct bhnd_nvram_iobuf *)io;
227 if (iobuf->buf != &iobuf->data)
228 bhnd_nv_free(iobuf->buf);
230 bhnd_nv_free(iobuf);
236 struct bhnd_nvram_iobuf *iobuf = (struct bhnd_nvram_iobuf *)io;
237 return (iobuf->size);
243 struct bhnd_nvram_iobuf *iobuf = (struct bhnd_nvram_iobuf *)io;
246 if (size > iobuf->capacity)
249 iobuf->size = size;
255 bhnd_nvram_iobuf_ptr(struct bhnd_nvram_iobuf *iobuf, size_t offset, void **ptr,
261 if (offset > iobuf->size)
264 avail = iobuf->size - offset;
270 *ptr = ((uint8_t *)iobuf->buf) + offset;
281 struct bhnd_nvram_iobuf *iobuf;
285 iobuf = (struct bhnd_nvram_iobuf *) io;
288 error = bhnd_nvram_iobuf_ptr(iobuf, offset, &ioptr, nbytes, navail);
301 struct bhnd_nvram_iobuf *iobuf;
303 iobuf = (struct bhnd_nvram_iobuf *) io;
306 return (bhnd_nvram_iobuf_ptr(iobuf, offset, ptr, nbytes, navail));