summaryrefslogtreecommitdiff
path: root/harness/cases/8.t
blob: dbcf04492ca32b67d40c392c9c3c9fd804ac8b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* 8.t
- Ditto for the above three tests at the offset maximum (largest
  possible ext2/3 file size.) (8.t)
 */
#include <sys/types.h>
#include <unistd.h>

long long get_fs_limit(int fd)
{
	long long min = 0, max = 9223372036854775807LL;
	char c = 0;
	int ret;

	while (max - min > 1) {
		if (pwrite64(fd, &c, 1, (min + max) / 2) == -1)
			max = (min + max) / 2;
		else {
			ret = ftruncate(fd, 0);
			assert(ret == 0);
			min = (min + max) / 2;
		}
	}
	return max;
}

#define SET_RLIMIT(x)	do ; while (0)
#define LIMIT		get_fs_limit(rwfd)
#define FILENAME	"testdir.ext2/rwfile"

#include "common-7-8.h"