Lines Matching refs:entry

93 	struct name_entry *entry;
102 entry = (struct name_entry *)item->hi_data;
103 (void) mutex_lock(&entry->mtx);
104 iter->nbc_entry = smb_netbios_name_dup(entry, 1);
105 (void) mutex_unlock(&entry->mtx);
116 struct name_entry *entry;
125 entry = (struct name_entry *)item->hi_data;
126 (void) mutex_lock(&entry->mtx);
127 iter->nbc_entry = smb_netbios_name_dup(entry, 1);
128 (void) mutex_unlock(&entry->mtx);
138 * Searches the name cache for the given entry, if found
139 * the entry will be locked before returning to caller
140 * so caller MUST unlock the entry after it's done with it.
147 struct name_entry *entry = NULL;
164 entry = (struct name_entry *)item->hi_data;
165 (void) mutex_lock(&entry->mtx);
166 if ((entry->attributes & NAME_ATTR_CONFLICT) != 0) {
167 (void) mutex_unlock(&entry->mtx);
168 entry = NULL;
173 return (entry);
187 * if the address also matches with the found entry.
190 * The found entry will be locked before returning to caller
191 * so caller MUST unlock the entry after it's done with it.
196 struct name_entry *entry = 0;
208 entry = (struct name_entry *)item->hi_data;
209 (void) mutex_lock(&entry->mtx);
210 addr = &entry->addr_list;
213 /* note that entry lock isn't released here */
215 return (entry);
218 } while (addr != &entry->addr_list);
219 (void) mutex_unlock(&entry->mtx);
229 struct name_entry *entry;
246 entry = (struct name_entry *)item->hi_data;
247 (void) mutex_lock(&entry->mtx);
250 addr = &entry->addr_list;
253 entry->attributes |=
255 (void) mutex_unlock(&entry->mtx);
261 for (addr = entry->addr_list.forw;
262 addr != &entry->addr_list; addr = addr->forw) {
265 (void) mutex_unlock(&entry->mtx);
275 entry->attributes |= addr->attributes;
276 QUEUE_INSERT_TAIL(&entry->addr_list, addr);
282 (void) mutex_unlock(&entry->mtx);
287 if ((entry = calloc(1, sizeof (struct name_entry))) == NULL) {
292 *entry = *name;
293 entry->addr_list.forw = entry->addr_list.back = &entry->addr_list;
294 entry->attributes |= entry->addr_list.attributes;
295 (void) mutex_init(&entry->mtx, 0, 0);
296 if (ht_replace_item(smb_netbios_cache, key, entry) == 0) {
297 free(entry);
312 struct name_entry *entry;
318 entry = (struct name_entry *)item->hi_data;
319 (void) mutex_lock(&entry->mtx);
321 (void) mutex_unlock(&entry->mtx);
334 struct name_entry entry;
344 &entry);
345 (void) memcpy(entry.name, name->name, NETBIOS_NAME_SZ);
346 entry.addr_list.refresh_ttl = entry.addr_list.ttl =
348 (void) smb_netbios_cache_insert(&entry);
356 smb_netbios_cache_update_entry(struct name_entry *entry,
362 addr = &entry->addr_list;
365 if (IS_UNIQUE(entry->attributes)) {
369 } while (addr != &entry->addr_list);
379 } while (addr != &entry->addr_list);
415 /* no room for adding next entry */
573 struct name_entry *entry;
590 entry = (struct name_entry *)item->hi_data;
591 (void) mutex_lock(&entry->mtx);
593 if (IS_LOCAL(entry->attributes)) {
595 delent = smb_netbios_name_dup(entry, 1);
601 (void) mutex_unlock(&entry->mtx);
607 smb_netbios_name_freeaddrs(struct name_entry *entry)
611 if (entry == 0)
614 while ((addr = entry->addr_list.forw) != &entry->addr_list) {
668 smb_netbios_name_dump(FILE *fp, struct name_entry *entry)
675 smb_strname(entry, buf, sizeof (buf));
676 type = (IS_UNIQUE(entry->attributes)) ? "UNIQUE" : "GROUP";
678 (void) fprintf(fp, "%s %-6s (0x%04x) ", buf, type, entry->attributes);
680 addr = &entry->addr_list;
691 } while (addr != &entry->addr_list);
695 smb_netbios_name_logf(struct name_entry *entry)
700 smb_strname(entry, namebuf, sizeof (namebuf));
701 syslog(LOG_DEBUG, "%s flags=0x%x\n", namebuf, entry->attributes);
702 addr = &entry->addr_list;
709 } while (addr && (addr != &entry->addr_list));
715 * Duplicate the given name entry. If 'alladdr' is 0 only
718 * like a regular cache entry i.e. it's a contiguous block
724 smb_netbios_name_dup(struct name_entry *entry, int alladdr)
733 addr = entry->addr_list.forw;
734 while (addr && (addr != &entry->addr_list)) {
749 dup->attributes = entry->attributes;
750 (void) memcpy(dup->name, entry->name, NETBIOS_NAME_SZ);
751 (void) strlcpy((char *)dup->scope, (char *)entry->scope,
753 dup->addr_list = entry->addr_list;
763 addr = entry->addr_list.forw;
764 while (addr && (addr != &entry->addr_list)) {
775 smb_strname(struct name_entry *entry, char *buf, int bufsize)
780 (void) snprintf(tmp, MAXHOSTNAMELEN, "%15.15s", entry->name);
784 if (entry->scope[0] != '\0') {
786 (void) strlcat(tmp, (char *)entry->scope, MAXHOSTNAMELEN);
789 (void) snprintf(buf, bufsize, "%-16s <%02X>", tmp, entry->name[15]);
795 struct name_entry *entry;
798 entry = (struct name_entry *)item->hi_data;
799 smb_netbios_name_freeaddrs(entry);
800 free(entry);