From owner-p4-projects@FreeBSD.ORG Sun Oct 24 07:27:11 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 68172106566C; Sun, 24 Oct 2010 07:27:11 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BE62106564A for ; Sun, 24 Oct 2010 07:27:11 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 075F88FC08 for ; Sun, 24 Oct 2010 07:27:11 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9O7RBf2042964 for ; Sun, 24 Oct 2010 07:27:11 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9O7RAAC042961 for perforce@freebsd.org; Sun, 24 Oct 2010 07:27:10 GMT (envelope-from dforsyth@FreeBSD.org) Date: Sun, 24 Oct 2010 07:27:10 GMT Message-Id: <201010240727.o9O7RAAC042961@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185032 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 07:27:11 -0000 http://p4web.freebsd.org/@@185032?ac=10 Change 185032 by dforsyth@skunk on 2010/10/24 07:26:29 Start to move pkg_delete over to new design Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#2 edit Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#5 (text+ko) ==== @@ -275,7 +275,6 @@ pkg->magic = PKG_DIRDB_MAGIC; pkg->source = db; - pkg->plist = NULL; strncpy(pkg->origin, origin, PATH_MAX); strncpy(pkg->name, name, PATH_MAX); ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#5 (text+ko) ==== @@ -10,26 +10,36 @@ int fbsd_directorydb_add(struct pkg_db *, struct pkg *, const char *, const char *, const char *, const char *); + /* Test if a key exists. */ int fbsd_directorydb_contains(struct pkg_db *, const char *); + /* Populates a pkg with the value from key. */ int fbsd_directorydb_get(struct pkg_db *, struct pkg *, const char *); + int fbsd_directorydb_delete(struct pkg_db *, struct pkg *); + /* Returns the uid of the owner of a database. */ uid_t fbsd_directorydb_owner(struct pkg_db *); + /* Connect. */ int fbsd_directorydb_open(struct pkg_db *, const char *); + /* Quit (nocommit). */ int fbsd_directorydb_close(struct pkg_db *); + /* Returns a pkg_list of all the packages in a database. */ struct pkg_list *fbsd_directorydb_all(struct pkg_db *); + /* Returns a newly created file in a package. */ struct pkg_file *fbsd_directorydb_add_file(struct pkg *, const char *, const char *); + /* Returns a pkg_file_list of all files in a package. */ struct pkg_file_list *fbsd_directorydb_files(struct pkg *); + /* Returns a pkg_depend_list of all dependencies in a package. */ struct pkg_depend_list *fbsd_directorydb_depends(struct pkg *); ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#7 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#5 (text+ko) ==== @@ -21,7 +21,6 @@ unsigned int magic; char key[PATH_MAX]; void *source; /* XXX: Make this a union. */ - struct pkg_property *plist; char origin[PATH_MAX]; char name[PATH_MAX]; ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#6 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#2 (text+ko) ==== @@ -7,7 +7,6 @@ #include #include -#include typedef enum { MATCH_ALL, @@ -42,7 +41,7 @@ static void clean_up(int); static void usage(void); static int pkg_delete(struct delete_config *); -static int delete(struct pkg *p, struct pkg_database *, struct delete_config *); +static int delete(struct pkg *, struct pkg_db *, struct delete_config *); static int pkg_info_hash_match(struct pkg_file *); static void parse_arguments(int, char **); static int pattern_match(match_t, const char *, const char *); @@ -103,6 +102,7 @@ break; case ('a'): c.match = MATCH_ALL; + c.recursive = 0; break; case ('G'): c.match = MATCH_EXACT; @@ -118,6 +118,7 @@ break; case ('r'): c.recursive = 1; + c.match ^= MATCH_ALL; break; case ('h'): default: @@ -167,20 +168,20 @@ static int pkg_delete(struct delete_config *_c) { - struct pkg *p; - struct pkg_database *db; + struct pkg *pkg; + struct pkg_list *pkgs; + struct pkg_db *db; struct pkg_target *pt; struct stat sb; int failure; int match_count; - p = pkg_freebsd_create(); - db = pkg_freebsd_database_create(); + db = pkg_db_create(); + /* This is all sorts of terrible... */ _c->database_location = getenv("PKG_DBDIR"); - if (_c->database_location == NULL) { + if (_c->database_location == NULL) _c->database_location = "/var/db/pkg"; - } #if 0 /* Make sure we can act on the database. */ @@ -194,30 +195,23 @@ #endif (void)sb; - pkg_database_open(db, _c->database_location, 0); + if (pkg_db_open(db, _c->database_location) != PKG_OK) return (1); + failure = 0; match_count = 0; if (_c->match == MATCH_ALL) { - while (pkg_database_get_next_pkg(db, p, 0) == PKG_OK) { - if (delete(p, db, _c) != 0) { - failure++; - } - pkg_database_rewind(db); - } + TAILQ_FOREACH(pkg, pkgs, next) + if (delete(pkg, db, _c) != 0) failure++; } else { STAILQ_FOREACH(pt, &_c->targets, next) { - while (pkg_database_get_next_pkg(db, p, 0) == PKG_OK) { - if (pattern_match(_c->match, - pkg_freebsd_get_name(p), + TAILQ_FOREACH(pkg, pkgs, next) { + if (pattern_match(_c->match, pkg_name(pkg), pt->target)) { - if (delete(p, db, _c) != 0) { - failure++; - } + if (delete(pkg, db, _c) != 0) failure++; break; } } - pkg_database_rewind(db); } } @@ -225,12 +219,18 @@ } static int -delete(struct pkg *p, struct pkg_database *db, struct delete_config *_c) +delete(struct pkg *pkg, struct pkg_db *db, struct delete_config *_c) { - struct pkg_dependency d; - struct pkg_exec e; - struct pkg_file f; - struct pkg *pp; + struct pkg_depend *depend; + struct pkg_file *file; + struct pkg_reqby *reqby; + + struct pkg_depend_list *depends; + struct pkg_file_list *files; + struct pkg_reqby_list *reqbys; + + struct pkg *rpkg; + const char *script; const char *rb; char pathname[PATH_MAX]; @@ -239,41 +239,18 @@ int rb_count; const char *dep_name; const char *dep_origin; - const char *pkg_name; - - /* We're assuming p is installed. */ - /* A second pkg to play with. */ - pp = pkg_freebsd_create(); - if (pp == NULL) { - exit(99); - } - rval = 0; - pkg_name = pkg_freebsd_get_name(p); /* * Check the dependents for this package. If we're doing a recursive * removal, do it here. */ - rb_count = 0; /* This is for the second dependent check. */ - while ((rb = pkg_freebsd_get_next_required_by(p)) != NULL) { - /* - * Have to rewind since delete uses the cursor, and we got here - * from pkg_delete(), which is iterating through the database - * itself. - */ - ++rb_count; + reqbys = pkg_reqbys(pkg); + TAILQ_FOREACH(reqby, reqbys, next) { if (_c->recursive) { - pkg_database_rewind(db); - while (pkg_database_get_next_pkg(db, pp, 0) == PKG_OK) { - if (strcmp(rb, pkg_freebsd_get_name(pp)) == 0) { - /* XXX: Apparently there's only supposed - * to be one level of recursion... */ - delete(pp, db, _c); - --rb_count; - } - } + rpkg = pkg_db_get(db, pkg_reqby_name(reqby)); + if (rpkg != NULL) delete(rpkg, db, _c); } } @@ -282,102 +259,62 @@ fflush(stderr); /* XXX: */ } - - if (rb_count > 0) { + +#if 0 + if (!TAILQ_EMPTY(reqbys) && !_c->recursive) { + /* If we're recursive, even if this isn't empty, all the reqbys + * are gone. */ warnx("Package '%s' is required by these other packages and " - "may not be deinstalled %s:", pkg_name, + "may not be deinstalled %s:", pkg_name(pkg), (_c->force ? "(but it will be deleted anyway)" : "")); - pkg_freebsd_required_by_rewind(p); - while ((rb = pkg_freebsd_get_next_required_by(p)) != NULL) { - pkg_database_rewind(db); - /* XXX: It would be nice to verify against the database - * here. */ - fprintf(stderr, "%s\n", rb); - } + + TAILQ_FOREACH(reqby, reqbys, next) + fprintf(stderr, "%s\n", pkg_reqby_name(reqby)); + } +#endif - script = pkg_freebsd_get_require_script_path(p); + script = pkg_require(pkg); if (script != NULL) { - if (_c->verbose) { - printf("Executing 'require' script.\n"); - } + if (_c->verbose) printf("Executing 'require' script.\n"); warnx("RUN: %s", script); } - - /* - * XXX: I don't check to see if the old style post-deinstall script is - * here. I should add a check for that, or figure out a way to have - * pkg_freebsd be smart enough to deal with it. - */ - script = pkg_freebsd_get_deinstall_script_path(p); + script = pkg_deinstall(pkg); if (script != NULL) { - if (_c->fake) { + if (_c->fake) printf("Would execute deinstall script at this " - "point.\n"); - } else { - warnx("RUN: %s %s %s", script, pkg_name, "DEINSTALL"); - } + "point.\n"); + else + warnx("RUN: %s %s %s", script, pkg_name(pkg), + "DEINSTALL"); } - while (pkg_freebsd_get_next_dependency(p, &d) == PKG_OK) { - dep_name = pkg_freebsd_dependency_get_name(&d); - if (_c->verbose) { - dep_origin = pkg_freebsd_dependency_get_origin(&d); - printf("Trying to remove dependency on package '%s'", - dep_name); - if (dep_origin != NULL) { - printf(" with '%s' origin", dep_origin); - } - printf(".\n"); - } - if (_c->fake) { - continue; - } - /* - * TODO: All these rewinds are getting tedious. I should just - * add a get function to the database API. - */ - pkg_database_rewind(db); - while (pkg_database_get_next_pkg(db, pp, - SKIP_ALL ^ SKIP_REQUIRED_BY) == PKG_OK) { - if (strcmp(dep_name, pkg_freebsd_get_name(pp)) == 0) { - pkg_freebsd_remove_required_by(pp, pkg_name); - /* XXX: Uncomment this add. */ + depends = pkg_depends(pkg); + TAILQ_FOREACH(depend, depends, next) { + if (_c->verbose) + printf("Trying to remove dependency on package '%s'" + " with '%s' origin.", pkg_depend_name(depend), + pkg_depend_origin(depend)); + + if (_c->fake) continue; + + rpkg = pkg_db_get(db, pkg_depend_name(depend)); #if 0 - r = pkg_database_add_pkg(db, pp, - SKIP_ALL ^ SKIP_REQUIRED_BY); + if (rpkg != NULL) pkg_remove_reqby(rpkg, pkg_name(pkg)); #endif - warnx("ADD: '%s' unrequired-by '%s'", dep_name, - pkg_name); - r = PKG_OK; - if (r != PKG_OK) { - warnx("Error removing required-by entry" - "'%s' in package '%s'", pkg_name, - pkg_freebsd_get_name(pp)); - } - } - } + warnx("removed reqby %s from pkg %s", pkg_depend_name(depend), + pkg_name(pkg)); } - while (pkg_freebsd_get_next_file(p, &f) == PKG_OK) { - if (_c->prefix == NULL && - pkg_freebsd_file_get_prefix(&f) == NULL) { - /* - * We have no prefix. Because we don't check for this - * ahead of time, we're sort of SOL. Just die here and - * let the user clean up the mess. - */ - errx(1, "File %s has no prefix!\n", - pkg_freebsd_file_get_pathname(&f)); - } - /* Do a hash check for the file before we spend time building - * the path for it. */ - if (!pkg_info_hash_match(&f) ) { - warnx("'%s' fails original MD5 checksum - %s", - pkg_freebsd_file_get_pathname(&f), - (_c->force ? "deleted anyway." : "not deleted.")); - if (!_c->force) { + files = pkg_files(pkg); + TAILQ_FOREACH(file, files, next) { + if (!pkg_info_hash_match(file)) { + warnx("'%s' fails original MD5 checksum - Will %s.", + pkg_file_pathname(file), + (_c->force ? + "be deleted anyway" : "not be deleted")); + if (!_c->force) /* * The current pkg_delete tool continues in its * loop in this situation. I don't like that, @@ -386,25 +323,17 @@ * disk. */ return (1); - } } - /* Now build a pathname for the file. */ - /* _c->prefix overrides the prefix from the packing list. */ - strcpy(pathname, - (_c->prefix == NULL ? _c->prefix : - pkg_freebsd_file_get_prefix(&f))); - strcat(pathname, "/"); - strcat(pathname, pkg_freebsd_file_get_pathname(&f)); + + + snprintf(pathname, PATH_MAX, "%s/%s", pkg_file_prefix(file), + pkg_file_pathname(file)); + + if (_c->verbose) printf("Delete file %s\n", pathname); - if (_c->verbose) { - printf("Delete file %s\n", pathname); - } - if (!_c->fake) { - warnx("DELETE: %s", pathname); - } - if (pkg_freebsd_get_preserve(p)) { - /* Do preserve stuff... */ - } + if (!_c->fake) warnx("DELETE: %s", pathname); + + if (pkg_preserve(pkg)) {/* Do preserve stuff... */} } while (pkg_freebsd_get_next_unexec(p, &e) == PKG_OK) { @@ -460,7 +389,7 @@ } static int -pkg_info_hash_match(struct pkg_file *f) +pkg_info_hash_match(struct pkg_file *filw) { char path[PATH_MAX]; char hash[33]; @@ -469,15 +398,10 @@ char link_buf[PATH_MAX]; struct stat sb; - snprintf(path, PATH_MAX, "%s/%s", - pkg_freebsd_file_get_prefix(f), - pkg_freebsd_file_get_pathname(f)); + snprintf(path, PATH_MAX, "%s/%s", pkg_file_prefix(file), + pkg_file_pathname(file)); + if (lstat(path, &sb) < 0) { - /* - * Technically, we're better than the current pkg_info here. - * pkg_info reports that a file doesn't exist just because it - * can't open it. That's a bug. - */ warnx("%s does not exist", path); return (0); } @@ -490,19 +414,13 @@ calc_hash = NULL; if (S_ISLNK(sb.st_mode)) { link_len = readlink(path, link_buf, PATH_MAX); - if (link_len > 0) { + if (link_len > 0) calc_hash = MD5Data(link_buf, link_len, hash); - } - } else if (S_ISREG(sb.st_mode)) { - calc_hash = MD5File(path, hash); - } - if (calc_hash != NULL) { - if (strcmp(calc_hash, pkg_freebsd_file_get_hash(f)) != 0) { - return (0); - } else { - return (1); - } - } + + else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash); + + if (calc_hash != NULL) + return ((strcmp(calc_hash, pkg_file_hash(file)) == 0 ? 1 : 0)); return (0); } From owner-p4-projects@FreeBSD.ORG Mon Oct 25 02:01:59 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EB4941065675; Mon, 25 Oct 2010 02:01:58 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADECB106564A for ; Mon, 25 Oct 2010 02:01:58 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 905828FC0C for ; Mon, 25 Oct 2010 02:01:58 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9P21wTB074803 for ; Mon, 25 Oct 2010 02:01:58 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9P21wOi074800 for perforce@freebsd.org; Mon, 25 Oct 2010 02:01:58 GMT (envelope-from dforsyth@FreeBSD.org) Date: Mon, 25 Oct 2010 02:01:58 GMT Message-Id: <201010250201.o9P21wOi074800@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185063 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 02:01:59 -0000 http://p4web.freebsd.org/@@185063?ac=10 Change 185063 by dforsyth@skunk on 2010/10/25 02:01:05 Small naming fixes. Apparently I broke pkg_info a lot of pkg_info output, so started fixing that. Also add reqby. Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.c#4 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.h#4 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.c#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#8 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/pkg_info.c#4 edit Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#6 (text+ko) ==== @@ -144,7 +144,7 @@ /* Do the add and set up pkg. */ if (db->add(db, pkg, name, origin, comment, description) != PKG_OK) { - pkg_free(pkg); + pkg_release(pkg); return (NULL); } ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.c#4 (text+ko) ==== @@ -13,6 +13,12 @@ return (calloc(1, sizeof(struct pkg_file))); } +void +pkg_file_release(struct pkg_file *file) +{ + free(file); +} + const char * pkg_file_prefix(struct pkg_file *file) { ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.h#4 (text+ko) ==== @@ -29,6 +29,7 @@ TAILQ_HEAD(pkg_file_list, pkg_file); struct pkg_file *pkg_file_alloc(void); +void pkg_file_release(struct pkg_file *); const char *pkg_file_prefix(struct pkg_file *); const char *pkg_file_pathname(struct pkg_file *); @@ -38,6 +39,9 @@ const struct stat *pkg_file_stat(struct pkg_file *); +/* These only set the fields in the immediate object, they don't touch the db. + * */ + void _pkg_file_set_prefix(struct pkg_file *, const char *); void _pkg_file_set_pathname(struct pkg_file *, const char *); ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.c#5 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#8 (text+ko) ==== @@ -24,18 +24,11 @@ struct pkg * pkg_alloc(void) { - struct pkg *pkg; - - pkg = calloc(1, sizeof(*pkg)); - if (pkg == NULL) { - return (NULL); - } - - return (pkg); + return (calloc(1, sizeof(struct pkg))); } void -pkg_free(struct pkg *pkg) +pkg_release(struct pkg *pkg) { free(pkg); } ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#7 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#6 (text+ko) ==== @@ -67,6 +67,6 @@ TAILQ_HEAD(pkg_list, pkg); struct pkg *pkg_alloc(void); -void pkg_free(struct pkg *); +void pkg_release(struct pkg *); #endif ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#7 (text+ko) ==== @@ -37,16 +37,23 @@ const char *, int); void _pkg_append_file(struct pkg *, struct pkg_file *); +void pkg_file_finish(struct pkg *pkg, + struct pkg_file *file); struct pkg_depend *pkg_add_depend(struct pkg *, const char *, const char *); void _pkg_append_depend(struct pkg *, struct pkg_depend *); +void pkg_depend_finish(struct pkg *pkg, + struct pkg_depend *); + struct pkg_conflict *pkg_add_conflict(struct pkg *, const char *, const char *); void _pkg_append_conflict(struct pkg *, struct pkg_conflict *); +void pkg_conflict_finish(struct pkg *, + struct pkg_conflict *); struct pkg_file_list *pkg_files(struct pkg *); /* This should take a prefix argument. */ ==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/pkg_info.c#4 (text+ko) ==== @@ -559,10 +559,6 @@ printf("%s%s:", _c->info_prefix, pkg_name(pkg)); if (_c->show_flags & SHOW_PLIST) - if (!_c->quiet) - printf("%sPacking list:\n", _c->info_prefix); - - if (_c->show_flags & SHOW_PLIST) /* TODO: Write a show plist function for this flag * because the output is jacked in this case. */ if (!_c->quiet) @@ -596,7 +592,7 @@ pkg_depend_origin(depend)); } /* Separator. */ - printf("\n"); + // printf("\n"); } if (_c->show_flags & SHOW_REQBY) { @@ -662,7 +658,7 @@ files = pkg_files(pkg); TAILQ_FOREACH(file, files, next) { if (last_prefix == NULL) - pkg_file_prefix(file); + last_prefix = pkg_file_prefix(file); else { /* Check to see is the prefix has * changes. */ From owner-p4-projects@FreeBSD.ORG Mon Oct 25 15:13:33 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9B44C1065670; Mon, 25 Oct 2010 15:13:33 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 519DC106566B for ; Mon, 25 Oct 2010 15:13:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 3D2C78FC08 for ; Mon, 25 Oct 2010 15:13:33 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9PFDX1Q040591 for ; Mon, 25 Oct 2010 15:13:33 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9PFDXNM040588 for perforce@freebsd.org; Mon, 25 Oct 2010 15:13:33 GMT (envelope-from jhb@freebsd.org) Date: Mon, 25 Oct 2010 15:13:33 GMT Message-Id: <201010251513.o9PFDXNM040588@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185081 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:13:33 -0000 http://p4web.freebsd.org/@@185081?ac=10 Change 185081 by jhb@jhb_jhbbsd on 2010/10/25 15:12:29 - Use intr_disable/intr_restore instead of frobbing the flags register directly. - Use 'saveintr' instead of 'savecrit' or 'eflags' to hold the state returned by 'intr_disable'. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/fpu.c#18 edit .. //depot/projects/smpng/sys/amd64/include/profile.h#11 edit .. //depot/projects/smpng/sys/i386/i386/elan-mmcr.c#27 edit .. //depot/projects/smpng/sys/i386/i386/identcpu.c#71 edit .. //depot/projects/smpng/sys/i386/i386/initcpu.c#38 edit .. //depot/projects/smpng/sys/i386/i386/longrun.c#5 edit .. //depot/projects/smpng/sys/i386/i386/perfmon.c#15 edit .. //depot/projects/smpng/sys/i386/include/profile.h#17 edit .. //depot/projects/smpng/sys/i386/isa/npx.c#71 edit .. //depot/projects/smpng/sys/x86/x86/local_apic.c#6 edit Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/fpu.c#18 (text+ko) ==== @@ -113,14 +113,14 @@ void fpuinit(void) { - register_t savecrit; + register_t saveintr; u_int mxcsr; u_short control; /* * It is too early for critical_enter() to work on AP. */ - savecrit = intr_disable(); + saveintr = intr_disable(); stop_emulating(); fninit(); control = __INITIAL_FPUCW__; @@ -137,7 +137,7 @@ bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm)); } start_emulating(); - intr_restore(savecrit); + intr_restore(saveintr); } /* ==== //depot/projects/smpng/sys/amd64/include/profile.h#11 (text+ko) ==== @@ -77,17 +77,17 @@ #error this file needs to be ported to your compiler #endif /* !__GNUCLIKE_ASM */ #else /* !GUPROF */ -#define MCOUNT_DECL(s) u_long s; +#define MCOUNT_DECL(s) register_t s; #ifdef SMP extern int mcount_lock; -#define MCOUNT_ENTER(s) { s = read_rflags(); disable_intr(); \ +#define MCOUNT_ENTER(s) { s = intr_disable(); \ while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ /* nothing */ ; } #define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ - write_rflags(s); } + intr_restore(s); } #else -#define MCOUNT_ENTER(s) { s = read_rflags(); disable_intr(); } -#define MCOUNT_EXIT(s) (write_rflags(s)) +#define MCOUNT_ENTER(s) { s = intr_disable(); } +#define MCOUNT_EXIT(s) (intr_restore(s)) #endif #endif /* GUPROF */ ==== //depot/projects/smpng/sys/i386/i386/elan-mmcr.c#27 (text+ko) ==== @@ -228,19 +228,18 @@ static int state; int i; uint16_t u, x, y, z; - u_long eflags; + register_t saveintr; /* * Grab the HW state as quickly and compactly as we can. Disable * interrupts to avoid measuring our interrupt service time on * hw with quality clock sources. */ - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); x = *pps_ap[0]; /* state, must be first, see below */ y = *pps_ap[1]; /* timer2 */ z = *pps_ap[2]; /* timer1 */ - write_eflags(eflags); + intr_restore(saveintr); /* * Order is important here. We need to check the state of the GPIO ==== //depot/projects/smpng/sys/i386/i386/identcpu.c#71 (text+ko) ==== @@ -1037,12 +1037,11 @@ static void identifycyrix(void) { - u_int eflags; + register_t saveintr; int ccr2_test = 0, dir_test = 0; u_char ccr2, ccr3; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); ccr2 = read_cyrix_reg(CCR2); write_cyrix_reg(CCR2, ccr2 ^ CCR2_LOCK_NW); @@ -1067,7 +1066,7 @@ else cyrix_did = 0x00ff; /* Old 486SLC/DLC and TI486SXLC/SXL */ - write_eflags(eflags); + intr_restore(saveintr); } /* Update TSC freq with the value indicated by the caller. */ ==== //depot/projects/smpng/sys/i386/i386/initcpu.c#38 (text+ko) ==== @@ -116,14 +116,13 @@ static void init_bluelightning(void) { - u_long eflags; + register_t saveintr; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) need_post_dma_flush = 1; #endif - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); invd(); @@ -144,7 +143,7 @@ /* Enable caching in CR0. */ load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */ invd(); - write_eflags(eflags); + intr_restore(saveintr); } /* @@ -153,11 +152,10 @@ static void init_486dlc(void) { - u_long eflags; + register_t saveintr; u_char ccr0; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); invd(); ccr0 = read_cyrix_reg(CCR0); @@ -189,7 +187,7 @@ load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */ invd(); #endif /* !CYRIX_CACHE_WORKS */ - write_eflags(eflags); + intr_restore(saveintr); } @@ -199,11 +197,10 @@ static void init_cy486dx(void) { - u_long eflags; + register_t saveintr; u_char ccr2; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); invd(); ccr2 = read_cyrix_reg(CCR2); @@ -220,7 +217,7 @@ #endif write_cyrix_reg(CCR2, ccr2); - write_eflags(eflags); + intr_restore(saveintr); } @@ -230,11 +227,10 @@ static void init_5x86(void) { - u_long eflags; + register_t saveintr; u_char ccr2, ccr3, ccr4, pcr0; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -320,29 +316,28 @@ /* Lock NW bit in CR0. */ write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW); - write_eflags(eflags); + intr_restore(saveintr); } #ifdef CPU_I486_ON_386 /* * There are i486 based upgrade products for i386 machines. - * In this case, BIOS doesn't enables CPU cache. + * In this case, BIOS doesn't enable CPU cache. */ static void init_i486_on_386(void) { - u_long eflags; + register_t saveintr; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) need_post_dma_flush = 1; #endif - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0, NW = 0 */ - write_eflags(eflags); + intr_restore(saveintr); } #endif @@ -354,11 +349,10 @@ static void init_6x86(void) { - u_long eflags; + register_t saveintr; u_char ccr3, ccr4; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -422,7 +416,7 @@ /* Lock NW bit in CR0. */ write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW); - write_eflags(eflags); + intr_restore(saveintr); } #endif /* I486_CPU */ @@ -435,11 +429,10 @@ static void init_6x86MX(void) { - u_long eflags; + register_t saveintr; u_char ccr3, ccr4; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -489,7 +482,7 @@ /* Lock NW bit in CR0. */ write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW); - write_eflags(eflags); + intr_restore(saveintr); } static void @@ -513,11 +506,10 @@ init_mendocino(void) { #ifdef CPU_PPRO2CELERON - u_long eflags; + register_t saveintr; u_int64_t bbl_cr_ctl3; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -541,7 +533,7 @@ } load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); - write_eflags(eflags); + intr_restore(saveintr); #endif /* CPU_PPRO2CELERON */ } @@ -795,14 +787,14 @@ enable_K5_wt_alloc(void) { u_int64_t msr; - register_t savecrit; + register_t saveintr; /* * Write allocate is supported only on models 1, 2, and 3, with * a stepping of 4 or greater. */ if (((cpu_id & 0xf0) > 0) && ((cpu_id & 0x0f) > 3)) { - savecrit = intr_disable(); + saveintr = intr_disable(); msr = rdmsr(0x83); /* HWCR */ wrmsr(0x83, msr & !(0x10)); @@ -833,7 +825,7 @@ msr=rdmsr(0x83); wrmsr(0x83, msr|0x10); /* enable write allocate */ - intr_restore(savecrit); + intr_restore(saveintr); } } @@ -842,10 +834,9 @@ { quad_t size; u_int64_t whcr; - u_long eflags; + register_t saveintr; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); wbinvd(); #ifdef CPU_DISABLE_CACHE @@ -895,7 +886,7 @@ #endif wrmsr(0x0c0000082, whcr); - write_eflags(eflags); + intr_restore(saveintr); } void @@ -903,10 +894,9 @@ { quad_t size; u_int64_t whcr; - u_long eflags; + register_t saveintr; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); wbinvd(); #ifdef CPU_DISABLE_CACHE @@ -956,7 +946,7 @@ #endif wrmsr(0x0c0000082, whcr); - write_eflags(eflags); + intr_restore(saveintr); } #endif /* I585_CPU && CPU_WT_ALLOC */ @@ -966,15 +956,14 @@ DB_SHOW_COMMAND(cyrixreg, cyrixreg) { - u_long eflags; + register_t saveintr; u_int cr0; u_char ccr1, ccr2, ccr3; u_char ccr0 = 0, ccr4 = 0, ccr5 = 0, pcr0 = 0; cr0 = rcr0(); if (cpu_vendor_id == CPU_VENDOR_CYRIX) { - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX)) { @@ -992,7 +981,7 @@ pcr0 = read_cyrix_reg(PCR0); write_cyrix_reg(CCR3, ccr3); /* Restore CCR3. */ } - write_eflags(eflags); + intr_restore(saveintr); if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX)) printf("CCR0=%x, ", (u_int)ccr0); ==== //depot/projects/smpng/sys/i386/i386/longrun.c#5 (text+ko) ==== @@ -84,12 +84,11 @@ static u_int tmx86_get_longrun_mode(void) { - u_long eflags; + register_t saveintr; union msrinfo msrinfo; u_int low, high, flags, mode; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); msrinfo.msr = rdmsr(MSR_TMx86_LONGRUN); low = LONGRUN_MODE_MASK(msrinfo.regs[0]); @@ -105,40 +104,38 @@ } mode = LONGRUN_MODE_UNKNOWN; out: - write_eflags(eflags); + intr_restore(saveintr); return (mode); } static u_int tmx86_get_longrun_status(u_int * frequency, u_int * voltage, u_int * percentage) { - u_long eflags; + register_t saveintr; u_int regs[4]; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); do_cpuid(0x80860007, regs); *frequency = regs[0]; *voltage = regs[1]; *percentage = regs[2]; - write_eflags(eflags); + intr_restore(saveintr); return (1); } static u_int tmx86_set_longrun_mode(u_int mode) { - u_long eflags; + register_t saveintr; union msrinfo msrinfo; if (mode >= LONGRUN_MODE_UNKNOWN) { return (0); } - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); /* Write LongRun mode values to Model Specific Register. */ msrinfo.msr = rdmsr(MSR_TMx86_LONGRUN); @@ -153,7 +150,7 @@ msrinfo.regs[0] = (msrinfo.regs[0] & ~0x01) | longrun_modes[mode][2]; wrmsr(MSR_TMx86_LONGRUN_FLAGS, msrinfo.msr); - write_eflags(eflags); + intr_restore(saveintr); return (1); } ==== //depot/projects/smpng/sys/i386/i386/perfmon.c#15 (text+ko) ==== @@ -128,18 +128,18 @@ int perfmon_setup(int pmc, unsigned int control) { - register_t savecrit; + register_t saveintr; if (pmc < 0 || pmc >= NPMC) return EINVAL; perfmon_inuse |= (1 << pmc); control &= ~(PMCF_SYS_FLAGS << 16); - savecrit = intr_disable(); + saveintr = intr_disable(); ctl_shadow[pmc] = control; writectl(pmc); wrmsr(msr_pmc[pmc], pmc_shadow[pmc] = 0); - intr_restore(savecrit); + intr_restore(saveintr); return 0; } @@ -174,17 +174,17 @@ int perfmon_start(int pmc) { - register_t savecrit; + register_t saveintr; if (pmc < 0 || pmc >= NPMC) return EINVAL; if (perfmon_inuse & (1 << pmc)) { - savecrit = intr_disable(); + saveintr = intr_disable(); ctl_shadow[pmc] |= (PMCF_EN << 16); wrmsr(msr_pmc[pmc], pmc_shadow[pmc]); writectl(pmc); - intr_restore(savecrit); + intr_restore(saveintr); return 0; } return EBUSY; @@ -193,17 +193,17 @@ int perfmon_stop(int pmc) { - register_t savecrit; + register_t saveintr; if (pmc < 0 || pmc >= NPMC) return EINVAL; if (perfmon_inuse & (1 << pmc)) { - savecrit = intr_disable(); + saveintr = intr_disable(); pmc_shadow[pmc] = rdmsr(msr_pmc[pmc]) & 0xffffffffffULL; ctl_shadow[pmc] &= ~(PMCF_EN << 16); writectl(pmc); - intr_restore(savecrit); + intr_restore(saveintr); return 0; } return EBUSY; ==== //depot/projects/smpng/sys/i386/include/profile.h#17 (text+ko) ==== @@ -77,17 +77,17 @@ #error #endif /* !__GNUCLIKE_ASM */ #else /* !GUPROF */ -#define MCOUNT_DECL(s) u_long s; +#define MCOUNT_DECL(s) register_t s; #ifdef SMP extern int mcount_lock; -#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); \ +#define MCOUNT_ENTER(s) { s = intr_disable(); \ while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ /* nothing */ ; } #define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ - write_eflags(s); } + intr_restore(s); } #else -#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); } -#define MCOUNT_EXIT(s) (write_eflags(s)) +#define MCOUNT_ENTER(s) { s = intr_disable(); } +#define MCOUNT_EXIT(s) (intr_restore(s)) #endif #endif /* GUPROF */ ==== //depot/projects/smpng/sys/i386/isa/npx.c#71 (text+ko) ==== @@ -343,7 +343,7 @@ npxinit(void) { static union savefpu dummy; - register_t savecrit; + register_t saveintr; u_short control; if (!hw_float) @@ -355,7 +355,7 @@ * * It is too early for critical_enter() to work on AP. */ - savecrit = intr_disable(); + saveintr = intr_disable(); npxsave(&dummy); stop_emulating(); #ifdef CPU_ENABLE_SSE @@ -366,7 +366,7 @@ control = __INITIAL_NPXCW__; fldcw(control); start_emulating(); - intr_restore(savecrit); + intr_restore(saveintr); } /* ==== //depot/projects/smpng/sys/x86/x86/local_apic.c#6 (text+ko) ==== @@ -341,12 +341,12 @@ { struct lapic *la; u_int32_t maxlvt; - register_t eflags; + register_t saveintr; char buf[MAXCOMLEN + 1]; la = &lapics[lapic_id()]; KASSERT(la->la_present, ("missing APIC structure")); - eflags = intr_disable(); + saveintr = intr_disable(); maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; /* Initialize the TPR to allow all interrupts. */ @@ -393,7 +393,7 @@ if (maxlvt >= LVT_CMCI) lapic->lvt_cmci = lvt_mode(la, LVT_CMCI, lapic->lvt_cmci); - intr_restore(eflags); + intr_restore(saveintr); } void @@ -1415,7 +1415,7 @@ void lapic_ipi_raw(register_t icrlo, u_int dest) { - register_t value, eflags; + register_t value, saveintr; /* XXX: Need more sanity checking of icrlo? */ KASSERT(lapic != NULL, ("%s called too early", __func__)); @@ -1425,7 +1425,7 @@ ("%s: reserved bits set in ICR LO register", __func__)); /* Set destination in ICR HI register if it is being used. */ - eflags = intr_disable(); + saveintr = intr_disable(); if ((icrlo & APIC_DEST_MASK) == APIC_DEST_DESTFLD) { value = lapic->icr_hi; value &= ~APIC_ID_MASK; @@ -1438,7 +1438,7 @@ value &= APIC_ICRLO_RESV_MASK; value |= icrlo; lapic->icr_lo = value; - intr_restore(eflags); + intr_restore(saveintr); } #define BEFORE_SPIN 1000000 From owner-p4-projects@FreeBSD.ORG Mon Oct 25 16:11:43 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 940091065791; Mon, 25 Oct 2010 16:11:43 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56A4B1065673 for ; Mon, 25 Oct 2010 16:11:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 432DD8FC27 for ; Mon, 25 Oct 2010 16:11:43 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9PGBhGC052321 for ; Mon, 25 Oct 2010 16:11:43 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9PGBhtI052318 for perforce@freebsd.org; Mon, 25 Oct 2010 16:11:43 GMT (envelope-from jhb@freebsd.org) Date: Mon, 25 Oct 2010 16:11:43 GMT Message-Id: <201010251611.o9PGBhtI052318@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185088 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 16:11:43 -0000 http://p4web.freebsd.org/@@185088?ac=10 Change 185088 by jhb@jhb_jhbbsd on 2010/10/25 16:11:20 Just conditionally re-enable interrupts in intr_restore() on x86. Always writing all of flags clobbers PSL_T during single stepping. Reported by: bde Affected files ... .. //depot/projects/smpng/sys/amd64/include/cpufunc.h#21 edit .. //depot/projects/smpng/sys/i386/include/cpufunc.h#46 edit Differences ... ==== //depot/projects/smpng/sys/amd64/include/cpufunc.h#21 (text+ko) ==== @@ -43,6 +43,8 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#include + struct region_descriptor; #define readb(va) (*(volatile u_int8_t *) (va)) @@ -655,7 +657,8 @@ static __inline void intr_restore(register_t rflags) { - write_rflags(rflags); + if (rflags & PSL_I) + enable_intr(); } #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ ==== //depot/projects/smpng/sys/i386/include/cpufunc.h#46 (text+ko) ==== @@ -42,6 +42,8 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#include + #ifdef XEN extern void xen_cli(void); extern void xen_sti(void); @@ -669,7 +671,8 @@ static __inline void intr_restore(register_t eflags) { - write_eflags(eflags); + if (eflags & PSL_I) + enable_intr(); } #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ From owner-p4-projects@FreeBSD.ORG Mon Oct 25 16:12:49 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B8FCA106567A; Mon, 25 Oct 2010 16:12:49 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B86B1065675 for ; Mon, 25 Oct 2010 16:12:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 675978FC1A for ; Mon, 25 Oct 2010 16:12:49 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9PGCnSo052341 for ; Mon, 25 Oct 2010 16:12:49 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9PGCnQ8052338 for perforce@freebsd.org; Mon, 25 Oct 2010 16:12:49 GMT (envelope-from jhb@freebsd.org) Date: Mon, 25 Oct 2010 16:12:49 GMT Message-Id: <201010251612.o9PGCnQ8052338@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185089 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 16:12:49 -0000 http://p4web.freebsd.org/@@185089?ac=10 Change 185089 by jhb@jhb_jhbbsd on 2010/10/25 16:12:41 Don't try to use the saved register flag in td_md after spinlock count drops to zero since a single stepping trap may clobber it. I think we also need to follow a similar rule in spinlock_enter() as well. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#96 edit .. //depot/projects/smpng/sys/arm/arm/machdep.c#31 edit .. //depot/projects/smpng/sys/i386/i386/machdep.c#161 edit .. //depot/projects/smpng/sys/ia64/ia64/machdep.c#125 edit .. //depot/projects/smpng/sys/mips/mips/machdep.c#16 edit .. //depot/projects/smpng/sys/pc98/pc98/machdep.c#42 edit .. //depot/projects/smpng/sys/powerpc/aim/machdep.c#21 edit .. //depot/projects/smpng/sys/powerpc/booke/machdep.c#18 edit .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#104 edit .. //depot/projects/smpng/sys/sun4v/sun4v/machdep.c#15 edit Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#96 (text+ko) ==== @@ -1773,12 +1773,14 @@ spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } /* ==== //depot/projects/smpng/sys/arm/arm/machdep.c#31 (text+ko) ==== @@ -505,12 +505,14 @@ spinlock_exit(void) { struct thread *td; + register_t cspr; td = curthread; critical_exit(); + cspr = td->td_md.md_saved_cspr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - restore_interrupts(td->td_md.md_saved_cspr); + restore_interrupts(cspr); } /* ==== //depot/projects/smpng/sys/i386/i386/machdep.c#161 (text+ko) ==== @@ -3008,12 +3008,14 @@ spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } #if defined(I586_CPU) && !defined(NO_F00F_HACK) ==== //depot/projects/smpng/sys/ia64/ia64/machdep.c#125 (text+ko) ==== @@ -525,12 +525,14 @@ spinlock_exit(void) { struct thread *td; + int intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } void ==== //depot/projects/smpng/sys/mips/mips/machdep.c#16 (text+ko) ==== @@ -462,12 +462,14 @@ spinlock_exit(void) { struct thread *td; + register_t intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } /* ==== //depot/projects/smpng/sys/pc98/pc98/machdep.c#42 (text+ko) ==== @@ -2340,12 +2340,14 @@ spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } #if defined(I586_CPU) && !defined(NO_F00F_HACK) ==== //depot/projects/smpng/sys/powerpc/aim/machdep.c#21 (text+ko) ==== @@ -763,12 +763,14 @@ spinlock_exit(void) { struct thread *td; + register_t msr; td = curthread; critical_exit(); + msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_msr); + intr_restore(msr); } /* ==== //depot/projects/smpng/sys/powerpc/booke/machdep.c#18 (text+ko) ==== @@ -528,12 +528,14 @@ spinlock_exit(void) { struct thread *td; + register_t msr; td = curthread; critical_exit(); + msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_msr); + intr_restore(msr); } /* Shutdown the CPU as much as possible. */ ==== //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#104 (text+ko) ==== @@ -234,12 +234,14 @@ spinlock_exit(void) { struct thread *td; + register_t pil; td = curthread; critical_exit(); + pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - wrpr(pil, td->td_md.md_saved_pil, 0); + wrpr(pil, pil, 0); } static phandle_t ==== //depot/projects/smpng/sys/sun4v/sun4v/machdep.c#15 (text+ko) ==== @@ -279,14 +279,15 @@ spinlock_exit(void) { struct thread *td; + register_t pil; td = curthread; critical_exit(); + pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) { - intr_restore(td->td_md.md_saved_pil); + intr_restore(pil); } - } unsigned From owner-p4-projects@FreeBSD.ORG Tue Oct 26 16:06:29 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C69DD1065679; Tue, 26 Oct 2010 16:06:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89395106566B for ; Tue, 26 Oct 2010 16:06:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 75ED08FC17 for ; Tue, 26 Oct 2010 16:06:29 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9QG6TLY052101 for ; Tue, 26 Oct 2010 16:06:29 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9QG6TIW052098 for perforce@freebsd.org; Tue, 26 Oct 2010 16:06:29 GMT (envelope-from jhb@freebsd.org) Date: Tue, 26 Oct 2010 16:06:29 GMT Message-Id: <201010261606.o9QG6TIW052098@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185119 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 16:06:30 -0000 http://p4web.freebsd.org/@@185119?ac=10 Change 185119 by jhb@jhb_jhbbsd on 2010/10/26 16:05:30 Disable interrupts before bumping td_md.md_spinlock_count to 1 to fix races with single stepping through spinlock_enter clobbering td.md_saved_*. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#97 edit .. //depot/projects/smpng/sys/arm/arm/machdep.c#32 edit .. //depot/projects/smpng/sys/i386/i386/machdep.c#162 edit .. //depot/projects/smpng/sys/ia64/ia64/machdep.c#126 edit .. //depot/projects/smpng/sys/mips/mips/machdep.c#17 edit .. //depot/projects/smpng/sys/pc98/pc98/machdep.c#43 edit .. //depot/projects/smpng/sys/powerpc/aim/machdep.c#22 edit .. //depot/projects/smpng/sys/powerpc/booke/machdep.c#19 edit .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#105 edit .. //depot/projects/smpng/sys/sun4v/sun4v/machdep.c#16 edit Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#97 (text+ko) ==== @@ -1761,11 +1761,15 @@ spinlock_enter(void) { struct thread *td; + register_t flags; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_flags = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + flags = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_flags = flags; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/arm/arm/machdep.c#32 (text+ko) ==== @@ -493,11 +493,15 @@ spinlock_enter(void) { struct thread *td; + register_t cspr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_cspr = disable_interrupts(I32_bit | F32_bit); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + cspr = disable_interrupts(I32_bit | F32_bit); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_cspr = cspr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/i386/i386/machdep.c#162 (text+ko) ==== @@ -2996,11 +2996,15 @@ spinlock_enter(void) { struct thread *td; + register_t flags; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_flags = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + flags = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_flags = flags; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/ia64/ia64/machdep.c#126 (text+ko) ==== @@ -513,11 +513,15 @@ spinlock_enter(void) { struct thread *td; + int intr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_intr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + intr = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_intr = intr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/mips/mips/machdep.c#17 (text+ko) ==== @@ -450,11 +450,15 @@ spinlock_enter(void) { struct thread *td; + register_t intr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_intr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + intr = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_intr = intr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/pc98/pc98/machdep.c#43 (text+ko) ==== @@ -2328,11 +2328,15 @@ spinlock_enter(void) { struct thread *td; + register_t flags; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_flags = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + flags = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_flags = flags; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/powerpc/aim/machdep.c#22 (text+ko) ==== @@ -751,11 +751,15 @@ spinlock_enter(void) { struct thread *td; + register_t msr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_msr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + msr = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_msr = msr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/powerpc/booke/machdep.c#19 (text+ko) ==== @@ -516,11 +516,15 @@ spinlock_enter(void) { struct thread *td; + register_t msr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_msr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + msr = intr_disable(); + td->td_md.md_spinlock_count == 1; + td->td_md.md_saved_msr = msr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#105 (text+ko) ==== @@ -224,9 +224,10 @@ if (td->td_md.md_spinlock_count == 0) { pil = rdpr(pil); wrpr(pil, 0, PIL_TICK); + td->td_md.md_spinlock_count == 1; td->td_md.md_saved_pil = pil; - } - td->td_md.md_spinlock_count++; + } else + td->td_md.md_spinlock_count++; critical_enter(); } ==== //depot/projects/smpng/sys/sun4v/sun4v/machdep.c#16 (text+ko) ==== @@ -269,9 +269,10 @@ td = curthread; if (td->td_md.md_spinlock_count == 0) { pil = intr_disable(); + td->td_md.md_spinlock_count == 1; td->td_md.md_saved_pil = pil; - } - td->td_md.md_spinlock_count++; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -285,9 +286,8 @@ critical_exit(); pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; - if (td->td_md.md_spinlock_count == 0) { + if (td->td_md.md_spinlock_count == 0) intr_restore(pil); - } } unsigned From owner-p4-projects@FreeBSD.ORG Thu Oct 28 06:07:33 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CBD9F10656A9; Thu, 28 Oct 2010 06:07:33 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CB99106567A for ; Thu, 28 Oct 2010 06:07:33 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 7780B8FC20 for ; Thu, 28 Oct 2010 06:07:33 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9S67XV4025537 for ; Thu, 28 Oct 2010 06:07:33 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9S67Xu0025534 for perforce@freebsd.org; Thu, 28 Oct 2010 06:07:33 GMT (envelope-from dforsyth@FreeBSD.org) Date: Thu, 28 Oct 2010 06:07:33 GMT Message-Id: <201010280607.o9S67Xu0025534@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185173 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 06:07:34 -0000 http://p4web.freebsd.org/@@185173?ac=10 Change 185173 by dforsyth@skunk on 2010/10/28 06:06:54 Tabs to spaces, expose types so that I can use TAILQ_* instead of rolling my own queues, move api into pkg.h rather than spreading it between multiple headers. Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/base.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.h#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database_internal.h#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/depend.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/depend.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec_internal.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.c#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.h#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.c#6 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.h#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/internal.h#4 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#9 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#8 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#8 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_types.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository_internal.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.c#4 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.h#4 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/lib/pkg_install.h#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_add/Makefile#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_add/pkg_add.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_add/pkg_add.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/Makefile#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_dump/Makefile#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_dump/pkg_dump.c#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_dump/pkg_dump.h#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/Makefile#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/pkg_info.c#5 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/pkg_info.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_validate/Makefile#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_validate/validate.c#2 edit Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#6 (text+ko) ==== @@ -11,15 +11,12 @@ SRCS= pkg.c \ - database.c \ - repository.c \ - freebsd_plist.c \ - freebsd_database_directorydb.c \ - freebsd_repository_ftp.c \ - util.c \ - exec.c \ - file.c \ - depend.c + database.c \ + freebsd_plist.c \ + freebsd_database_directorydb.c \ + util.c \ + file.c \ + depend.c CFLAGS+= -std=c99 ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/base.h#3 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#7 (text+ko) ==== @@ -10,9 +10,9 @@ #include #include +#include "pkg.h" +#include "pkg_internal.h" #include "database.h" -/* Cool kids club. */ -#include "internal.h" #include "util.h" @@ -24,49 +24,49 @@ * Verify the magic value in a package database. If there is a mismatch, crash * the client application. */ -void +static void _pkg_db_check_magic(struct pkg_db *db, const char *func) { - if (db->magic != MAGIC) { - PKG_CLIENT_CRASH(func, "database magic number mismatch."); - } + if (db->magic != MAGIC) { + PKG_CLIENT_CRASH(func, "database magic number mismatch."); + } } struct pkg_db * pkg_db_create(void) { - struct pkg_db *db; + struct pkg_db *db; - db = calloc(1, sizeof(*db)); - if (db == NULL) { - return (NULL); - } + db = calloc(1, sizeof(*db)); + if (db == NULL) { + return (NULL); + } - db->magic = MAGIC; - /* If NULL, closed. If not NULL, open. */ - db->internal = NULL; + db->magic = MAGIC; + /* If NULL, closed. If not NULL, open. */ + db->internal = NULL; - /* TODO: NULL out callback pointers. */ - db->open = fbsd_directorydb_open; - db->all = fbsd_directorydb_all; - db->get = fbsd_directorydb_get; + /* TODO: NULL out callback pointers. */ + db->open = fbsd_directorydb_open; + db->all = fbsd_directorydb_all; + db->get = fbsd_directorydb_get; - return (db); + return (db); } int pkg_db_finish(struct pkg_db *db) { - if (db->internal != NULL) { - if (pkg_db_close(db) != PKG_OK) { - warnx("Could not close pkg_db (%s)\n", db->path); - return (PKG_NOT_OK); - } - } + if (db->internal != NULL) { + if (pkg_db_close(db) != PKG_OK) { + warnx("Could not close pkg_db (%s)\n", db->path); + return (PKG_NOT_OK); + } + } - free(db); + free(db); - return (PKG_OK); + return (PKG_OK); } /* @@ -75,127 +75,101 @@ int pkg_db_open(struct pkg_db *db, const char *path) { - int r; + int r; - _pkg_db_check_magic(db, __func__); - - r = PKG_NOT_OK; - if ((r = db->open(db, path)) == PKG_OK) { - strcpy(db->path, path); + _pkg_db_check_magic(db, __func__); + + r = PKG_NOT_OK; + if ((r = db->open(db, path)) == PKG_OK) { + strcpy(db->path, path); } - return (r); + return (r); } struct pkg_list * -pkg_db_all(struct pkg_db *db) +pkg_db_pkgs(struct pkg_db *db) { - return (db->all(db)); + return (db->all(db)); } +#if 0 uid_t pkg_db_owner(struct pkg_db *db) { - if (db->internal == NULL) { - return (PKG_NOT_OK); - } - return (db->owner(db)); + if (db->internal == NULL) { + return (PKG_NOT_OK); + } + return (db->owner(db)); } const char * pkg_db_path(struct pkg_db *db) { - if (db->internal == NULL) { - return (NULL); - } + if (db->internal == NULL) { + return (NULL); + } - return (db->path); + return (db->path); } +#endif int pkg_db_close(struct pkg_db *db) { - int r; + int r; - if (db->internal != NULL) { - if (db->close) { - r = db->close(db); - } else { - r = PKG_OK; - } - } else { - /* kaboom? */ - return (PKG_NOT_OK); - } + if (db->internal != NULL) { + if (db->close) { + r = db->close(db); + } else { + r = PKG_OK; + } + } else { + /* kaboom? */ + return (PKG_NOT_OK); + } - return (r); + return (r); } struct pkg * pkg_db_add(struct pkg_db *db, const char *name, const char *origin, - const char *comment, const char *description) + const char *comment, const char *description) { - struct pkg *pkg; - - pkg = pkg_alloc(); - if (pkg == NULL) { - return (NULL); - } + struct pkg *pkg; + + pkg = pkg_alloc(); + if (pkg == NULL) { + return (NULL); + } - /* Do the add and set up pkg. */ - if (db->add(db, pkg, name, origin, comment, description) != PKG_OK) { - pkg_release(pkg); - return (NULL); - } + /* Do the add and set up pkg. */ + if (db->add(db, pkg, name, origin, comment, description) != PKG_OK) { + pkg_release(pkg); + return (NULL); + } - return (pkg); + return (pkg); } struct pkg * pkg_db_get(struct pkg_db *db, const char *key) { - /* XXX: This function is a perfect example of why I need error - * properties. */ - struct pkg *pkg; - - pkg = pkg_alloc(); - if (pkg == NULL) { - return (NULL); - } + /* XXX: This function is a perfect example of why I need error + * properties. */ + struct pkg *pkg; + + pkg = pkg_alloc(); + if (pkg == NULL) { + return (NULL); + } - strcpy(pkg->key, key); - if (db->get(db, pkg, key) != PKG_OK) { - return (NULL); - } + strcpy(pkg->key, key); + if (db->get(db, pkg, key) != PKG_OK) { + return (NULL); + } - return (pkg); -} - -int -pkg_db_delete(struct pkg_db *db, const char *key) -{ - /* Does a complete removal of all information pertaining to pkg key from - * the database. Any pkg objects for this package or now invalid/stale. - * */ - return (db->delete(db, key)); -} - -int -pkg_db_destroy(struct pkg_db *db, struct pkg *p) -{ - (void)db; - (void)p; - return (PKG_OK); -} - -int -pkg_db_revert(struct pkg_db *db) -{ - return (db->revert(db)); + return (pkg); } -int -pkg_db_sync(struct pkg_db *db) -{ - return (db->sync(db)); -} ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.h#6 (text+ko) ==== @@ -6,64 +6,84 @@ #ifndef __LIBPKG_DATABASE_H__ #define __LIBPKG_DATABASE_H__ +#include #include #include "pkg.h" -/* Allocate a new pkg_db object. */ -struct pkg_db *pkg_db_create(void); +struct pkg_db { + unsigned int magic; /* init */ + char path[PATH_MAX]; + /* Internal db pointer for whatever backend is in use. */ + void *internal; + + int (*add) (struct pkg_db *, struct pkg *, + const char *, const char *, const char *, + const char *); + int (*close) (struct pkg_db *); + int (*contains) (struct pkg_db *, const char *); + int (*get) (struct pkg_db *, struct pkg *, + const char *); + struct pkg_list *(*all) (struct pkg_db *); + int (*open) (struct pkg_db *, const char *); + uid_t (*owner) (struct pkg_db *); + int (*delete) (struct pkg_db *, const char *); + int (*revert) (struct pkg_db *); + int (*sync) (struct pkg_db *); +}; +#if 0 /* Free a pkg_db object. Closes with no sync if open. */ -int pkg_db_finish(struct pkg_db *); +int pkg_db_finish(struct pkg_db *); /* Get the path of a pkg_db . */ -const char *pkg_db_path(struct pkg_db *); +const char *pkg_db_path(struct pkg_db *); -struct pkg_list *pkg_db_all(struct pkg_db *); +struct pkg_list *pkg_db_all(struct pkg_db *); /* XXX: Get allocates a package if the package is already in the db. Add * allocates a package if the package is NOT already in the db. */ /* Create a pkg in a pkg_db. If the pkg already exists, returns NULL. */ -struct pkg *pkg_db_add(struct pkg_db *, const char *, const char *, - const char *, const char *); +struct pkg *pkg_db_add(struct pkg_db *, const char *, const char *, + const char *, const char *); /* Get a pkg from a pkg_db. If the package does not exist, returns NULL. */ -struct pkg *pkg_db_get(struct pkg_db *, const char *); +struct pkg *pkg_db_get(struct pkg_db *, const char *); // /* Get all pkgs from a pkg_db that match an expressions. */ -// struct pkg_list *pkg_db_get(struct pkg_db *, const char *); +// struct pkg_list *pkg_db_get(struct pkg_db *, const char *); /* Deletes a pkg from a pkg_db. */ -int pkg_db_delete(struct pkg_db *, const char *); +int pkg_db_delete(struct pkg_db *, const char *); /* Destroy a pkg object that was created by pkg_db. */ -int pkg_db_destroy(struct pkg_db *, struct pkg *); +int pkg_db_destroy(struct pkg_db *, struct pkg *); /* Returns the uid of the owner of a pkg_db. */ -uid_t pkg_db_owner(struct pkg_db *); +uid_t pkg_db_owner(struct pkg_db *); -void pkg_db_set_callbacks(struct pkg_db *, - int (*close) (struct pkg_db *), - struct pkg *(*add) (struct pkg_db *, const char *), - int (*delete) (struct pkg_db *, const char *), - int (*open) (struct pkg_db *, const char *), - uid_t (*owner) (struct pkg_db *), - struct pkg *(*get) (struct pkg_db *, const char *, - uint32_t), - int (*revert) (struct pkg_db *), - int (*sync) (struct pkg_db *)); +void pkg_db_set_callbacks(struct pkg_db *, + int (*close) (struct pkg_db *), + struct pkg *(*add) (struct pkg_db *, const char *), + int (*delete) (struct pkg_db *, const char *), + int (*open) (struct pkg_db *, const char *), + uid_t (*owner) (struct pkg_db *), + struct pkg *(*get) (struct pkg_db *, const char *, + uint32_t), + int (*revert) (struct pkg_db *), + int (*sync) (struct pkg_db *)); /* Undo all changes to a pkg_db. */ -int pkg_db_revert(struct pkg_db *); +int pkg_db_revert(struct pkg_db *); /* Open a database for interaction. */ -int pkg_db_open(struct pkg_db *, const char *); +int pkg_db_open(struct pkg_db *, const char *); /* Close a database. */ -int pkg_db_close(struct pkg_db *); +int pkg_db_close(struct pkg_db *); /* Sync changes to a pkg_db to disk. */ -int pkg_db_sync(struct pkg_db *); - +int pkg_db_sync(struct pkg_db *); +#endif #endif ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database_internal.h#5 (text+ko) ==== @@ -10,24 +10,24 @@ /* Define the package database type. */ struct pkg_db { - unsigned int magic; /* init */ - char path[PATH_MAX]; - /* Internal db pointer for whatever backend is in use. */ - void *internal; + unsigned int magic; /* init */ + char path[PATH_MAX]; + /* Internal db pointer for whatever backend is in use. */ + void *internal; - int (*add) (struct pkg_db *, struct pkg *, - const char *, const char *, const char *, - const char *); - int (*close) (struct pkg_db *); - int (*contains) (struct pkg_db *, const char *); - int (*get) (struct pkg_db *, struct pkg *, - const char *); - struct pkg_list *(*all) (struct pkg_db *); - int (*open) (struct pkg_db *, const char *); - uid_t (*owner) (struct pkg_db *); - int (*delete) (struct pkg_db *, const char *); - int (*revert) (struct pkg_db *); - int (*sync) (struct pkg_db *); + int (*add) (struct pkg_db *, struct pkg *, + const char *, const char *, const char *, + const char *); + int (*close) (struct pkg_db *); + int (*contains) (struct pkg_db *, const char *); + int (*get) (struct pkg_db *, struct pkg *, + const char *); + struct pkg_list *(*all) (struct pkg_db *); + int (*open) (struct pkg_db *, const char *); + uid_t (*owner) (struct pkg_db *); + int (*delete) (struct pkg_db *, const char *); + int (*revert) (struct pkg_db *); + int (*sync) (struct pkg_db *); }; /* Check the magic value in a database. */ ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/depend.c#3 (text+ko) ==== @@ -2,40 +2,41 @@ #include #include +#include "pkg.h" #include "depend.h" struct pkg_depend * pkg_depend_alloc(void) { - return (calloc(1, sizeof(struct pkg_depend))); + return (calloc(1, sizeof(struct pkg_depend))); } const char * pkg_depend_name(struct pkg_depend *dep) { - return (dep->name); + return (dep->name); } const char * pkg_depend_origin(struct pkg_depend *dep) { - return (dep->origin); + return (dep->origin); } const char * pkg_depend_version(struct pkg_depend *dep) { - return (dep->name); + return (dep->name); } void _pkg_depend_set_name(struct pkg_depend *dep, const char *name) { - strncpy(dep->name, name, PATH_MAX); + strncpy(dep->name, name, PATH_MAX); } void _pkg_depend_set_origin(struct pkg_depend *dep, const char *origin) { - strncpy(dep->origin, origin, PATH_MAX); + strncpy(dep->origin, origin, PATH_MAX); } ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/depend.h#3 (text+ko) ==== @@ -1,27 +1,32 @@ #ifndef __LIBPKG_DEPEND_H__ #define __LIBPKG_DEPEND_H__ +#if 0 #include #include struct pkg_depend { - char name[PATH_MAX]; - char version[256]; - char origin[PATH_MAX]; + char name[PATH_MAX]; + char version[256]; + char origin[PATH_MAX]; - TAILQ_ENTRY(pkg_depend) next; + TAILQ_ENTRY(pkg_depend) next; }; TAILQ_HEAD(pkg_depend_list, pkg_depend); +#endif -struct pkg_depend *pkg_depend_alloc(void); -const char *pkg_depend_name(struct pkg_depend *); -const char *pkg_depend_origin(struct pkg_depend *); -const char *pkg_depend_version(struct pkg_depend *); +#include "pkg_types.h" -void _pkg_depend_set_name(struct pkg_depend *, - const char *); -void _pkg_depend_set_origin(struct pkg_depend *, - const char *); +struct pkg_depend *pkg_depend_alloc(void); +#if 0 +const char *pkg_depend_name(struct pkg_depend *); +const char *pkg_depend_origin(struct pkg_depend *); +const char *pkg_depend_version(struct pkg_depend *); +#endif +void _pkg_depend_set_name(struct pkg_depend *, + const char *); +void _pkg_depend_set_origin(struct pkg_depend *, + const char *); #endif ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.c#3 (text+ko) ==== @@ -8,7 +8,7 @@ char * pkg_exec_run(const char *fmt, char *arg) { - (void)fmt; - (void)arg; - return (NULL); + (void)fmt; + (void)arg; + return (NULL); } ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.h#3 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec_internal.h#3 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.c#5 (text+ko) ==== @@ -2,6 +2,7 @@ #include #include +#include "pkg.h" #include "file.h" #include "util.h" @@ -10,78 +11,80 @@ struct pkg_file * pkg_file_alloc(void) { - return (calloc(1, sizeof(struct pkg_file))); + return (calloc(1, sizeof(struct pkg_file))); } void pkg_file_release(struct pkg_file *file) { - free(file); + free(file); } const char * pkg_file_prefix(struct pkg_file *file) { - return (file->prefix); + return (file->prefix); } void _pkg_file_set_prefix(struct pkg_file *file, const char *prefix) { - strncpy(file->prefix, prefix, PATH_MAX); + strncpy(file->prefix, prefix, PATH_MAX); } const char * pkg_file_pathname(struct pkg_file *file) { - return (file->pathname); + return (file->pathname); } void _pkg_file_set_pathname(struct pkg_file *file, const char *pathname) { - strncpy(file->pathname, pathname, PATH_MAX); + strncpy(file->pathname, pathname, PATH_MAX); } int pkg_file_ignore(struct pkg_file *file) { - return (file->ignore); + return (file->ignore); } void _pkg_file_set_ignore(struct pkg_file *file) { - file->ignore = 1; + file->ignore = 1; } const char * pkg_file_hash(struct pkg_file *file) { - return (file->hash); + return (file->hash); } +#if 0 const char * pkg_file_update_hash(struct pkg_file *file) { - return (file->update_hash(file)); + return (file->update_hash(file)); } +#endif void _pkg_file_set_hash(struct pkg_file *file, const char *hash) { - strncpy(file->hash, hash, 33); + strncpy(file->hash, hash, 33); } const struct stat * pkg_file_stat(struct pkg_file *file) { - char final[PATH_MAX]; + char final[PATH_MAX]; - _pkg_util_path_join(final, file->prefix, file->pathname); - - /* there's no stat_r, are we thread safe? */ - if (stat(final, &file->sb) < 0) return (NULL); + _pkg_util_path_join(final, file->prefix, file->pathname); + + /* there's no stat_r, are we thread safe? */ + if (stat(final, &file->sb) < 0) return (NULL); - return ((const struct stat *)&file->sb); + return ((const struct stat *)&file->sb); } ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/file.h#5 (text+ko) ==== @@ -1,51 +1,57 @@ #ifndef __LIBPKG_FILE_H__ #define __LIBPKG_FILE_H__ +#if 0 #include #include #include #include struct pkg_file { - /* Give each file in a package a unique id. Prefix and pathname aren't - * reliable keys. */ - unsigned int id; - struct stat sb; - - /* The package that this file is in. */ - struct pkg *pkg; + /* Give each file in a package a unique id. Prefix and pathname aren't + * reliable keys. */ + unsigned int id; + struct stat sb; + + /* The package that this file is in. */ + struct pkg *pkg; - char prefix[PATH_MAX]; - char pathname[PATH_MAX]; - int ignore; + char prefix[PATH_MAX]; + char pathname[PATH_MAX]; + int ignore; - char hash[33]; + char hash[33]; - const char *(*update_hash) (struct pkg_file *); + const char *(*update_hash) (struct pkg_file *); - TAILQ_ENTRY(pkg_file) next; + TAILQ_ENTRY(pkg_file) next; }; TAILQ_HEAD(pkg_file_list, pkg_file); +#endif -struct pkg_file *pkg_file_alloc(void); -void pkg_file_release(struct pkg_file *); +#include "pkg_types.h" + +struct pkg_file *pkg_file_alloc(void); +void pkg_file_release(struct pkg_file *); -const char *pkg_file_prefix(struct pkg_file *); -const char *pkg_file_pathname(struct pkg_file *); -int pkg_file_ignore(struct pkg_file *); -const char *pkg_file_hash(struct pkg_file *); -const char *pkg_file_update_hash(struct pkg_file *); +#if 0 +const char *pkg_file_prefix(struct pkg_file *); +const char *pkg_file_pathname(struct pkg_file *); +int pkg_file_ignore(struct pkg_file *); +const char *pkg_file_hash(struct pkg_file *); +const char *pkg_file_update_hash(struct pkg_file *); const struct stat *pkg_file_stat(struct pkg_file *); +#endif /* These only set the fields in the immediate object, they don't touch the db. * */ -void _pkg_file_set_prefix(struct pkg_file *, const char *); -void _pkg_file_set_pathname(struct pkg_file *, - const char *); -void _pkg_file_set_ignore(struct pkg_file *); -void _pkg_file_set_hash(struct pkg_file *, const char *); +void _pkg_file_set_prefix(struct pkg_file *, const char *); +void _pkg_file_set_pathname(struct pkg_file *, + const char *); +void _pkg_file_set_ignore(struct pkg_file *); +void _pkg_file_set_hash(struct pkg_file *, const char *); #endif ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#6 (text+ko) ==== @@ -13,9 +13,11 @@ #include #include #include +#include + +#include "pkg.h" -/* Cool kids club. */ -#include "internal.h" +#include "database.h" #include "freebsd_database_directorydb.h" #include "freebsd_plist.h" @@ -23,64 +25,72 @@ #include "file.h" #include "depend.h" +#include "util.h" + +/* XXX(dforsyth): Get this out of here as soon as a better pkg creation and + * setup method is in place. */ +#include "pkg_internal.h" + struct _read_plist { - struct pkg_property *plist; - char key[PATH_MAX]; - uint32_t parsed; - RB_ENTRY(_read_plist) entry; + struct pkg_property *plist; + char key[PATH_MAX]; + uint32_t parsed; + RB_ENTRY(_read_plist) entry; }; struct _directorydb { - /* Location of the database. */ - char path[PATH_MAX]; - - /* Journal handle. */ - int journal; - char journal_path[PATH_MAX]; - char journal_dir_path[PATH_MAX]; + /* Location of the database. */ + char path[PATH_MAX]; + + /* Journal handle. */ + int journal; + char journal_path[PATH_MAX]; + char journal_dir_path[PATH_MAX]; - /* A NULL terminated list of keys the db currently has. */ - char **keylist; + /* A NULL terminated list of keys the db currently has. */ + char **keylist; - /* - * The time of our last access. If this has changed, another - * directorydb instance has changes something, so we need to refresh. - */ - time_t last; + /* + * The time of our last access. If this has changed, another + * directorydb instance has changes something, so we need to refresh. + */ + time_t last; - RB_HEAD(plist_head, _read_plist) plist_head; + RB_HEAD(plist_head, _read_plist) plist_head; }; -#define CONTENTS 0x00000001 +#define CONTENTS 0x00000001 #define DESCRIPTION 0x00000002 -#define COMMENT 0x00000004 -#define DISPLAY 0x00000008 +#define COMMENT 0x00000004 +#define DISPLAY 0x00000008 static struct pkg_info { - uint32_t info_mask; - const char *info_name; - const char *file_name; + uint32_t info_mask; + const char *info_name; + const char *file_name; } pkg_entries [] = { - { CONTENTS, FBSD_METANAME_CONTENTS, "+CONTENTS" }, - { DESCRIPTION, FBSD_METANAME_DESCRIPTION, "+DESC" }, - { COMMENT, FBSD_METANAME_COMMENT, "+COMMENT" }, - { DISPLAY, FBSD_METANAME_DISPLAY, "+DISPLAY" }, - { 0, NULL, NULL }, + { CONTENTS, FBSD_METANAME_CONTENTS, "+CONTENTS" }, + { DESCRIPTION, FBSD_METANAME_DESCRIPTION, "+DESC" }, + { COMMENT, FBSD_METANAME_COMMENT, "+COMMENT" }, + { DISPLAY, FBSD_METANAME_DISPLAY, "+DISPLAY" }, + { 0, NULL, NULL }, }; -static int fbsd_directorydb_read_pkg( - struct _directorydb *, struct pkg *); -static char *read_file(const char *); -static int _read_plist_cmp(struct _read_plist *, - struct _read_plist *); -static int dselect(const struct dirent *); -static void fbsd_directorydb_pkg_setup(struct pkg_db *, - struct pkg *, const char *); +static int fbsd_directorydb_read_pkg( + struct _directorydb *, struct pkg *); +int fbsd_directorydb_finish(struct pkg_db *, + struct pkg *); +static char *read_file(const char *); +static int _read_plist_cmp(struct _read_plist *, + struct _read_plist *); +static int dselect(const struct dirent *); +static void fbsd_directorydb_pkg_setup(struct pkg_db *, + struct pkg *, const char *); RB_GENERATE_STATIC(plist_head, _read_plist, entry, _read_plist_cmp); -#define PKG_DIRDB_MAGIC 0x11111111 -#define DB_DIRDB_MAGIC 0x11111111 +#define PKG_DIRDB_MAGIC 0x11111111 +#define DB_DIRDB_MAGIC 0x11111111 /* The journal file. */ #define JOURNAL ".journal" @@ -95,282 +105,293 @@ static int _read_plist_cmp(struct _read_plist *a, struct _read_plist *b) { - return (strcmp(a->key, b->key)); + return (strcmp(a->key, b->key)); } static int dselect(const struct dirent *ent) { - return (ent->d_name[0] != '.' && ent->d_type == DT_DIR); + return (ent->d_name[0] != '.' && ent->d_type == DT_DIR); } /* Close a "connection" to a directorydb. */ int fbsd_directorydb_close(struct pkg_db *db) { - struct _directorydb *d = db->internal; - close(d->journal); - return (0); + struct _directorydb *d = db->internal; + close(d->journal); + return (0); } /* Open a "connection" to a directorydb. */ int fbsd_directorydb_open(struct pkg_db *db, const char *path) { - struct _directorydb *d; - struct stat sb; - int jfd; >>> TRUNCATED FOR MAIL (1000 lines) <<< From owner-p4-projects@FreeBSD.ORG Thu Oct 28 06:57:39 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0868010656A4; Thu, 28 Oct 2010 06:57:39 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCFD71065697 for ; Thu, 28 Oct 2010 06:57:38 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id A8A6F8FC1A for ; Thu, 28 Oct 2010 06:57:38 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9S6vcCu035945 for ; Thu, 28 Oct 2010 06:57:38 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9S6vcgv035942 for perforce@freebsd.org; Thu, 28 Oct 2010 06:57:38 GMT (envelope-from dforsyth@FreeBSD.org) Date: Thu, 28 Oct 2010 06:57:38 GMT Message-Id: <201010280657.o9S6vcgv035942@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185174 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 06:57:39 -0000 http://p4web.freebsd.org/@@185174?ac=10 Change 185174 by dforsyth@skunk on 2010/10/28 06:57:35 Do just enough to get pkg_delete to build. Also, last commit was spaces to tabs, not tabs to spaces. Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#8 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#4 edit Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#7 (text+ko) ==== @@ -16,7 +16,8 @@ freebsd_database_directorydb.c \ util.c \ file.c \ - depend.c + depend.c \ + reqby.c CFLAGS+= -std=c99 ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#8 (text+ko) ==== @@ -173,3 +173,11 @@ return (pkg); } +int +pkg_db_remove(struct pkg_db *db, struct pkg *pkg) +{ + (void)db; + (void)pkg; + return (PKG_NOT_OK); +} + ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#3 (text+ko) ==== @@ -1,6 +1,8 @@ +#include #include #include +#include "pkg.h" #include "reqby.h" struct pkg_reqby * ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#3 (text+ko) ==== @@ -21,4 +21,17 @@ #include "pkg_types.h" +struct pkg_reqby *pkg_reqby_alloc(void); + +void pkg_reqby_release(struct pkg_reqby *); + +void _pkg_reqby_set_pkg(struct pkg_reqby *, + struct pkg *); + +void _pkg_reqby_set_name(struct pkg_reqby *, + const char *); + +void _pkg_reqby_set_version(struct pkg_reqby *, + const char *); + #endif ==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#4 (text+ko) ==== @@ -1,10 +1,13 @@ +#include #include #include #include #include #include #include +#include #include +#include #include @@ -199,7 +202,8 @@ failure = 0; match_count = 0; - + + pkgs = pkg_db_pkgs(db); if (_c->match == MATCH_ALL) { TAILQ_FOREACH(pkg, pkgs, next) if (delete(pkg, db, _c) != 0) failure++; @@ -231,14 +235,11 @@ struct pkg *rpkg; +#if 0 const char *script; - const char *rb; +#endif char pathname[PATH_MAX]; int rval; - int r; - int rb_count; - const char *dep_name; - const char *dep_origin; rval = 0; @@ -255,7 +256,7 @@ } if (_c->interactive) { - fprintf(stderr, "Delete %s?", pkg_name); + fprintf(stderr, "Delete %s?", pkg_name(pkg)); fflush(stderr); /* XXX: */ } @@ -273,7 +274,8 @@ } #endif - + +#if 0 script = pkg_require(pkg); if (script != NULL) { if (_c->verbose) printf("Executing 'require' script.\n"); @@ -289,6 +291,7 @@ warnx("RUN: %s %s %s", script, pkg_name(pkg), "DEINSTALL"); } +#endif depends = pkg_depends(pkg); TAILQ_FOREACH(depend, depends, next) { @@ -332,10 +335,12 @@ if (_c->verbose) printf("Delete file %s\n", pathname); if (!_c->fake) warnx("DELETE: %s", pathname); - +#if 0 if (pkg_preserve(pkg)) {/* Do preserve stuff... */} +#endif } +#if 0 while (pkg_freebsd_get_next_unexec(p, &e) == PKG_OK) { /* * I need to do whatever format_cmd does in here so that the @@ -375,9 +380,10 @@ warnx("RUN: %s %s %s", script, pkg_name, "DEINSTALL"); } } +#endif /* Remove the package from the database. */ - pkg_database_remove_pkg(db, pkg_name); + pkg_db_remove(db, pkg); return (rval); } @@ -389,7 +395,7 @@ } static int -pkg_info_hash_match(struct pkg_file *filw) +pkg_info_hash_match(struct pkg_file *file) { char path[PATH_MAX]; char hash[33]; @@ -416,8 +422,7 @@ link_len = readlink(path, link_buf, PATH_MAX); if (link_len > 0) calc_hash = MD5Data(link_buf, link_len, hash); - - else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash); + } else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash); if (calc_hash != NULL) return ((strcmp(calc_hash, pkg_file_hash(file)) == 0 ? 1 : 0)); @@ -439,12 +444,10 @@ regfree(&re); } - if (r == 0) { - return (1); - } else if (r != REG_NOMATCH) { + if (r == 0) return (1); + else if (r != REG_NOMATCH) /* XXX: Should print an error. */ return (0); - } return (0); } From owner-p4-projects@FreeBSD.ORG Fri Oct 29 15:00:18 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4270A1065670; Fri, 29 Oct 2010 15:00:18 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC8C106564A for ; Fri, 29 Oct 2010 15:00:17 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id B90E18FC08 for ; Fri, 29 Oct 2010 15:00:17 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9TF0HeD036564 for ; Fri, 29 Oct 2010 15:00:17 GMT (envelope-from rene@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9TF0HNI036561 for perforce@freebsd.org; Fri, 29 Oct 2010 15:00:17 GMT (envelope-from rene@FreeBSD.org) Date: Fri, 29 Oct 2010 15:00:17 GMT Message-Id: <201010291500.o9TF0HNI036561@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to rene@FreeBSD.org using -f From: Rene Ladan To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185210 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 15:00:18 -0000 http://p4web.freebsd.org/@@185210?ac=10 Change 185210 by rene@rene_acer on 2010/10/29 14:59:39 IFC Affected files ... .. //depot/projects/docproj_nl/en_US.ISO8859-1/articles/contributors/contrib.additional.sgml#76 integrate .. //depot/projects/docproj_nl/en_US.ISO8859-1/books/handbook/linuxemu/chapter.sgml#7 integrate .. //depot/projects/docproj_nl/share/pgpkeys/snb.key#2 integrate .. //depot/projects/docproj_nl/www/en/donations/donors.sgml#37 integrate .. //depot/projects/docproj_nl/www/en/news/status/Makefile#11 integrate .. //depot/projects/docproj_nl/www/en/news/status/report-2010-07-2010-09.xml#2 integrate .. //depot/projects/docproj_nl/www/en/news/status/status.sgml#12 integrate .. //depot/projects/docproj_nl/www/en/releases/7.4R/Makefile#1 branch .. //depot/projects/docproj_nl/www/en/releases/7.4R/docbook.css#1 branch .. //depot/projects/docproj_nl/www/en/releases/7.4R/schedule.sgml#1 branch .. //depot/projects/docproj_nl/www/en/releases/8.2R/Makefile#1 branch .. //depot/projects/docproj_nl/www/en/releases/8.2R/docbook.css#1 branch .. //depot/projects/docproj_nl/www/en/releases/8.2R/schedule.sgml#1 branch .. //depot/projects/docproj_nl/www/en/releases/Makefile#7 integrate .. //depot/projects/docproj_nl/www/en/releng/index.sgml#38 integrate .. //depot/projects/docproj_nl/www/share/sgml/commercial.isp.xml#20 integrate .. //depot/projects/docproj_nl/www/share/sgml/commercial.software.xml#8 integrate .. //depot/projects/docproj_nl/www/share/sgml/news.xml#93 integrate Differences ... ==== //depot/projects/docproj_nl/en_US.ISO8859-1/articles/contributors/contrib.additional.sgml#76 (text+ko) ==== @@ -1,4 +1,4 @@ - + @@ -1606,58 +1606,50 @@ File system - Size (1k-blocks) - Size (GB) + Size Mounted on /dev/da0s1a - 1.016.303 - 1 + 1 GB / /dev/da0s1b - - 6 + 6 GB swap /dev/da0s1e - 2.032.623 - 2 + 2 GB /var /dev/da0s1f - 8.205.339 - 8 + 8 GB /usr /dev/da1s1e - 45.734.361 - 45 + 45 GB /compat/linux/oracle /dev/da1s1f - 2.032.623 - 2 + 2 GB /compat/linux/sapmnt /dev/da1s1g - 2.032.623 - 2 + 2 GB /compat/linux/usr/sap ==== //depot/projects/docproj_nl/share/pgpkeys/snb.key#2 (text+ko) ==== @@ -1,379 +1,74 @@ - + -uid S. Nicholas Barkas -uid [jpeg image of size 13220] -sub 2048g/AF72C3A3 2006-02-10 -sub 1024D/3F6C2D91 2009-04-21 [expires: 2010-04-21] +sub 2048R/36E181FB 2010-07-27 +sub 2048R/BDA4BED3 2010-07-29 +sub 2048R/782A8737 2010-07-29 ]]> ==== //depot/projects/docproj_nl/www/en/donations/donors.sgml#37 (text+ko) ==== @@ -1,6 +1,6 @@ - + %developers; @@ -2816,6 +2816,13 @@ lme received + + + Raymond Vetter + ATI Radeon 9800 + fjoe + received + &footer; ==== //depot/projects/docproj_nl/www/en/news/status/Makefile#11 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: www/en/news/status/Makefile,v 1.51 2010/07/22 14:20:20 danger Exp $ +# $FreeBSD: www/en/news/status/Makefile,v 1.52 2010/10/27 00:10:37 danger Exp $ .if exists(../Makefile.conf) .include "../Makefile.conf" @@ -48,6 +48,7 @@ XMLDOCS+= report-2009-10-2009-12 XMLDOCS+= report-2010-01-2010-03 XMLDOCS+= report-2010-04-2010-06 +XMLDOCS+= report-2010-07-2010-09 XSLT.DEFAULT= report.xsl ==== //depot/projects/docproj_nl/www/en/news/status/report-2010-07-2010-09.xml#2 (text+ko) ==== @@ -1,7 +1,7 @@ - + @@ -13,10 +13,23 @@
Introduction -

