Warn when user use sectorsize bigger than the page size, which will lead

to problems when the geli device is used with file system or as a swap.

Hopefully will prevent problems like kern/98742 in the future.

MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2007-03-05 12:41:44 +00:00
parent 4802040ebf
commit 97a669a3b2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167229
2 changed files with 8 additions and 0 deletions

View File

@ -609,6 +609,10 @@ eli_init(struct gctl_req *req)
gctl_error(req, "Invalid sector size.");
return;
}
if (val > sysconf(_SC_PAGE_SIZE)) {
gctl_error(req, "warning: Using sectorsize bigger than "
"the page size!");
}
md.md_sectorsize = val;
}

View File

@ -355,6 +355,10 @@ g_eli_ctl_onetime(struct gctl_req *req, struct g_class *mp)
gctl_error(req, "Invalid sector size.");
return;
}
if (*sectorsize > PAGE_SIZE) {
gctl_error(req, "warning: Using sectorsize bigger than "
"the page size!");
}
md.md_sectorsize = *sectorsize;
}