1 diff -Naur util-linux-ng/configure.ac losetup-2.16.2/configure.ac
2 --- util-linux-ng/configure.ac 2012-07-23 15:26:57.000000000 +0530
3 +++ losetup-2.16.2/configure.ac 2012-07-23 15:47:41.000000000 +0530
5 | awk -F- '{print $1}')
6 PACKAGE_VERSION_RELEASE=0
9 -LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
10 -LIBBLKID_DATE="10-Feb-2009"
14 -LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
17 -LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
21 -LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
23 # Check whether exec_prefix=/usr:
24 case $exec_prefix:$prefix in
25 @@ -256,177 +242,16 @@
26 AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes)
29 -AC_ARG_ENABLE([fsck],
30 - AS_HELP_STRING([--disable-fsck], [do not build fsck]),
33 -AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes)
36 -AC_ARG_ENABLE([libuuid],
37 - AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]),
38 - [], enable_libuuid=yes
40 -AC_SUBST([LIBUUID_VERSION])
41 -AC_SUBST([LIBUUID_VERSION_INFO])
42 -AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes)
45 -if test "x$enable_libuuid" = xno; then
46 - # Check for external (e2fsprogs) libuuid
47 - PKG_CHECK_MODULES(UUID, uuid, [have_uuid=yes], [have_uuid=no])
48 - if test "x$have_uuid" = xno; then
49 - # system without pkg-config or so, try classic check
50 - AC_CHECK_LIB(uuid, uuid_is_null, [have_uuid=yes], [have_uuid=no])
52 - if test "x$have_uuid" = xyes; then
53 - UTIL_SET_FLAGS($UUID_CFLAGS, $UUID_CFLAGS, $UUID_LIBS)
54 - AC_CHECK_HEADERS([uuid.h uuid/uuid.h], [break], [])
59 - AC_DEFINE(HAVE_UUID_H, 1, [Define to 1 if you have the <uuid.h> header file.])
62 -if test "x$have_uuid" = xyes; then
63 - AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.])
65 - AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs])
67 -AM_CONDITIONAL(HAVE_UUID, test "x$have_uuid" = xyes)
69 -: ${UUID_LIBS='-luuid'}
72 -AC_ARG_ENABLE([uuidd],
73 - AS_HELP_STRING([--disable-uuidd], [do not build the uuid daemon]),
74 - [], enable_uuidd=auto
77 -case "$enable_uuidd:$have_uuid" in
79 - AC_MSG_ERROR([cannot enable uuidd when libuuid is disabled]) ;;
81 - enable_uuidd=$have_uuid ;;
83 -if test "x$enable_uuidd" = xyes; then
84 - AC_DEFINE(HAVE_UUIDD, 1, [Define to 1 if you want to use uuid daemon.])
86 -AM_CONDITIONAL(BUILD_UUIDD, test "x$enable_uuidd" = xyes)
89 -AC_ARG_ENABLE([libblkid],
90 - AS_HELP_STRING([--disable-libblkid], [do not build libblkid and blkid utilities]),
91 - [], enable_libblkid=yes
93 -AC_SUBST([LIBBLKID_VERSION])
94 -AC_SUBST([LIBBLKID_VERSION_INFO])
95 -AM_CONDITIONAL(BUILD_LIBBLKID, test "x$enable_libblkid" = xyes)
96 -AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string])
97 -AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string])
100 -if test "x$enable_libblkid" = xno; then
101 - if test "x$build_mount" = xyes || test "x$enable_fsck" = xyes; then
102 - # Check for external (e2fsprogs) libblkid
103 - PKG_CHECK_MODULES(BLKID, blkid, [have_blkid=yes], [have_blkid=no])
104 - if test "x$have_blkid" = xno; then
105 - # system without pkg-config or so, try classic check
106 - AC_CHECK_LIB(blkid, blkid_get_cache, [have_blkid=yes], [have_blkid=no])
108 - if test "x$have_blkid" = xyes; then
109 - UTIL_SET_FLAGS($BLKID_CFLAGS, $BLKID_CFLAGS, $BLKID_LIBS)
110 - AC_CHECK_HEADERS([blkid.h blkid/blkid.h], [break], [])
113 - if test -n "$enable_static_programs"; then
114 - # TODO check only when mount of fsck are requested
115 - UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid])
120 - AC_DEFINE(HAVE_BLKID_H, 1, [Define to 1 if you have the <blkid.h> header file.])
121 - AC_DEFINE(HAVE_BLKID_EVALUATE_TAG, 1, [Define to 1 if you have the blkid_evaluate_tag().])
124 -if test "x$have_blkid" = xyes; then
125 - AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.])
127 - if test "x$build_mount" = xyes; then
128 - AC_MSG_ERROR([libblkid is needed to build util-linux-ng mount])
130 - if test "x$enable_fsck" = xyes; then
131 - AC_MSG_ERROR([libblkid is needed to build util-linux-ng fsck])
134 -AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes)
136 -: ${BLKID_LIBS='-lblkid -luuid'}
138 -AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid])
141 UTIL_CHECK_LIB(util, openpty)
142 UTIL_CHECK_LIB(termcap, tgetnum)
144 -AM_GNU_GETTEXT_VERSION([0.14.1])
145 -AM_GNU_GETTEXT([external])
146 -if test -d "$srcdir/po"
148 - ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
150 - ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
153 -AC_ARG_WITH([ncurses],
154 - AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses, default is wide version
155 - (--without-ncurses disables all ncurses(w) support)]),
156 - [], with_ncurses=auto
158 -AM_CONDITIONAL(HAVE_NCURSES, false)
160 -if test "x$with_ncurses" != xno; then
162 - AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h], [
163 - if test "x$with_ncurses" = xauto; then
164 - UTIL_CHECK_LIB(ncursesw, initscr, ncurses)
165 - if test "x$have_ncurses" = xyes; then
166 - NCURSES_LIBS="-lncursesw"
169 - if test "x$have_ncurses" = xno; then
170 - UTIL_CHECK_LIB(ncurses, initscr)
171 - if test "x$have_ncurses" = xyes; then
172 - NCURSES_LIBS="-lncurses"
176 - if test "x$have_ncurses" = xno; then
177 - AC_MSG_ERROR([ncurses or ncursesw selected, but library not found (--without-ncurses to disable)])
180 -AC_SUBST([NCURSES_LIBS])
183 -AC_ARG_WITH([slang],
184 - AS_HELP_STRING([--with-slang], [compile cfdisk with slang]),
189 -AC_CHECK_LIB(tinfo, tgetent, [have_tinfo=yes])
190 -AM_CONDITIONAL(HAVE_TINFO, test "x$have_tinfo" = xyes)
193 -if test "x$with_slang" = xyes; then
194 - AC_CHECK_HEADERS([slcurses.h slang/slcurses.h], [use_slang=yes])
195 - if test "x$use_slang" = xno; then
196 - AC_MSG_ERROR([slang selected but slcurses.h not found])
199 -AM_CONDITIONAL(USE_SLANG, test "x$use_slang" = xyes)
202 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
203 @@ -634,244 +459,8 @@
204 [], enable_cramfs=check
207 -if test "x$enable_cramfs" = xno; then
211 - dnl Trick: leave the third parameter empty to get the default action.
212 - AC_CHECK_LIB(z, crc32, [], build_cramfs=no)
213 - case $enable_cramfs:$build_cramfs in
214 - yes:no) AC_MSG_ERROR([cramfs selected but libz not found]);;
217 -AM_CONDITIONAL(BUILD_CRAMFS, test "x$build_cramfs" = xyes)
220 -AC_ARG_ENABLE([switch_root],
221 - AS_HELP_STRING([--disable-switch_root], [do not build switch_root]),
222 - [], enable_switch_root=check
225 -if test "x$enable_switch_root" = xno; then
226 - build_switch_root=no
228 - build_switch_root=yes
229 - case $enable_switch_root:$linux_os in
230 - yes:no) AC_MSG_ERROR([switch_root selected for non-linux system]);;
231 - check:no) AC_MSG_WARN([non-linux system; do not build switch_root])
232 - build_switch_root=no;;
234 - if test "x$build_switch_root" = xyes; then
235 - case $enable_switch_root:$have_openat in
236 - yes:no) AC_MSG_ERROR([switch_root selected but openat() function not found]);;
237 - check:no) AC_MSG_WARN([openat() function not found; do not build switch_root])
238 - build_switch_root=no;;
242 -AM_CONDITIONAL(BUILD_SWITCH_ROOT, test "x$build_switch_root" = xyes)
245 -AC_ARG_ENABLE([elvtune],
246 - AS_HELP_STRING([--enable-elvtune], [build elvtune (only works with 2.2 and 2.4 kernels)]),
247 - [], enable_elvtune=no
249 -AM_CONDITIONAL(BUILD_ELVTUNE, test "x$enable_elvtune" = xyes)
252 -AC_ARG_ENABLE([init],
253 - AS_HELP_STRING([--enable-init], [build simpleinit, shutdown, initctl]),
256 -AM_CONDITIONAL(BUILD_INIT, test "x$enable_init" = xyes)
259 -AC_ARG_ENABLE([kill],
260 - AS_HELP_STRING([--enable-kill], [build kill]),
263 -AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
266 -AC_ARG_ENABLE([last],
267 - AS_HELP_STRING([--enable-last], [build last]),
270 -AM_CONDITIONAL(BUILD_LAST, test "x$enable_last" = xyes)
273 -AC_ARG_ENABLE([mesg],
274 - AS_HELP_STRING([--enable-mesg], [build mesg]),
277 -AM_CONDITIONAL(BUILD_MESG, test "x$enable_mesg" = xyes)
280 -AC_ARG_ENABLE([partx],
281 - AS_HELP_STRING([--enable-partx], [build addpart, delpart, partx]),
282 - [], enable_partx=no
284 -AM_CONDITIONAL(BUILD_PARTX, test "x$enable_partx" = xyes)
287 -AC_ARG_ENABLE([raw],
288 - AS_HELP_STRING([--enable-raw], [build raw]),
291 -AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes)
294 -AC_ARG_ENABLE([rdev],
295 - AS_HELP_STRING([--enable-rdev], [build rdev on i386]),
298 -AM_CONDITIONAL(BUILD_RDEV, test "x$enable_rdev" = xyes)
301 -AC_ARG_ENABLE([rename],
302 - AS_HELP_STRING([--disable-rename], [do not build rename]),
303 - [], enable_rename=yes
305 -AM_CONDITIONAL(BUILD_RENAME, test "x$enable_rename" = xyes)
308 -AC_ARG_ENABLE([reset],
309 - AS_HELP_STRING([--enable-reset], [build reset]),
310 - [], enable_reset=no
312 -AM_CONDITIONAL(BUILD_RESET, test "x$enable_reset" = xyes)
315 -AC_ARG_ENABLE([login-utils],
316 - AS_HELP_STRING([--enable-login-utils], [build chfn, chsh, login, newgrp, vipw]),
317 - [], enable_login_utils=no
319 -AM_CONDITIONAL(BUILD_LOGIN_UTILS, test "x$enable_login_utils" = xyes)
322 - [AS_HELP_STRING([--without-pam], [compile login-utils without PAM support])])
324 -AM_CONDITIONAL(HAVE_PAM, false)
325 -if test "x$enable_login_utils" = xyes && test "x$with_pam" != xno; then
326 - AC_CHECK_HEADERS([security/pam_misc.h],
327 - [AM_CONDITIONAL(HAVE_PAM, true)],
328 - [if test "x$with_pam" = xyes; then
329 - AC_MSG_ERROR([PAM selected but security/pam_misc.h not found])
334 -AC_ARG_WITH([selinux],
335 - AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
336 - [], with_selinux=no
339 -if test "x$with_selinux" = xno; then
340 - AM_CONDITIONAL(HAVE_SELINUX, false)
342 - UTIL_CHECK_LIB(selinux, getprevcon)
343 - case "$with_selinux:$have_selinux" in
344 - yes:no) AC_MSG_ERROR([SELinux selected but libselinux not found]);;
348 -if test "x$have_selinux" = xyes; then
349 - SELINUX_LIBS="-lselinux -lsepol"
350 - SELINUX_LIBS_STATIC="-lselinux -lsepol"
351 - old_LDFLAGS="$LDFLAGS"
352 - LDFLAGS="$LDFLAGS $SELINUX_LIBS"
353 - # This function is missing in old libselinux 1.xx versions
354 - AC_CHECK_FUNCS([security_get_initial_context])
355 - LDFLAGS="$old_LDFLAGS"
357 -AC_SUBST([SELINUX_LIBS])
358 -AC_SUBST([SELINUX_LIBS_STATIC])
360 -AC_ARG_WITH([audit],
361 - AS_HELP_STRING([--with-audit], [compile with audit support]),
365 -if test "x$with_audit" = xno; then
366 - AM_CONDITIONAL(HAVE_AUDIT, false)
368 - UTIL_CHECK_LIB(audit, audit_log_user_message)
369 - case "$with_audit:$have_audit" in
371 - AC_MSG_ERROR([Audit selected but libaudit not found (or doesn't support audit_log_user_message())])
376 -AC_ARG_ENABLE([schedutils],
377 - AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]),
378 - [], enable_schedutils=yes
380 -AM_CONDITIONAL(BUILD_SCHEDUTILS, test "x$enable_schedutils" = xyes)
383 -AC_ARG_ENABLE([wall],
384 - AS_HELP_STRING([--disable-wall], [do not build wall]),
385 - [], enable_wall=yes
387 -AM_CONDITIONAL(BUILD_WALL, test "x$enable_wall" = xyes)
390 -AC_ARG_ENABLE([write],
391 - AS_HELP_STRING([--enable-write], [build write]),
392 - [], enable_write=no
394 -AM_CONDITIONAL(BUILD_WRITE, test "x$enable_write" = xyes)
397 -AC_ARG_ENABLE([chsh-only-listed],
398 - AS_HELP_STRING([--disable-chsh-only-listed], [chsh: allow shells not in /etc/shells]),
399 - [], enable_chsh_only_listed=yes
402 -if test "x$enable_chsh_only_listed" = xyes; then
403 - AC_DEFINE(ONLY_LISTED_SHELLS, 1, [Should chsh allow only shells in /etc/shells?])
407 -AC_ARG_ENABLE([login-chown-vcs],
408 - AS_HELP_STRING([--enable-login-chown-vcs], [let login chown /dev/vcsN]),
409 - [], enable_login_chown_vcs=no
412 -if test "x$enable_login_chown_vcs" = xyes; then
413 - AC_DEFINE(LOGIN_CHOWN_VCS, 1, [Should login chown /dev/vcsN?])
417 -AC_ARG_ENABLE([login-stat-mail],
418 - AS_HELP_STRING([--enable-login-stat-mail], [let login stat() the mailbox]),
419 - [], enable_login_stat_mail=no
422 -if test "x$enable_login_stat_mail" = xyes; then
423 - AC_DEFINE(LOGIN_STAT_MAIL, 1, [Should login stat() the mailbox?])
427 -AC_ARG_ENABLE([pg-bell],
428 - AS_HELP_STRING([--disable-pg-bell], [let pg not ring the bell on invalid keys]),
429 - [], enable_pg_bell=yes
432 -if test "x$enable_pg_bell" = xyes; then
433 - AC_DEFINE(PG_BELL, 1, [Should pg ring the bell on invalid keys?])
437 -AC_ARG_ENABLE([require-password],
438 - AS_HELP_STRING([--disable-require-password], [do not require the user to enter the password in chfn and chsh]),
439 - [], enable_require_password=yes
442 -if test "x$enable_require_password" = xyes; then
443 - AC_DEFINE(REQUIRE_PASSWORD, 1, [Should chfn and chsh require the user to enter the password?])
447 AC_ARG_ENABLE([use-tty-group],
449 AC_CONFIG_HEADERS(config.h)
459 -login-utils/Makefile
461 -misc-utils/chkdupexe:misc-utils/chkdupexe.pl
467 -shlibs/blkid/blkid.pc
468 -shlibs/blkid/Makefile
469 -shlibs/blkid/src/Makefile
470 -shlibs/blkid/src/probers/Makefile
472 -shlibs/uuid/Makefile
473 -shlibs/uuid/man/Makefile
474 -shlibs/uuid/src/Makefile
478 -tests/helpers/Makefile
484 diff -Naur util-linux-ng/Makefile.am losetup-2.16.2/Makefile.am
485 --- util-linux-ng/Makefile.am 2012-07-23 15:26:57.000000000 +0530
486 +++ losetup-2.16.2/Makefile.am 2012-07-23 15:47:23.000000000 +0530
488 include $(top_srcdir)/config/include-Makefile.am
507 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
508 -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
524 ACLOCAL_AMFLAGS = -I m4
527 | xargs $(top_srcdir)/tools/checkconfig.sh $(top_srcdir)
530 -ENABLE_ALL = --enable-static-programs --with-fsprobe=builtin \
531 - --enable-elvtune --enable-init --enable-kill --enable-last \
532 - --enable-mesg --enable-partx --enable-raw --enable-rdev --enable-reset \
533 - --enable-login-utils --enable-write --enable-arch --enable-mount
534 +ENABLE_ALL = --enable-mount
535 DISTCHECK_CONFIGURE_FLAGS = --disable-use-tty-group $(ENABLE_ALL)
536 diff -Naur util-linux-ng/mount/lomount.c losetup-2.16.2/mount/lomount.c
537 --- util-linux-ng/mount/lomount.c 2012-07-23 15:26:57.000000000 +0530
538 +++ losetup-2.16.2/mount/lomount.c 2012-07-23 15:30:17.000000000 +0530
541 #include "pathnames.h"
543 -#define SIZE(a) (sizeof(a)/sizeof(a[0]))
547 static int is_associated(int dev, struct stat *file, unsigned long long offset, int isoff);
548 @@ -667,6 +665,162 @@
552 +set_loop1(const char *device, const char *file, unsigned long long offset,
553 + unsigned long long sizelimit, const char *encryption, const char *pass, int *options) {
554 + struct loop_info64 loopinfo64;
555 + int fd, ffd, mode, i;
559 + char *xdev = loopfile_used(file, offset);
562 + printf(_("warning: %s is already associated with %s\n"),
568 + mode = (*options & SETLOOP_RDONLY) ? O_RDONLY : O_RDWR;
569 + if ((ffd = open(file, mode)) < 0) {
570 + if (!(*options & SETLOOP_RDONLY) &&
571 + (errno == EROFS || errno == EACCES))
572 + ffd = open(file, mode = O_RDONLY);
578 + printf(_("warning: %s: is write-protected, using read-only.\n"),
580 + *options |= SETLOOP_RDONLY;
582 + if ((fd = open(device, mode)) < 0) {
587 + memset(&loopinfo64, 0, sizeof(loopinfo64));
589 + if (!(filename = canonicalize(file)))
590 + filename = (char *) file;
591 + xstrncpy((char *)loopinfo64.lo_file_name, filename, LO_NAME_SIZE);
593 + if (encryption && *encryption) {
594 + if (digits_only(encryption)) {
595 + loopinfo64.lo_encrypt_type = atoi(encryption);
597 + loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI;
598 + snprintf((char *)loopinfo64.lo_crypt_name, LO_NAME_SIZE,
603 + loopinfo64.lo_offset = offset;
604 + loopinfo64.lo_sizelimit = sizelimit;
608 + * Oh-oh, sensitive data coming up. Better lock into memory to prevent
609 + * passwd etc being swapped out and left somewhere on disk.
611 + if (loopinfo64.lo_encrypt_type != LO_CRYPT_NONE) {
612 + if(mlockall(MCL_CURRENT | MCL_FUTURE)) {
614 + fprintf(stderr, _("Couldn't lock into memory, exiting.\n"));
620 + switch (loopinfo64.lo_encrypt_type) {
621 + case LO_CRYPT_NONE:
622 + loopinfo64.lo_encrypt_key_size = 0;
628 + memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE);
629 + xstrncpy((char *)loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
630 + loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
633 + if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
636 + if (errno == EBUSY) {
638 + printf(_("ioctl LOOP_SET_FD failed: %s\n"),
642 + perror("ioctl: LOOP_SET_FD");
646 + if (file != filename)
652 + if (*options & SETLOOP_AUTOCLEAR)
653 + loopinfo64.lo_flags = LO_FLAGS_AUTOCLEAR;
655 + i = ioctl(fd, LOOP_SET_STATUS64, &loopinfo64);
657 + struct loop_info loopinfo;
660 + i = loop_info64_to_old(&loopinfo64, &loopinfo);
663 + *options &= ~SETLOOP_AUTOCLEAR;
664 + perror("ioctl: LOOP_SET_STATUS64");
666 + i = ioctl(fd, LOOP_SET_STATUS, &loopinfo);
668 + perror("ioctl: LOOP_SET_STATUS");
670 + memset(&loopinfo, 0, sizeof(loopinfo));
673 + if ((*options & SETLOOP_AUTOCLEAR) && !is_loopfd_autoclear(fd))
674 + /* kernel doesn't support loop auto-destruction */
675 + *options &= ~SETLOOP_AUTOCLEAR;
677 + memset(&loopinfo64, 0, sizeof(loopinfo64));
680 + ioctl (fd, LOOP_CLR_FD, 0);
682 + if (file != filename)
688 + * HACK: here we're leeking a file descriptor,
689 + * but mount is a short-lived process anyway.
691 + if (!(*options & SETLOOP_AUTOCLEAR))
695 + printf(_("set_loop(%s,%s,%llu,%llu): success\n"),
696 + device, filename, offset, sizelimit);
697 + if (file != filename)
705 + * 2 - error (EBUSY)
708 set_loop(const char *device, const char *file, unsigned long long offset,
709 unsigned long long sizelimit, const char *encryption, int pfd, int *options) {
710 struct loop_info64 loopinfo64;
712 " -o | --offset <num> start at offset <num> into file\n"
713 " --sizelimit <num> loop limited to only <num> bytes of the file\n"
714 " -p | --pass-fd <num> read passphrase from file descriptor <num>\n"
715 + " -k | --passwd <passphrase> get passphrase\n"
716 " -r | --read-only setup read-only loop device\n"
717 " --show print device name (with -f <file>)\n"
718 " -v | --verbose verbose mode\n\n"));
722 main(int argc, char **argv) {
723 - char *p, *offset, *sizelimit, *encryption, *passfd, *device, *file, *assoc;
724 + char *p, *offset, *sizelimit, *encryption, *passfd, *device, *file, *assoc, *passwd;
725 int delete, find, c, all, capacity;
729 { "offset", 1, 0, 'o' },
730 { "sizelimit", 1, 0, 128 },
731 { "pass-fd", 1, 0, 'p' },
732 + { "passwd", 1, 0, 'k'},
733 { "read-only", 0, 0, 'r' },
734 { "show", 0, 0, 's' },
735 { "verbose", 0, 0, 'v' },
736 @@ -940,13 +1096,13 @@
737 capacity = delete = find = all = 0;
740 - assoc = offset = sizelimit = encryption = passfd = NULL;
741 + assoc = offset = sizelimit = encryption = passfd = passwd = NULL;
744 if ((p = strrchr(progname, '/')) != NULL)
747 - while ((c = getopt_long(argc, argv, "acde:E:fhj:o:p:rsv",
748 + while ((c = getopt_long(argc, argv, "acde:E:fhj:o:p:k:rsv",
749 longopts, NULL)) != -1) {
762 @@ -1057,7 +1216,11 @@
763 if (passfd && sscanf(passfd, "%d", &pfd) != 1)
766 - res = set_loop(device, file, off, slimit, encryption, pfd, &ro);
768 + res = set_loop1(device, file, off, slimit, encryption, passwd, &ro);
770 + res = set_loop(device, file, off, slimit, encryption, pfd, &ro);
772 if (res == 2 && find) {
774 printf(_("stolen loop=%s...trying again\n"),
775 diff -Naur util-linux-ng/mount/lomount.h losetup-2.16.2/mount/lomount.h
776 --- util-linux-ng/mount/lomount.h 2012-07-23 15:26:57.000000000 +0530
777 +++ losetup-2.16.2/mount/lomount.h 2012-07-23 15:30:17.000000000 +0530
779 extern int set_loop(const char *, const char *, unsigned long long, unsigned long long,
780 const char *, int, int *);
781 +extern int set_loop1(const char *, const char *, unsigned long long, unsigned long long,
782 + const char *, const char *, int *);
783 extern int del_loop(const char *);
784 extern int is_loop_device(const char *);
785 extern int is_loop_autoclear(const char *device);
786 diff -Naur util-linux-ng/mount/Makefile.am losetup-2.16.2/mount/Makefile.am
787 --- util-linux-ng/mount/Makefile.am 2012-07-23 15:26:57.000000000 +0530
788 +++ losetup-2.16.2/mount/Makefile.am 2012-07-23 15:48:00.000000000 +0530
790 include $(top_srcdir)/config/include-Makefile.am
792 -EXTRA_DIST = README.mount
794 -bin_PROGRAMS = mount umount
795 -sbin_PROGRAMS = losetup swapon
796 -dist_man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8
797 +bin_PROGRAMS = losetup
799 # generic sources for all programs (mount, umount, losetup)
800 srcs_common = sundries.c xmalloc.c ../lib/canonicalize.c sundries.h xmalloc.h
802 -# generic header for mount and umount
803 -hdrs_mount = fstab.h mount_mntent.h mount_constants.h \
804 - lomount.h getusername.h loop.h
806 -# generic sources for mount and umount
807 -srcs_mount = fstab.c mount_mntent.c getusername.c lomount.c devname.c devname.h \
808 - $(srcs_common) $(hdrs_mount) ../lib/env.c ../lib/linux_version.c \
809 - ../lib/blkdev.c ../lib/fsprobe.c
811 -# generic flags for all programs (except losetup)
812 -# -- note that pkg-config autoconf macros (pkg.m4) does not differentiate
813 -# between CFLAGS and CPPFLAGS, we follow this behaviour and use CFLAGS only.
818 -# generic libtool options for all static programs
819 -ldflags_static ="-all-static"
821 -mount_SOURCES = mount.c $(srcs_mount) ../lib/setproctitle.c
822 -mount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) $(cflags_common)
823 -mount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
824 -mount_LDADD = $(ldadd_common)
826 -umount_SOURCES = umount.c $(srcs_mount)
827 -umount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) $(cflags_common)
828 -umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
829 -umount_LDADD = $(ldadd_common)
831 -swapon_SOURCES = swapon.c swap_constants.h ../lib/linux_version.c \
832 - ../lib/blkdev.c ../lib/fsprobe.c ../lib/canonicalize.c
833 -swapon_CFLAGS = $(cflags_common)
834 -swapon_LDADD = $(ldadd_common)
835 +ldflags_static = -all-static
837 losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h
838 losetup_CPPFLAGS = -DMAIN $(AM_CPPFLAGS)
840 -mount_static_LDADD =
842 -if HAVE_STATIC_MOUNT
843 -bin_PROGRAMS += mount.static
844 -mount_static_SOURCES = $(mount_SOURCES)
845 -mount_static_CFLAGS = $(cflags_common)
846 -mount_static_LDFLAGS = $(ldflags_static)
847 -mount_static_LDADD += $(ldadd_static)
850 -if HAVE_STATIC_UMOUNT
851 -bin_PROGRAMS += umount.static
852 -umount_static_SOURCES = $(umount_SOURCES)
853 -umount_static_CFLAGS = $(cflags_common)
854 -umount_static_LDFLAGS = $(ldflags_static)
855 -umount_static_LDADD = $(ldadd_static)
858 -if HAVE_STATIC_LOSETUP
859 -bin_PROGRAMS += losetup.static
860 -losetup_static_SOURCES = $(losetup_SOURCES)
861 -losetup_static_LDFLAGS = $(ldflags_static)
862 -losetup_static_CPPFLAGS = -DMAIN $(AM_CPPFLAGS)
866 -ldadd_common += $(ul_libblkid_la)
867 -ldadd_static += $(ul_libblkid_la)
868 -cflags_common += -I$(ul_libblkid_srcdir)
870 -ldadd_common += $(BLKID_LIBS)
871 -ldadd_static += $(BLKID_LIBS_STATIC)
872 -cflags_common += $(BLKID_CFLAGS)
876 -mount_LDADD += $(SELINUX_LIBS)
877 -mount_static_LDADD += $(SELINUX_LIBS_STATIC)
880 -noinst_PROGRAMS = mtab_lock_test
881 -mtab_lock_test_SOURCES = fstab.c $(srcs_common) $(hdrs_mount)
882 -mtab_lock_test_CPPFLAGS = -DMAIN_TEST_MTABLOCK $(AM_CPPFLAGS)
885 - chmod 4755 $(DESTDIR)$(bindir)/mount
886 - chmod 4755 $(DESTDIR)$(bindir)/umount
887 - cd $(DESTDIR)$(sbindir) && ln -sf swapon swapoff