libalpm
Arch Linux Package Manager Library
diskspace.h
Go to the documentation of this file.
00001 /*
00002  *  diskspace.h
00003  *
00004  *  Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef _ALPM_DISKSPACE_H
00021 #define _ALPM_DISKSPACE_H
00022 
00023 #if defined(HAVE_SYS_MOUNT_H)
00024 #include <sys/mount.h>
00025 #endif
00026 #if defined(HAVE_SYS_STATVFS_H)
00027 #include <sys/statvfs.h>
00028 #endif
00029 #if defined(HAVE_SYS_TYPES_H)
00030 #include <sys/types.h>
00031 #endif
00032 
00033 #include "alpm.h"
00034 
00035 enum mount_used_level {
00036     USED_REMOVE = 1,
00037     USED_INSTALL = (1 << 1),
00038 };
00039 
00040 typedef struct __alpm_mountpoint_t {
00041     /* mount point information */
00042     char *mount_dir;
00043     size_t mount_dir_len;
00044     /* storage for additional disk usage calculations */
00045     blkcnt_t blocks_needed;
00046     blkcnt_t max_blocks_needed;
00047     enum mount_used_level used;
00048     int read_only;
00049     FSSTATSTYPE fsp;
00050 } alpm_mountpoint_t;
00051 
00052 int _alpm_check_diskspace(alpm_handle_t *handle);
00053 int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
00054         size_t num_files, off_t *file_sizes);
00055 
00056 #endif /* _ALPM_DISKSPACE_H */
00057 
00058 /* vim: set ts=2 sw=2 noet: */