summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
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 */