blob: c14c2c55a4fe479fa36a313ff2ea2f467223adaf (
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
31
32
33
34
35
36
37
|
/*
* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
*/
#include "resize.h"
/* the front-end for kernel on-line resizer */
int resize_fs_online(char * devname, unsigned long blocks)
{
static char buf[40];
FILE * f;
struct mntent * mnt;
if ((f = setmntent (MOUNTED, "r")) == NULL)
goto fail;
while ((mnt = getmntent (f)) != NULL)
if(strcmp(devname, mnt->mnt_fsname) == 0) {
if (strcmp(mnt->mnt_type,"reiserfs"))
die ("resize_reiserfs: can\'t resize fs other than reiserfs\n");
sprintf(buf,"resize=%lu", blocks);
if (mount(mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type,
(unsigned long)(MS_MGC_VAL | MS_REMOUNT), buf))
die ("resize_reiserfs: remount failed: %s\n", strerror(errno));
endmntent(f);
return 0;
}
fail:
die ("resize_reiserfs: can't find mount entry\n");
return 1;
}
|