SUMMARY GOES HERE

+

This report covers &os;-related projects between July and + September 2010. It is the third of the four reports planned for + 2010. During this period, we were victims of one + of the biggest BSD events of the year — EuroBSDCon. + We hope that the ones of you who have been able to attend it + have enjoyed your stay. Another good news is that work on the + new minor versions of &os;, 7.4 and 8.2, is progressing well.

+ +

This report, with 55 entries, is the longest report in + the whole history and shows a good condition of the &os; + community.

+ +

Thanks to all the reporters for the excellent work! We hope you + enjoy reading it.

-

Thanks to all the reporters for the excellent work! We hope you - enjoy reading.

+

Please note that the deadline for submissions covering the period + between October and December 2010 is January 15th, 2011.

@@ -80,7 +93,7 @@ - Atheros AR913x SoC support + Atheros AR913x SoC Support @@ -102,11 +115,11 @@

&os;-CURRENT runs on the AR9132 SoC. Minor platform-specific - tweaks are needed to use it on a given piece of hardware (eg - where in flash the ethernet MAC address is stored.) The AR910x + tweaks are needed to use it on a given piece of hardware (eg., + where in flash the Ethernet MAC address is stored.) The AR910x wireless MAC/PHY is supported. The only available test platform - uses a 2.4ghz radio; 5ghz 11a mode has not been tested. As with - other atheros chipset support in &os;, 11n support is not yet + uses a 2.4GHz radio; 5GHz 11a mode has not been tested. As with + other Atheros chipset support in &os;, 11n support is not yet finished. The current development platform is the TP-Link TP-WN1043ND 802.11n wireless bridge/router. It is currently being successfully used as a 11bg access point.

