Lines Matching defs:sgp

39 	fmd_serd_eng_t *sgp = fmd_zalloc(sizeof (fmd_serd_eng_t), FMD_SLEEP);
41 sgp->sg_name = fmd_strdup(name, FMD_SLEEP);
42 sgp->sg_flags = FMD_SERD_DIRTY;
43 sgp->sg_n = n;
44 sgp->sg_t = t;
46 return (sgp);
50 fmd_serd_eng_free(fmd_serd_eng_t *sgp)
52 fmd_serd_eng_reset(sgp);
53 fmd_strfree(sgp->sg_name);
54 fmd_free(sgp, sizeof (fmd_serd_eng_t));
68 fmd_serd_eng_t *sgp, *ngp;
72 for (sgp = shp->sh_hash[i]; sgp != NULL; sgp = ngp) {
73 ngp = sgp->sg_next;
74 fmd_serd_eng_free(sgp);
85 fmd_serd_eng_t *sgp;
89 for (sgp = shp->sh_hash[i]; sgp != NULL; sgp = sgp->sg_next)
90 func(sgp, arg);
103 fmd_serd_eng_t *sgp;
107 for (sgp = shp->sh_hash[i]; sgp != NULL; sgp = sgp->sg_next) {
108 if (fmd_serd_eng_contains(sgp, ep)) {
123 fmd_serd_eng_t *sgp = fmd_serd_eng_alloc(name, n, t);
125 sgp->sg_next = shp->sh_hash[h];
126 shp->sh_hash[h] = sgp;
129 return (sgp);
136 fmd_serd_eng_t *sgp;
138 for (sgp = shp->sh_hash[h]; sgp != NULL; sgp = sgp->sg_next) {
139 if (strcmp(name, sgp->sg_name) == 0)
140 return (sgp);
150 fmd_serd_eng_t *sgp, **pp = &shp->sh_hash[h];
152 for (sgp = *pp; sgp != NULL; sgp = sgp->sg_next) {
153 if (strcmp(sgp->sg_name, name) != 0)
154 pp = &sgp->sg_next;
159 if (sgp != NULL) {
160 *pp = sgp->sg_next;
161 fmd_serd_eng_free(sgp);
168 fmd_serd_eng_discard(fmd_serd_eng_t *sgp, fmd_serd_elem_t *sep)
170 fmd_list_delete(&sgp->sg_list, sep);
171 sgp->sg_count--;
178 fmd_serd_eng_contains(fmd_serd_eng_t *sgp, fmd_event_t *ep)
182 for (sep = fmd_list_next(&sgp->sg_list);
192 fmd_serd_eng_record(fmd_serd_eng_t *sgp, fmd_event_t *ep)
202 if (sgp->sg_flags & FMD_SERD_FIRED)
205 while (sgp->sg_count > sgp->sg_n)
206 fmd_serd_eng_discard(sgp, fmd_list_next(&sgp->sg_list));
214 fmd_list_append(&sgp->sg_list, sep);
215 sgp->sg_count++;
221 oep = fmd_list_next(&sgp->sg_list);
223 if (sgp->sg_count > sgp->sg_n &&
224 fmd_event_delta(oep->se_event, sep->se_event) <= sgp->sg_t) {
225 sgp->sg_flags |= FMD_SERD_FIRED | FMD_SERD_DIRTY;
229 sgp->sg_flags |= FMD_SERD_DIRTY;
234 fmd_serd_eng_fired(fmd_serd_eng_t *sgp)
236 return (sgp->sg_flags & FMD_SERD_FIRED);
240 fmd_serd_eng_empty(fmd_serd_eng_t *sgp)
242 return (sgp->sg_count == 0);
246 fmd_serd_eng_reset(fmd_serd_eng_t *sgp)
248 while (sgp->sg_count != 0)
249 fmd_serd_eng_discard(sgp, fmd_list_next(&sgp->sg_list));
251 sgp->sg_flags &= ~FMD_SERD_FIRED;
252 sgp->sg_flags |= FMD_SERD_DIRTY;
256 fmd_serd_eng_gc(fmd_serd_eng_t *sgp)
261 if (sgp->sg_count == 0 || (sgp->sg_flags & FMD_SERD_FIRED))
264 sep = fmd_list_prev(&sgp->sg_list);
265 hrt = fmd_event_hrtime(sep->se_event) - sgp->sg_t;
267 for (sep = fmd_list_next(&sgp->sg_list); sep != NULL; sep = nep) {
272 fmd_serd_eng_discard(sgp, sep);
273 sgp->sg_flags |= FMD_SERD_DIRTY;
278 fmd_serd_eng_commit(fmd_serd_eng_t *sgp)
282 if (!(sgp->sg_flags & FMD_SERD_DIRTY))
285 for (sep = fmd_list_next(&sgp->sg_list); sep != NULL;
289 sgp->sg_flags &= ~FMD_SERD_DIRTY;
293 fmd_serd_eng_clrdirty(fmd_serd_eng_t *sgp)
295 sgp->sg_flags &= ~FMD_SERD_DIRTY;