MCPcopy Create free account
hub / github.com/F-Stack/f-stack / khelp_init_osd

Function khelp_init_osd

freebsd/kern/kern_khelp.c:150–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150int
151khelp_init_osd(uint32_t classes, struct osd *hosd)
152{
153 struct helper *h;
154 void *hdata;
155 int error;
156
157 KASSERT(hosd != NULL, ("struct osd not initialised!"));
158
159 error = 0;
160
161 KHELP_LIST_RLOCK();
162 TAILQ_FOREACH(h, &helpers, h_next) {
163 /* If helper is correct class and needs to store OSD... */
164 if (h->h_classes & classes && h->h_flags & HELPER_NEEDS_OSD) {
165 hdata = uma_zalloc(h->h_zone, M_NOWAIT);
166 if (hdata == NULL) {
167 error = ENOMEM;
168 break;
169 }
170 osd_set(OSD_KHELP, hosd, h->h_id, hdata);
171 refcount_acquire(&h->h_refcount);
172 }
173 }
174
175 if (error) {
176 /* Delete OSD that was assigned prior to the error. */
177 TAILQ_FOREACH(h, &helpers, h_next) {
178 if (h->h_classes & classes)
179 khelp_remove_osd(h, hosd);
180 }
181 }
182 KHELP_LIST_RUNLOCK();
183
184 return (error);
185}
186
187int
188khelp_destroy_osd(struct osd *hosd)

Callers 2

tcp_newtcpcbFunction · 0.85
soallocFunction · 0.85

Calls 4

osd_setFunction · 0.85
refcount_acquireFunction · 0.85
khelp_remove_osdFunction · 0.85
uma_zallocFunction · 0.50

Tested by

no test coverage detected