@@ -115,13 +128,13 @@ USB support is currently not functional. - There is currently no support for the realtek gigabit + There is currently no support for the Realtek Gigabit switch/PHY chip. This is being worked on.
- pkg_patch + Binary Package Patch Infrastructure — pkg_patch @@ -138,7 +151,7 @@ -

pkg_patch is an tool meant to be used with the rest of the +

pkg_patch is a tool meant to be used with the rest of the pkg_* utilities whose job is to create and apply binary patches to &os; package archives. The SoC project was successfully completed but there are some open issues about the integration of @@ -156,7 +169,7 @@ - Extfs Status Report + ExtFS Status Report @@ -169,7 +182,7 @@ - project + Project wiki @@ -180,21 +193,21 @@ -

This project has two goals: pre-allocation algorithm for - ext2fs and ext4 read-only mode. The aim of pre-allocation - algorithm is to implement a reservation window mechanism. Now - this mechanism has been implemented and I have submitted a patch - file to mailing list (fs@FreeBSD.org). The aim of ext4 read-only - mode is to make it possible to read ext4 file system in read-only - mode when disk is formatted with default features. Until now it - can read data from ext4 filesystem with default features in - read-only mode. I have submitted a patch to mailing list - (fs@FreeBSD.org). I am building a new kernel module for it, which - calls ext4fs.

