Skip to content

Commit

Permalink
Merge branch 'dracut'
Browse files Browse the repository at this point in the history
  • Loading branch information
behlendorf committed Mar 22, 2011
2 parents 716895b + ae26d04 commit f47c42e
Show file tree
Hide file tree
Showing 81 changed files with 4,178 additions and 148 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ to the project and deserve to be acknowledged.
Ned Bass <[email protected]>
Herb Wartens <[email protected]>
Jim Garlick <[email protected]>
Manuel Amador (Rudd-O) <[email protected]>
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include $(top_srcdir)/config/deb.am
include $(top_srcdir)/config/tgz.am

if CONFIG_USER
USER_DIR = etc man scripts lib cmd
USER_DIR = dracut etc man scripts lib cmd
endif
if CONFIG_KERNEL
KERNEL_DIR = module
Expand Down
10 changes: 6 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = etc man scripts lib cmd module include
DIST_SUBDIRS = dracut etc man scripts lib cmd module include
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
Expand Down Expand Up @@ -180,6 +180,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down Expand Up @@ -324,7 +325,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@CONFIG_USER_TRUE@USER_DIR = etc man scripts lib cmd
@CONFIG_USER_TRUE@USER_DIR = dracut etc man scripts lib cmd
@CONFIG_KERNEL_TRUE@KERNEL_DIR = module
SUBDIRS = $(USER_DIR) $(KERNEL_DIR) include
AUTOMAKE_OPTIONS = foreign
Expand Down Expand Up @@ -953,8 +954,9 @@ deb-utils: deb-local rpm-utils
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3; \
$(RM) $$pkg1 $$pkg2 $$pkg3
pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \
$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4

deb: deb-modules deb-utils
tgz-local:
Expand Down
1 change: 1 addition & 0 deletions cmd/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/mount_zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
56 changes: 38 additions & 18 deletions cmd/mount_zfs/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ static const option_map_t option_map[] = {
#ifdef MS_STRICTATIME
{ MNTOPT_DFRATIME, MS_STRICTATIME, ZS_COMMENT },
#endif
#ifdef HAVE_SELINUX
{ MNTOPT_CONTEXT, MS_COMMENT, ZS_NOCONTEXT },
{ MNTOPT_NOCONTEXT, MS_COMMENT, ZS_NOCONTEXT },
{ MNTOPT_FSCONTEXT, MS_COMMENT, ZS_NOCONTEXT },
{ MNTOPT_DEFCONTEXT, MS_COMMENT, ZS_NOCONTEXT },
{ MNTOPT_ROOTCONTEXT, MS_COMMENT, ZS_NOCONTEXT },
#endif
#ifdef MS_I_VERSION
{ MNTOPT_IVERSION, MS_I_VERSION, ZS_COMMENT },
#endif
Expand Down Expand Up @@ -158,10 +156,10 @@ parse_option(char *mntopt, unsigned long *mntflags,
* otherwise they are considered fatal are copied in to badopt.
*/
static int
parse_options(char *mntopts, unsigned long *mntflags,
unsigned long *zfsflags, int sloppy, char *badopt)
parse_options(char *mntopts, unsigned long *mntflags, unsigned long *zfsflags,
int sloppy, char *badopt, char *mtabopt)
{
int error = 0, quote = 0, flag = 0;
int error = 0, quote = 0, flag = 0, count = 0;
char *ptr, *opt, *opts;

opts = strdup(mntopts);
Expand Down Expand Up @@ -197,6 +195,16 @@ parse_options(char *mntopts, unsigned long *mntflags,
if (error) {
strcpy(badopt, opt);
goto out;

}

if (!(*mntflags & MS_REMOUNT) &&
!(*zfsflags & ZS_ZFSUTIL)) {
if (count > 0)
strlcat(mtabopt, ",", MNT_LINE_MAX);

strlcat(mtabopt, opt, MNT_LINE_MAX);
count++;
}

opt = NULL;
Expand Down Expand Up @@ -299,8 +307,9 @@ main(int argc, char **argv)
char legacy[ZFS_MAXPROPLEN];
char mntopts[MNT_LINE_MAX] = { '\0' };
char badopt[MNT_LINE_MAX] = { '\0' };
char mtabopt[MNT_LINE_MAX] = { '\0' };
char *dataset, *mntpoint;
unsigned long mntflags = 0, zfsflags = 0;
unsigned long mntflags = 0, zfsflags = 0, remount_ro = 0;
int sloppy = 0, fake = 0, verbose = 0, nomtab = 0, zfsutil = 0;
int error, c;

Expand Down Expand Up @@ -358,24 +367,25 @@ main(int argc, char **argv)
mntpoint = argv[1];

/* validate mount options and set mntflags */
error = parse_options(mntopts, &mntflags, &zfsflags, sloppy, badopt);
error = parse_options(mntopts, &mntflags, &zfsflags, sloppy,
badopt, mtabopt);
if (error) {
switch (error) {
case ENOMEM:
(void) fprintf(stderr, gettext("filesystem '%s' "
"cannot be mounted due to a memory allocation "
"failure\n"), dataset);
"failure.\n"), dataset);
return (MOUNT_SYSERR);
case EINVAL:
case ENOENT:
(void) fprintf(stderr, gettext("filesystem '%s' "
"cannot be mounted of due to the invalid option "
"'%s'\n"), dataset, badopt);
"cannot be mounted of due invalid option "
"'%s'.\n"), dataset, badopt);
(void) fprintf(stderr, gettext("Use the '-s' option "
"to ignore the bad mount option.\n"));
return (MOUNT_USAGE);
default:
(void) fprintf(stderr, gettext("filesystem '%s' "
"cannot be mounted due to internal error %d\n"),
"cannot be mounted due to internal error %d.\n"),
dataset, error);
return (MOUNT_SOFTWARE);
}
Expand All @@ -388,23 +398,29 @@ main(int argc, char **argv)
* done until zfs is added to the default selinux policy configuration
* as a known filesystem type which supports xattrs.
*/
if (is_selinux_enabled() && !(zfsflags & ZS_NOCONTEXT))
if (is_selinux_enabled() && !(zfsflags & ZS_NOCONTEXT)) {
(void) strlcat(mntopts, ",context=\"system_u:"
"object_r:file_t:s0\"", sizeof (mntopts));
(void) strlcat(mtabopt, ",context=\"system_u:"
"object_r:file_t:s0\"", sizeof (mtabopt));
}
#endif /* HAVE_LIBSELINUX */


