mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
mkswap: do not do extra seek
mount: add another mount helper call method
This commit is contained in:
parent
c85bfcad52
commit
32d49bc70f
@ -392,9 +392,11 @@ config FEATURE_MOUNT_HELPERS
|
|||||||
depends on MOUNT
|
depends on MOUNT
|
||||||
help
|
help
|
||||||
Enable mounting of virtual file systems via external helpers.
|
Enable mounting of virtual file systems via external helpers.
|
||||||
E.g. mount obexfs#-b00.11.22.33.44.55 /mnt will in effect call
|
E.g. "mount obexfs#-b00.11.22.33.44.55 /mnt" will in effect call
|
||||||
obexfs -b00.11.22.33.44.55 /mnt
|
"obexfs -b00.11.22.33.44.55 /mnt"
|
||||||
The idea is to use such virtual filesystems in /etc/fstab
|
Also "mount -t sometype [-o opts] fs /mnt" will try
|
||||||
|
"sometype [-o opts] fs /mnt" if simple mount syscall fails.
|
||||||
|
The idea is to use such virtual filesystems in /etc/fstab.
|
||||||
|
|
||||||
config FEATURE_MOUNT_NFS
|
config FEATURE_MOUNT_NFS
|
||||||
bool "Support mounting NFS file systems"
|
bool "Support mounting NFS file systems"
|
||||||
|
@ -66,7 +66,9 @@ int mkswap_main(int argc, char **argv)
|
|||||||
fd = xopen(argv[1], O_RDWR);
|
fd = xopen(argv[1], O_RDWR);
|
||||||
/* fdlength was reported to be unreliable - use seek */
|
/* fdlength was reported to be unreliable - use seek */
|
||||||
len = xlseek(fd, 0, SEEK_END);
|
len = xlseek(fd, 0, SEEK_END);
|
||||||
|
#if ENABLE_SELINUX
|
||||||
xlseek(fd, 0, SEEK_SET);
|
xlseek(fd, 0, SEEK_SET);
|
||||||
|
#endif
|
||||||
pagesize = getpagesize();
|
pagesize = getpagesize();
|
||||||
printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n",
|
printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n",
|
||||||
len - pagesize);
|
len - pagesize);
|
||||||
|
@ -309,6 +309,27 @@ static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
rc = mount(mp->mnt_fsname, mp->mnt_dir, mp->mnt_type,
|
rc = mount(mp->mnt_fsname, mp->mnt_dir, mp->mnt_type,
|
||||||
vfsflags, filteropts);
|
vfsflags, filteropts);
|
||||||
|
|
||||||
|
// If mount failed, try
|
||||||
|
// helper program <mnt_type>
|
||||||
|
if (ENABLE_FEATURE_MOUNT_HELPERS && rc) {
|
||||||
|
char *args[6];
|
||||||
|
int errno_save = errno;
|
||||||
|
args[0] = mp->mnt_type;
|
||||||
|
rc = 1;
|
||||||
|
if (filteropts) {
|
||||||
|
args[rc++] = (char *)"-o";
|
||||||
|
args[rc++] = filteropts;
|
||||||
|
}
|
||||||
|
args[rc++] = mp->mnt_fsname;
|
||||||
|
args[rc++] = mp->mnt_dir;
|
||||||
|
args[rc] = NULL;
|
||||||
|
rc = wait4pid(spawn(args));
|
||||||
|
if (!rc)
|
||||||
|
break;
|
||||||
|
errno = errno_save;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rc || (vfsflags & MS_RDONLY) || (errno != EACCES && errno != EROFS))
|
if (!rc || (vfsflags & MS_RDONLY) || (errno != EACCES && errno != EROFS))
|
||||||
break;
|
break;
|
||||||
if (!(vfsflags & MS_SILENT))
|
if (!(vfsflags & MS_SILENT))
|
||||||
|
Loading…
Reference in New Issue
Block a user