+

This project has two goals: pre-allocation algorithm for ext2fs + and ext4 read-only mode. Aim of the pre-allocation algorithm is + to implement a reservation window mechanism. This mechanism has + been implemented and a patch have been submitted. The aim of + ext4 read-only mode is to make it possible to read ext4 file + systems in read-only mode when the disk is formatted with + default features. Until now it can read data from ext4 file + systems with default features in read-only mode. A patch has + been submitted a patch to the freebsd-fs mailing list and there + is a new kernel module, called ext4fs, is under development for + it.

- More testing of pre-allocation algorithm. + More testing of the pre-allocation algorithm.
@@ -224,13 +237,13 @@ and applications to the &os; operating system.

Mono 2.8 has been released a few days ago and is already - available in the BSD# repository. The updates breaks a few ports - so the lang/mono updated in the &os; ports tree will be delayed + available in the BSD# repository. The update breaks a few ports + so the lang/mono update in the &os; ports tree will be delayed until those programs are fixed for a smoother update experience.

Work is in progress to include some long-awaited ports such as - deskuils/gnome-do but they require a lot of testing and hacking + deskutils/gnome-do but they require a lot of testing and hacking because they have clearly been designed to run on GNU/Linux and portability has never been a priority (which is quite amusing if you consider portability is the main reason to be for mono).

