summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-02 13:17:26 -0400
committerDan McGee <dan@archlinux.org>2007-06-02 13:17:26 -0400
commited13ac2cc8dd15d8a19d769cc77941ad18ac1a7c (patch)
treeb20ca34955ce27277638b26a99c6284d8729b004 /lib/libalpm/trans.c
parentfe2c58fc9211dfc1d50c145397b947325abd1bdc (diff)
downloadpacman-ed13ac2cc8dd15d8a19d769cc77941ad18ac1a7c.tar.xz
Remove freespace checking code
This code depends on /etc/mtab existance, which is not very reliable in all cases, especially in a chroot or non-Linux environment. Dump it for now until we can find a better way. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 2637197c..3c6a0c3d 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -540,85 +540,6 @@ cleanup:
return(retval);
}
-#ifndef __sun__
-static long long get_freespace()
-{
- struct mntent *mnt;
- const char *table = MOUNTED;
- FILE *fp;
- long long ret=0;
-
- if((fp = setmntent(table, "r")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("cannot read disk space information from %s: %s"),
- table, strerror(errno));
- return(-1);
- }
-
- while ((mnt = getmntent(fp)))
- {
- struct statvfs64 buf;
-
- statvfs64(mnt->mnt_dir, &buf);
- ret += buf.f_bavail * buf.f_bsize;
- }
-
- endmntent(fp);
-
- return(ret);
-}
-
-int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data)
-{
- alpm_list_t *i;
- long long pkgsize=0, freespace;
-
- ALPM_LOG_FUNC;
-
- for(i = trans->packages; i; i = i->next) {
- if(trans->type == PM_TRANS_TYPE_SYNC)
- {
- pmsyncpkg_t *sync = i->data;
- if(sync->type != PM_SYNC_TYPE_REPLACE) {
- pmpkg_t *pkg = sync->pkg;
- pkgsize += alpm_pkg_get_isize(pkg);
- }
- }
- else
- {
- pmpkg_t *pkg = i->data;
- pkgsize += alpm_pkg_get_size(pkg);
- }
- }
- freespace = get_freespace();
- _alpm_log(PM_LOG_DEBUG, _("check_freespace: total pkg size: %lld, disk space: %lld"), pkgsize, freespace);
- if(pkgsize > freespace) {
- if(data) {
- long long *ptr;
- if((ptr = malloc(sizeof(long long)))==NULL) {
- _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
- pm_errno = PM_ERR_MEMORY;
- return(-1);
- }
- *ptr = pkgsize;
- *data = alpm_list_add(*data, ptr);
- if((ptr = malloc(sizeof(long long)))==NULL) {
- _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
- FREELIST(*data);
- pm_errno = PM_ERR_MEMORY;
- return(-1);
- }
- *ptr = freespace;
- *data = alpm_list_add(*data, ptr);
- }
- pm_errno = PM_ERR_DISK_FULL;
- return(-1);
- }
- else {
- return(0);
- }
-}
-#endif
-
pmtranstype_t SYMEXPORT alpm_trans_get_type()
{
/* Sanity checks */