From owner-p4-projects@FreeBSD.ORG Fri Nov 23 06:34:01 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 154C716A468; Fri, 23 Nov 2007 06:34:01 +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 B3B0616A419 for ; Fri, 23 Nov 2007 06:34:00 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BF2AF13C442 for ; Fri, 23 Nov 2007 06:34:00 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lAN6Y0Yi031654 for ; Fri, 23 Nov 2007 06:34:00 GMT (envelope-from gcooper@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lAN6Y03V031647 for perforce@freebsd.org; Fri, 23 Nov 2007 06:34:00 GMT (envelope-from gcooper@FreeBSD.org) Date: Fri, 23 Nov 2007 06:34:00 GMT Message-Id: <200711230634.lAN6Y03V031647@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gcooper@FreeBSD.org using -f From: Garrett Cooper To: Perforce Change Reviews Cc: Subject: PERFORCE change 129419 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2007 06:34:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=129419 Change 129419 by gcooper@optimus-pkg_revised on 2007/11/23 06:34:00 Sandbox-related: More development for tonight. libpkg-related: Just being anal in terms of style, spelling, and naming.. Affected files ... .. //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_repo.c#2 edit .. //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_repo.h#2 edit .. //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_repo_private.h#2 edit .. //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_sandbox.h#2 edit .. //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_sandbox_private.h#2 edit Differences ... ==== //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_repo.c#2 (text+ko) ==== @@ -45,7 +45,7 @@ */ struct pkg_repo * pkg_repo_new(pkg_repo_get_pkg_callback *pkg_get, - pkg_repo_free_callback *pfree) + pkg_repo_free_callback *pkg_free) { struct pkg_repo *repo; @@ -55,7 +55,7 @@ } repo->pkg_get = pkg_get; - repo->pkg_free = pfree; + repo->pkg_free = pkg_free; repo->data = NULL; @@ -79,17 +79,14 @@ struct pkg * pkg_repo_get_pkg(struct pkg_repo *repo, const char *pkg_name) { - if (!repo) { - return NULL; - } + if (repo == NULL) + return NULL; - if (!pkg_name) { - return NULL; - } + if (pkg_name == NULL) + return NULL; - if (!repo->pkg_get) { - return NULL; - } + if (repo->pkg_get == NULL) + return NULL; return repo->pkg_get(repo, pkg_name); } @@ -101,12 +98,11 @@ int pkg_repo_free(struct pkg_repo *repo) { - if (!repo) { - return -1; - } + if (!repo) + return -1; if (repo->pkg_free) - repo->pkg_free(repo); + repo->pkg_free(repo); free(repo); ==== //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_repo.h#2 (text+ko) ==== @@ -1,5 +1,6 @@ /* * Copyright (C) 2005, Andrew Turner + * Copyright (C) 2007, Garrett Cooper * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,15 +30,15 @@ #define __LIBPKG_PKG_REPO_H__ /* - * A Repo is a store of 0 or more packages. - * eg. ftp server, cdrom, local directory. + * A Repo is a store of 0+ packages, + * e.g. a ftp server, cdrom, or local directory. */ struct pkg_repo; struct pkg_repo *pkg_repo_new_files(void); struct pkg_repo *pkg_repo_new_ftp(const char *, const char *, const char *); struct pkg_repo *pkg_repo_new_local_freebsd(void); -struct pkg *pkg_repo_get_pkg(struct pkg_repo *, const char *); -int pkg_repo_free(struct pkg_repo *); +struct pkg *pkg_repo_get_pkg(struct pkg_repo *, const char *); +int pkg_repo_free(struct pkg_repo *); #endif /* __LIBPKG_PKG_REPO_H__ */ ==== //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_repo_private.h#2 (text+ko) ==== @@ -29,10 +29,10 @@ #define __LIBPKG_PKG_REPO_PRIVATE_H__ typedef struct pkg *pkg_repo_get_pkg_callback(struct pkg_repo *, const char *); -typedef int pkg_repo_free_callback(struct pkg_repo *); +typedef int pkg_repo_free_callback(struct pkg_repo *); -struct pkg_repo *pkg_repo_new(pkg_repo_get_pkg_callback *, - pkg_repo_free_callback *); +struct pkg_repo *pkg_repo_new(pkg_repo_get_pkg_callback *, + pkg_repo_free_callback *); struct pkg_repo { void *data; @@ -41,4 +41,4 @@ pkg_repo_free_callback *pkg_free; }; -#endif /* __LIBPKG_PKG_REPO_PRIVATE_H__ */ +#endif /* __LIBPKG_PKG_REPO_PRIVATE_H__ */ ==== //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_sandbox.h#2 (text+ko) ==== @@ -28,13 +28,21 @@ #ifndef __LIBPKG_PKG_SANDBOX_H__ #define __LIBPKG_PKG_SANDBOX_H__ +enum _pkg_sandbox_level_err_type { + PKG_SANDBOX_NULL = 0, + PKG_SANDBOX_PREINSTALL, + PKG_SANDBOX_FILE_EXTRACT, + PKG_SANDBOX_FILE_INSTALL, + PKG_SANDBOX_POSTINSTALL, + PKG_SANDBOX_COMPLETE = 25 +}; + struct pkg_sandbox; -#define +struct pkg_sandbox *pkg_sandbox_new_sandbox(); +int pkg_sandbox_purge_sandbox(struct pkg_sandbox*, int); +int pkg_sandbox_destroy_sandbox(struct pkg_sandbox*, int); +int pkg_sandbox_set_criticality_level(struct pkg_sandbox*, int); +int pkg_sandbox_free_sandbox(struct pkg_sandbox *); -struct pkg_sandbox *pkg_sandbox_new(); -int pkg_sandbox_destroy(struct pkg_sandbox*, int); -int pkg_sandbox_set_criticality_level(int); -int pkg_sandbox_free(struct pkg_sandbox *); - -#endif /* __LIBPKG_PKG_SANDBOX_H__ */ +#endif /* __LIBPKG_PKG_SANDBOX_H__ */ ==== //depot/projects/soc2007/gcooper-fbsdpkg_revised/v2/contrib/libpkg/pkg_sandbox_private.h#2 (text+ko) ==== @@ -28,16 +28,38 @@ #ifndef __LIBPKG_PKG_SANDBOX_PRIVATE_H__ #define __LIBPKG_PKG_SANDBOX_PRIVATE_H__ +typedef int pkg_sandbox_purge_sandbox_callback(struct pkg_sandbox*, int); +typedef int pkg_sandbox_destroy_sandbox_callback(struct pkg_sandbox*, int); +typedef int pkg_sandbox_set_criticality_level_callback(struct pkg_sandbox*, int); +typedef int pkg_sandbox_free_sandbox_callback(struct pkg_sandbox *); + +struct pkg_sandbox *pkg_sandbox_new(pkg_sandbox_purge_sandbox_callback *, + pkg_sandbox_destroy_sandbox_callback *, + pkg_sandbox_set_criticality_level_callback *, + pkg_sandbox_free_sandbox_callback *); + /* * A sandbox is a safe place where files are extracted - * temporarily, and if signals are specified by the user + * temporarily during the install process to avoid + * collisions with already installed packages, and if + * signals are specified by the user * and the install isn't in a critical phase (actually * finalizing an install, i.e removing old files), * rollback all changes being performed with installing * the package. */ typedef struct { - int criticality_level + + int criticality_level; + + struct pkg *package; + + pkg_sandbox_free_sandbox_callback *free_sandbox; + + pkg_sandbox_purge_sandbox_callback *purge_sandbox; + pkg_sandbox_destroy_sandbox_callback *destroy_sandbox; + pkg_sandbox_set_criticality_level_callback *set_criticality_level; + } pkg_sandbox; -#endif /* __LIBPKG_PKG_SANDBOX_PRIVATE_H__ */ +#endif /* __LIBPKG_PKG_SANDBOX_PRIVATE_H__ */