@@ -245,7 +258,7 @@ Currently low priority, some mono hackers who do not use &os; would be interested in a debug live-image of &os; to help us - diagnose and fix bugs more efficiency. + diagnose and fix bugs more effectively. @@ -299,10 +312,10 @@ -

We recently imported the 2.8 release of Clang into head. This - release contains many new features and improvements. The - integrated assembler is in this version too, but it is not ready - for general use yet.

+

We recently imported the 2.8 release of Clang into -CURRENT. + This release contains many new features and improvements. The + integrated assembler ships with this version, but it is not + ready for general use yet.

Since r212979, all necessary changes have been committed to be able to build world with Clang, at least on amd64 and i386. It @@ -336,8 +349,8 @@ - Updating base tools to accommodate ports - requirements + Updating Base Tools to Accommodate Ports + Requirements @@ -362,7 +375,7 @@

Next up on the list is to finish the implementation for newsyslog thereby allowing ports that need logs rotated to take - advantage of that tool

+ advantage of that tool.

@@ -384,7 +397,7 @@ -

All Octeon development is now ongoing in 9.0-CURRENT and most +

All Octeon development is now ongoing in -CURRENT and most Octeon-specific and general MIPS changes from the old Octeon branch have been checked in. The Simple Executive from the Cavium Octeon SDK has been checked into Subversion and most of the @@ -414,7 +427,7 @@ - Kernel event timers infrastructure + Kernel Event Timers Infrastructure @@ -435,30 +448,30 @@ -

