aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/config/db.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2015-01-29 23:32:05 +0100
committerAndreas Fischer <bantu@phpbb.com>2015-01-29 23:32:05 +0100
commit1e94b0ae71d4523fc48b3870336bdb1d4bae8812 (patch)
tree7494dffa927072dc7f58a7efc226d3132fd24c07 /phpBB/phpbb/config/db.php
parent5fea945b5b72f6ccf898c304a926fff69233dd81 (diff)
downloadforums-1e94b0ae71d4523fc48b3870336bdb1d4bae8812.tar
forums-1e94b0ae71d4523fc48b3870336bdb1d4bae8812.tar.gz
forums-1e94b0ae71d4523fc48b3870336bdb1d4bae8812.tar.bz2
forums-1e94b0ae71d4523fc48b3870336bdb1d4bae8812.tar.xz
forums-1e94b0ae71d4523fc48b3870336bdb1d4bae8812.zip
[prep-release-3.0.13] Also update version in references to files.
Diffstat (limited to 'phpBB/phpbb/config/db.php')
0 files changed, 0 insertions, 0 deletions
href='#n20'>20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
package swap; # $Id$

use diagnostics;
use strict;

use MDK::Common::DataStructure;
use common;
use log;
use devices;
use c;


my $pagesize = c::getpagesize();
my $signature_page = "\0" x $pagesize;

# Maximum allowable number of pages in one swap.
# From 2.2.0 onwards, this depends on how many offset bits
# the architectures can actually store into the page tables
# and on 32bit architectures it is limited to 2GB at the
# same time.
# Old swap format keeps the limit of 8*pagesize*(pagesize - 10)

my $V0_MAX_PAGES = 8 * $pagesize - 10;
my $V1_OLD_MAX_PAGES = int 0x7fffffff / $pagesize - 1;
my $V1_MAX_PAGES = $V1_OLD_MAX_PAGES; #- (1 << 24) - 1;
my $MAX_BADPAGES = int(($pagesize - 1024 - 128 * $sizeof_int - 10) / $sizeof_int);
my $signature_format_v1 = "x1024 I I I I125"; #- bootbits, version, last_page, nr_badpages, padding

1;

sub kernel_greater_or_equal($$$) {
    c::kernel_version() =~ /(\d*)\.(\d*)\.(\d*)/;
    ($1 <=> $_[0] || $2 <=> $_[1] || $3 <=> $_[2]) >= 0;
}

sub check_blocks {
    my ($fd, $version, $nbpages) = @_;
    my ($last_read_ok, $badpages) = (0, 0);
    my ($buffer);
    my $badpages_field_v1 = \substr($signature_page, psizeof($signature_format_v1));

    for (my $i = 0; $i < $nbpages; $i++) {

	$last_read_ok || sysseek($fd, $i * $pagesize, 0) or die "seek failed";

	unless ($last_read_ok = sysread($fd, $buffer, $pagesize)) {
	    if ($version == 1) {
		$badpages == $MAX_BADPAGES and die "too many bad pages";
		vec($$badpages_field_v1, $badpages, $bitof_int) = $i;
	    }
	    $badpages++;
	}
	vec($signature_page, $i, 1) = to_bool($last_read_ok) if $version == 0;
    }

    #- TODO: add interface

    $badpages and log::l("$badpages bad pages\n");
    return $badpages;
}

sub make($;$) {