Date: Thu, 16 Aug 2007 19:32:46 GMT From: Fredrik Lindberg <fli@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 125231 for review Message-ID: <200708161932.l7GJWksU010468@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125231 Change 125231 by fli@fli_nexus on 2007/08/16 19:31:57 - Add a flags argument to dbr_ident_add() - Add some more debugging printouts. - Add a missing wcsdup Affected files ... .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/dbrec.c#4 edit .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/dbrec.h#3 edit Differences ... ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/dbrec.c#4 (text+ko) ==== @@ -297,9 +297,10 @@ * Create a record set identifier * dbr - Database record handle * ident - Record set identifier to create + * flags - Additional configuration flags */ int -dbr_ident_add(struct dbr *dbr, char *ident) +dbr_ident_add(struct dbr *dbr, char *ident, int flags) { struct dbr_ident *dbi; size_t ilen; @@ -311,6 +312,9 @@ if (dbi != NULL) { dprintf(DEBUG_DBR, "Record set %s does already exists dbi=%x", ident, dbi); + + dbi->dbi_flags &= flags; + dbi->dbi_flags |= flags; goto out; } @@ -321,6 +325,7 @@ MTX_INIT(dbi, dbi_mtx, NULL); dbi->dbi_dbr = dbr; dbi->dbi_ident = strdup(ident); + dbi->dbi_flags = flags; TAILQ_INIT(&dbi->dbi_rech); TAILQ_INIT(&dbi->dbi_res); TAILQ_INIT(&dbi->dbi_res_ptr); @@ -329,6 +334,8 @@ TAILQ_INSERT_TAIL(&dbr->dbr_ilist, dbi, dbi_next); hashtbl_add(&dbr->dbr_ident, dbi->dbi_ident, ilen, dbi, 0); + dprintf(DEBUG_DBR, "Added record set identifier %s, dbi=%x", + ident, dbi); RW_UNLOCK(dbr, dbr_lock); return (0); out: @@ -478,6 +485,9 @@ if (dbi->dbi_records == 0) ident_setname(dbi, i); + dprintf(DEBUG_DBR, "Added name %ls to identifier %s, dbi=%x", + name, ident, dbi); + MTX_UNLOCK(dbi, dbi_mtx); RW_UNLOCK(dbr, dbr_lock); return (0); @@ -544,11 +554,15 @@ dbi->dbi_names = NULL; } + dprintf(DEBUG_DBR, "Removed name %ls from identifier %s, dbi=%x", + name, ident, dbi); MTX_UNLOCK(dbi, dbi_mtx); RW_UNLOCK(dbr, dbr_lock); return (0); out: RW_UNLOCK(dbr, dbr_lock); + dprintf(DEBUG_DBR, "Failed to remove %ls from identifier %s, dbi=%x", + name, ident, dbi); return (-1); } @@ -682,7 +696,7 @@ dir->dir_data.dbi = dbip; } else { - dir->dir_data.wp = res; + dir->dir_data.wp = _wcsdup(res); } MTX_LOCK(dbi, dbi_mtx); ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/dbrec.h#3 (text+ko) ==== @@ -196,7 +196,7 @@ struct dbr_type * dbr_find_type(struct dbr *, char *, uint16_t); struct dbr_res * dbr_find_res(struct dbr *, char *, uint16_t, char *, size_t); -int dbr_ident_add(struct dbr *, char *); +int dbr_ident_add(struct dbr *, char *, int); int dbr_ident_del(struct dbr *, char *); char ** dbr_ident_list(struct dbr *); void dbr_ident_list_free(char **);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708161932.l7GJWksU010468>