Work on new event timers infrastructure continues. In HEAD +

Work on new event timers infrastructure continues. In -CURRENT amd64, arm (Marvell), i386, mips, pc98, powerpc, sparc64, sun4v architectures were refactored to use new timers API.

-

New machine-independent timers management code written. It +

New machine-independent timers management code was written. It can utilize both legacy periodic and new one-shot timer operation modes.

-

Using one-shot mode allows significantly reduce number of +

Using one-shot mode allows to significantly reduce the number of timer interrupts and respectively increase CPU sleep time - during idle periods. Timer interrupts on idle CPUs now + during idle periods. Timer interrupts on idle CPUs are now generated only when they are needed to handle registered - time-based events. Busy CPUs unluckily still receiving full + time-based events. Busy CPUs unluckily still receive the full interrupt rate for purposes of resource accounting, scheduling and timekeeping.

-

With some additional tuning it is now possible to have - 8-core system, receiving only about 100 interrupt per second - and respectively have CPUs idle periods up to 100ms. This +

With some additional tuning it is now possible to have an + 8-core system, receiving only about 100 interrupts per second + and respectively have CPU idle periods up to 100ms. This allows to effectively use any supported CPU idle states (C-states), that reduces power consumption and increases effect of the Intel TurboBoost technology.

-