if (verbose)
(void) fprintf(stdout, gettext("mount.zfs:\n"
" dataset: \"%s\"\n mountpoint: \"%s\"\n"
" mountflags: 0x%lx\n zfsflags: 0x%lx\n"
" mountopts: \"%s\"\n\n"),
dataset, mntpoint, mntflags, zfsflags, mntopts);
" mountopts: \"%s\"\n mtabopts: \"%s\"\n"),
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);

if (mntflags & MS_REMOUNT)
nomtab = 1;

if (zfsflags * ZS_ZFSUTIL)
if ((mntflags & MS_REMOUNT) && (mntflags & MS_RDONLY))
remount_ro = 1;

if (zfsflags & ZS_ZFSUTIL)
zfsutil = 1;

if ((g_zfs = libzfs_init()) == NULL)
Expand All @@ -429,6 +445,10 @@ main(int argc, char **argv)
* 'zfs mount'. However, since 'zfs mount' actually invokes 'mount'
* we differentiate the two cases using the 'zfsutil' mount option.
* This mount option should only be supplied by the 'zfs mount' util.
*
* The only exception to the above rule is '-o remount,ro'. This is
* always allowed for non-legacy datasets for rc.sysinit/umountroot
* to safely remount the root filesystem and flush its cache.
*/
if (zfsutil && !strcmp(legacy, ZFS_MOUNTPOINT_LEGACY)) {
(void) fprintf(stderr, gettext(
Expand All @@ -439,7 +459,7 @@ main(int argc, char **argv)
return (MOUNT_USAGE);
}

if (!zfsutil && strcmp(legacy, ZFS_MOUNTPOINT_LEGACY)) {
if (!zfsutil && strcmp(legacy, ZFS_MOUNTPOINT_LEGACY) && !remount_ro) {
(void) fprintf(stderr, gettext(
"filesystem '%s' cannot be mounted using 'mount'.\n"
"Use 'zfs set mountpoint=%s' or 'zfs mount %s'.\n"
Expand Down Expand Up @@ -467,7 +487,7 @@ main(int argc, char **argv)
}

if (!nomtab && mtab_is_writeable()) {
error = mtab_update(dataset, mntpoint, MNTTYPE_ZFS, mntopts);
error = mtab_update(dataset, mntpoint, MNTTYPE_ZFS, mtabopt);
if (error)
return (error);
}
Expand Down
1 change: 1 addition & 0 deletions cmd/zdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zinject/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zpios/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool_id/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool_layout/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/ztest/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
1 change: 1 addition & 0 deletions cmd/zvol_id/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
Expand Down
5 changes: 3 additions & 2 deletions config/deb.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ deb-utils: deb-local rpm-utils
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3; \
$(RM) $$pkg1 $$pkg2 $$pkg3
pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \
$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4

deb: deb-modules deb-utils
14 changes: 14 additions & 0 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,20 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
AC_MSG_RESULT([$DEFAULT_PACKAGE])
AC_SUBST(DEFAULT_PACKAGE)
AC_MSG_CHECKING([default init script type])
case "$VENDOR" in
fedora) DEFAULT_INIT_SCRIPT=fedora ;;
redhat) DEFAULT_INIT_SCRIPT=fedora ;;
sles) DEFAULT_INIT_SCRIPT=lsb ;;
ubuntu) DEFAULT_INIT_SCRIPT=lsb ;;
debian) DEFAULT_INIT_SCRIPT=lsb ;;
slackware) DEFAULT_INIT_SCRIPT=lsb ;;
*) DEFAULT_INIT_SCRIPT=lsb ;;
esac
AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT])
AC_SUBST(DEFAULT_INIT_SCRIPT)
])

dnl #
Expand Down
Loading

0 comments on commit f47c42e

Please sign in to comment.