Date: Fri, 23 Nov 2007 06:34:00 GMT From: Garrett Cooper <gcooper@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 129419 for review Message-ID: <200711230634.lAN6Y03V031647@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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__ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711230634.lAN6Y03V031647>