New manual pages written to document this functionality: +

New manual pages were written to document this functionality: eventtimers(7), attimer(4), atrtc(4), hpet(4).

@@ -473,16 +486,15 @@ precision, allowing to group close events. Make schedulers tickless, or at least less depending on - time events to make possible skip timer interrupts when CPUs are - busy. + time events to make skipping timer interrupts possible when CPUs + are busy. - Merge code into 8-STABLE when it will be considered - ready. + Merge code into 8-STABLE when it is considered ready. - Ports distfile and WWW checker + Ports Distfile and WWW Checker @@ -499,7 +511,7 @@ -

Given the current status of fenner@'s Distfiles Survey, a new +

Given the current status of fenner's Distfiles Survey, a new distfile checker was written in order to have an overview for the state of each distfile in the ports tree. The distfile checker is also able to verify WWW entries in pkg-descr files. This is an @@ -512,7 +524,7 @@ - provide JavaScript to sort/filter/search tables. + Provide JavaScript to sort/filter/search tables. @@ -578,12 +590,12 @@

&os;/powerpc64 now boots multi-user SMP and is self-hosting on the Playstation 3. Booting requires a PS3 console with the OtherOS capability (fat model console with firmware < 3.21). - The only supported hardware at present is the ethernet + The only supported hardware at present is USB and the Ethernet controller.

- USB and SATA support. + SATA support. Boot loader enhancements to allow user input at the loader prompt. @@ -679,7 +691,7 @@ building.

The Ports Management team have been running -exp runs on an - ongoing basis, verifying how base system updates may affect the + on-going basis, verifying how base system updates may affect the ports tree, as well as providing QA runs for major ports updates. Of note, -exp runs were done for:

@@ -694,14 +706,14 @@
  • ade: multiple runs autotools upgrade
  • gerald: setting USE_GCC=4.5 as default
  • ashish: changes to Mk/bsd.license.mk
  • -
  • kwm: test of clang in head
  • +
  • kwm: test of Clang in -CURRENT
  • Looking for help fixing ports - broken on CURRENT. + broken on -CURRENT. Looking for help with @@ -748,7 +760,7 @@
    - USB stack + USB Stack @@ -766,10 +778,10 @@ -

    During the last two months the USB stack in &os;-current has - been enhanced to support USB 3.0 and the XHCI USB 3.0 chipset - from Intel. The XHCI chip will eventually replace the EHCI, OHCI - and UHCI chips.

    +

    During the last two months the USB stack in -CURRENT has been + enhanced to support USB 3.0 and the XHCI USB 3.0 chipset from + Intel. The XHCI chip will eventually replace the EHCI, OHCI and + UHCI chips.

    @@ -778,7 +790,7 @@
    - + &os;/mips Ralink RT3052F/Broadcom BCM5354 @@ -806,19 +818,20 @@

    Drivers status:

      -
    • rt2860: Ralink RT2860 802.11n - Worked, but RT3022 2.4G - 2T2R radio tuning required.
    • +
    • rt2860: Ralink RT2860 802.11n — Worked, but RT3022 + 2.4G 2T2R radio tuning required.
    • -
    • rt: Ralink RT3052F onChip Ethernet MAC - DONE
    • +
    • rt: Ralink RT3052F onChip Ethernet MAC — Done.
    • >>> TRUNCATED FOR MAIL (1000 lines) <<< From owner-p4-projects@FreeBSD.ORG Fri Oct 29 15:09:04 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8BAAF1065670; Fri, 29 Oct 2010 15:09:04 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E621106564A for ; Fri, 29 Oct 2010 15:09:04 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 2030C8FC0C for ; Fri, 29 Oct 2010 15:09:04 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9TF94MY038502 for ; Fri, 29 Oct 2010 15:09:04 GMT (envelope-from rene@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9TF94xl038499 for perforce@freebsd.org; Fri, 29 Oct 2010 15:09:04 GMT (envelope-from rene@FreeBSD.org) Date: Fri, 29 Oct 2010 15:09:04 GMT Message-Id: <201010291509.o9TF94xl038499@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to rene@FreeBSD.org using -f From: Rene Ladan To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185212 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 15:09:04 -0000 http://p4web.freebsd.org/@@185212?ac=10 Change 185212 by rene@rene_acer on 2010/10/29 15:08:02 MFen handbook/linuxemu 1.140 -> 1.141 Affected files ... .. //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/linuxemu/chapter.sgml#13 edit Differences ... ==== //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/linuxemu/chapter.sgml#13 (text+ko) ==== @@ -4,7 +4,7 @@ $FreeBSD: doc/nl_NL.ISO8859-1/books/handbook/linuxemu/chapter.sgml,v 1.14 2010/02/08 21:36:18 rene Exp $ %SOURCE% en_US.ISO8859-1/books/handbook/linuxemu/chapter.sgml - %SRCID% 1.140 + %SRCID% 1.141 --> @@ -1846,10 +1846,8 @@ Bestandssysteem - Grootte (1k-blokken) + Grootte - Grootte (GB) - Aangekoppeld op @@ -1858,19 +1856,15 @@ /dev/da0s1a - 1.016.303 + 1 GB - 1 - / /dev/da0s1b - - - 6 + 6 GB swap @@ -1878,9 +1872,7 @@ /dev/da0s1e - 2.032.623 - - 2 + 2 GB /var @@ -1888,9 +1880,7 @@ /dev/da0s1f - 8.205.339 - - 8 + 8 GB /usr @@ -1898,9 +1888,7 @@ /dev/da1s1e - 45.734.361 - - 45 + 45 GB /compat/linux/oracle @@ -1908,9 +1896,7 @@ /dev/da1s1f - 2.032.623 - - 2 + 2 GB /compat/linux/sapmnt @@ -1918,9 +1904,7 @@ /dev/da1s1g - 2.032.623 - - 2 + 2 GB /compat/linux/usr/sap From owner-p4-projects@FreeBSD.ORG Sat Oct 30 19:35:00 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E32BF1065673; Sat, 30 Oct 2010 19:34:59 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5166106566B for ; Sat, 30 Oct 2010 19:34:59 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 75EE98FC18 for ; Sat, 30 Oct 2010 19:34:59 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9UJYxmR095658 for ; Sat, 30 Oct 2010 19:34:59 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9UJYxpC095655 for perforce@freebsd.org; Sat, 30 Oct 2010 19:34:59 GMT (envelope-from dforsyth@FreeBSD.org) Date: Sat, 30 Oct 2010 19:34:59 GMT Message-Id: <201010301934.o9UJYxpC095655@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185248 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 19:35:00 -0000 http://p4web.freebsd.org/@@185248?ac=10 Change 185248 by dforsyth@skunk on 2010/10/30 19:34:47 start bringing back lazy loading-ish behavior. Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#10 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#9 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_types.h#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_add/pkg_add.c#4 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/pkg_info.c#6 edit Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#7 (text+ko) ==== @@ -76,9 +76,9 @@ { 0, NULL, NULL }, }; -static int fbsd_directorydb_read_pkg( - struct _directorydb *, struct pkg *); -int fbsd_directorydb_finish(struct pkg_db *, +static int fbsd_directorydb_read_pkg(struct _directorydb *, + struct pkg *, uint32_t); +int fbsd_directorydb_finish(struct pkg_db *, struct pkg *); static char *read_file(const char *); static int _read_plist_cmp(struct _read_plist *, @@ -87,6 +87,12 @@ static void fbsd_directorydb_pkg_setup(struct pkg_db *, struct pkg *, const char *); +static int fbsd_directorydb_read_name(struct pkg *); +static int fbsd_directorydb_read_origin(struct pkg *); +static int fbsd_directorydb_read_comment(struct pkg *); +static int fbsd_directorydb_read_format_revision(struct pkg *); +static int fbsd_directorydb_read_description(struct pkg *); + RB_GENERATE_STATIC(plist_head, _read_plist, entry, _read_plist_cmp); #define PKG_DIRDB_MAGIC 0x11111111 @@ -102,6 +108,17 @@ #define _pkg_check_magic(p) assert(p->magic == PKG_DIRDB_MAGIC) #define _db_check_magic(db) assert(db->magic == DB_DIRDB_MAGIC) +#define READ_FUNCTION(fn_name, src_mask) \ +static int \ +fn_name(struct pkg *pkg) \ +{ \ + struct pkg_db *db; \ + struct _directorydb *d; \ + db = pkg->source; \ + d = db->internal; \ + return (fbsd_directorydb_read_pkg(d, pkg, src_mask)); \ +} + static int _read_plist_cmp(struct _read_plist *a, struct _read_plist *b) { @@ -191,6 +208,15 @@ pkg->magic = PKG_DIRDB_MAGIC; pkg->source = db; strcpy(pkg->key, key); + + /* Set up our callbacks. */ + pkg->read_name = fbsd_directorydb_read_name; + pkg->read_origin = fbsd_directorydb_read_origin; + pkg->read_format_revision = fbsd_directorydb_read_format_revision; + + pkg->read_comment = fbsd_directorydb_read_comment; + + pkg->read_description = fbsd_directorydb_read_description; pkg->add_file = fbsd_directorydb_add_file; @@ -223,12 +249,7 @@ pkg = pkg_alloc(); /* XXX: I should just do a get here. */ fbsd_directorydb_pkg_setup(db, pkg, ents[i]->d_name); - /* XXX: For now just hit every mask. */ - if (fbsd_directorydb_read_pkg(d, pkg) != PKG_OK) { - /* Do clean up */ - printf("bad read\n"); - return (NULL); - } + TAILQ_INSERT_TAIL(list, pkg, next); free(ents[i]); } @@ -313,7 +334,6 @@ } fbsd_directorydb_pkg_setup(db, pkg, key); - fbsd_directorydb_read_pkg(d, pkg); return (PKG_OK); } @@ -329,8 +349,15 @@ return (PKG_OK); } +READ_FUNCTION(fbsd_directorydb_read_name, CONTENTS); +READ_FUNCTION(fbsd_directorydb_read_origin, CONTENTS); +READ_FUNCTION(fbsd_directorydb_read_format_revision, CONTENTS); +READ_FUNCTION(fbsd_directorydb_read_comment, COMMENT); +READ_FUNCTION(fbsd_directorydb_read_description, DESCRIPTION); + static int -fbsd_directorydb_read_pkg(struct _directorydb *d, struct pkg *pkg) +fbsd_directorydb_read_pkg(struct _directorydb *d, struct pkg *pkg, + uint32_t mask) { struct pkg_info *pi; char path[PATH_MAX]; @@ -338,13 +365,15 @@ int r; for (pi = pkg_entries; pi->info_name != NULL; pi++) { - _pkg_util_path_join(path, d->path, pkg->key); - _pkg_util_path_join(path, path, pi->file_name); - - if ((data = read_file(path)) == NULL) continue; + if (mask & pi->info_mask) { + _pkg_util_path_join(path, d->path, pkg->key); + _pkg_util_path_join(path, path, pi->file_name); + + if ((data = read_file(path)) == NULL) continue; - r = fbsd_plist_parse(pkg, data, pi->info_name); - if (r != PKG_OK) return (r); + r = fbsd_plist_parse(pkg, data, pi->info_name); + if (r != PKG_OK) return (r); + } } return (PKG_OK); @@ -395,3 +424,4 @@ return (sb.st_uid); } + ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#7 (text+ko) ==== ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#10 (text+ko) ==== @@ -91,7 +91,7 @@ void _pkg_set_origin(struct pkg *pkg, const char *origin) { - pkg->origin = strndup(origin, PATH_MAX); + strncpy(pkg->origin, origin, PATH_MAX); } void ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_types.h#2 (text+ko) ==== @@ -10,53 +10,53 @@ struct pkg { /* The magic value will let us know what type of underlying interface * we're dealing with. */ - unsigned int magic; - char key[PATH_MAX]; - void *source; /* XXX: Make this a union. */ + unsigned int magic; + char key[PATH_MAX]; + void *source; /* XXX: Make this a union. */ - void (*read_origin) (struct pkg *); - char *origin; + int (*read_origin) (struct pkg *); + char origin[PATH_MAX]; - void (*read_name) (struct pkg *); - char name[PATH_MAX]; + int (*read_name) (struct pkg *); + char name[PATH_MAX]; - void (*read_srcdir) (struct pkg *); - char srcdir[PATH_MAX]; + int (*read_srcdir) (struct pkg *); + char srcdir[PATH_MAX]; - void (*read_format_revision) (struct pkg *); - char format_revision[256]; + int (*read_format_revision) (struct pkg *); + char format_revision[256]; - void (*read_comment) (struct pkg *); + int (*read_comment) (struct pkg *); /* This is 128 for now, I'd like it down at 80. */ - char comment[128]; + char comment[128]; - void (*read_description) (struct pkg *); - char *description; + int (*read_description) (struct pkg *); + char *description; - void (*read_files) (struct pkg *); - struct pkg_file_list *files; + int (*read_files) (struct pkg *); + struct pkg_file_list *files; - void (*read_depends) (struct pkg *); - struct pkg_depend_list *depends; + int (*read_depends) (struct pkg *); + struct pkg_depend_list *depends; - void (*read_conflicts) (struct pkg *); + int (*read_conflicts) (struct pkg *); struct pkg_conflict_list *conflicts; - void (*read_reqbys) (struct pkg *); - struct pkg_reqby_list *reqbys; + int (*read_reqbys) (struct pkg *); + struct pkg_reqby_list *reqbys; - int (*has_file) (struct pkg *); - int (*has_depend) (struct pkg *); - int (*has_conflict) (struct pkg *); + int (*has_file) (struct pkg *); + int (*has_depend) (struct pkg *); + int (*has_conflict) (struct pkg *); - struct pkg_file *(*add_file) (struct pkg *, const char *, + struct pkg_file *(*add_file) (struct pkg *, const char *, const char *); - struct pkg_depend *(*add_depend) (struct pkg *, const char *, - const char *); - struct pkg_conflict *(*add_conflict) (struct pkg *, const char *, - const char *); + struct pkg_depend *(*add_depend) (struct pkg *, const char *, + const char *); + struct pkg_conflict *(*add_conflict) (struct pkg *, const char *, + const char *); struct pkg_reqby *(*add_reqby) (struct pkg *, const char *, - const char *); + const char *); int (*remove_file) (struct pkg *, struct pkg_file *); ==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_add/pkg_add.c#4 (text+ko) ==== @@ -19,7 +19,6 @@ #include #include -#include #define ADD_NODEPS 0x00000001 #define ADD_NORECORD 0x00000002 ==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_info/pkg_info.c#6 (text+ko) ==== @@ -700,13 +700,13 @@ } if (_c->show_flags & SHOW_ORIGIN) { - if (_c->quiet) printf("%sOrigin:\n", _c->info_prefix); + if (!_c->quiet) printf("%sOrigin:\n", _c->info_prefix); printf("%s\n", pkg_origin(pkg)); } if (_c->show_flags & SHOW_FMTREV) { - if (_c->quiet) + if (!_c->quiet) printf("%sFormat revision:\n", _c->info_prefix); printf("%s\n", pkg_format_revision(pkg));