RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   10-Jun-2017 02:22:36
  Branch: rpm-5_4                          Handle: 2017061000223501

  Modified files:           (Branch: rpm-5_4)
    rpm                     CHANGES
    rpm/rpmio               librpmio.vers mount.c poptIO.c poptIO.h
                            rpmio_internal.h tmount.c tzstd.c

  Log:
    - rpmio: add rpmioB2N/rpmioN2B to display/set bit soup.

  Summary:
    Revision    Changes     Path
    1.3501.2.575+1  -0      rpm/CHANGES
    2.199.2.88  +2  -0      rpm/rpmio/librpmio.vers
    2.2.10.2    +331 -2     rpm/rpmio/mount.c
    1.94.2.36   +97 -265    rpm/rpmio/poptIO.c
    1.8.4.8     +16 -0      rpm/rpmio/poptIO.h
    2.127.2.16  +1  -1      rpm/rpmio/rpmio_internal.h
    1.1.2.2     +215 -29    rpm/rpmio/tmount.c
    1.1.2.7     +9  -3      rpm/rpmio/tzstd.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3501.2.574 -r1.3501.2.575 CHANGES
  --- rpm/CHANGES       9 Jun 2017 04:39:10 -0000       1.3501.2.574
  +++ rpm/CHANGES       10 Jun 2017 00:22:35 -0000      1.3501.2.575
  @@ -1,4 +1,5 @@
   5.4.17 -> 5.4.18:
  +    - jbj: rpmio: add rpmioB2N/rpmioN2B to display/set bit soup.
       - jbj: rpmio: rename rpmio{Fts,Open}Flags.
       - jbj: rpmio: add rpmio{Mount,Umount}Flags.
       - jbj: rpmzstd: enable dictionary modes.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.199.2.87 -r2.199.2.88 librpmio.vers
  --- rpm/rpmio/librpmio.vers   9 Jun 2017 04:39:11 -0000       2.199.2.87
  +++ rpm/rpmio/librpmio.vers   10 Jun 2017 00:22:36 -0000      2.199.2.88
  @@ -564,6 +564,8 @@
       rpmiobStr;
       rpmioAccess;
       rpmioAllPoptTable;
  +    rpmioB2N;
  +    rpmioN2B;
       rpmioClean;
       rpmioConfigured;
       rpmioDigestHashAlgo;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/mount.c
  ============================================================================
  $ cvs diff -u -r2.2.10.1 -r2.2.10.2 mount.c
  --- rpm/rpmio/mount.c 9 Jun 2017 04:39:11 -0000       2.2.10.1
  +++ rpm/rpmio/mount.c 10 Jun 2017 00:22:36 -0000      2.2.10.2
  @@ -6,16 +6,343 @@
   #if defined(__linux__)
   
   #include "system.h"
  +
   #include <sys/mount.h>
  +
   #include "rpmio.h"
  +#include "poptIO.h"
   #include "debug.h"
   
  +unsigned rpmioMountFlags = 0;
  +struct poptOption rpmioMountFlagsTable[] = {
  +
  +#if defined(MS_RDONLY)
  + { "read-only", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MS_RDONLY,
  +     N_("read-only"), N_("MS_RDONLY") },
  +#endif
  +#if defined(MS_RDONLY)
  + { "ro", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MS_RDONLY,
  +     N_("read-only"), N_("MS_RDONLY") },
  +#endif
  +#if defined(MS_RDONLY)
  + { "read-write", '\0', POPT_BIT_CLR, &rpmioMountFlags,       MS_RDONLY,
  +     N_("read-write"), N_("~MS_RDONLY") },
  +#endif
  +#if defined(MS_RDONLY)
  + { "rw", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MS_RDONLY,
  +     N_("read-write"), N_("~MS_RDONLY") },
  +#endif
  +
  +#if defined(MNT_RDONLY)
  + { "read-only", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MNT_RDONLY,
  +     N_("read-only"), N_("MNT_RDONLY") },
  +#endif
  +#if defined(MNT_RDONLY)
  + { "ro", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MNT_RDONLY,
  +     N_("read-only"), N_("MNT_RDONLY") },
  +#endif
  +#if defined(MNT_RDONLY)
  + { "read-write", '\0', POPT_BIT_CLR, &rpmioMountFlags,       MNT_RDONLY,
  +     N_("read-write"), N_("~MNT_RDONLY") },
  +#endif
  +#if defined(MNT_RDONLY)
  + { "rw", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MNT_RDONLY,
  +     N_("read-write"), N_("~MS_RDONLY") },
  +#endif
  +
  +#if defined(MS_NOSUID)
  + { "suid", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MS_NOSUID,
  +     N_("suid"), N_("MS_NOSUID") },
  +#endif
  +#if defined(MNT_NOSUID)
  + { "suid", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MNT_NOSUID,
  +     N_("nosuid"), N_("MNT_NOSUID") },
  +#endif
  +
  +#if defined(MS_NOEXEC)
  + { "exec", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MS_NOEXEC,
  +     N_("exec"), N_("MS_NOEXEC") },
  +#endif
  +#if defined(MNT_NOEXEC)
  + { "exec", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MNT_NOEXEC,
  +     N_("exec"), N_("MNT_NOEXEC") },
  +#endif
  +
  +#if defined(MS_SYNCHRONOUS)
  + { "sync", '\0', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MS_SYNC,
  +     N_("sync"), N_("MS_SYNCHRONOUS") },
  +#endif
  +#if defined(MNT_SYNCHRONOUS)
  + { "sync", '\0', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MNT_SYNC,
  +     N_("sync"), N_("MNT_SYNCHRONOUS") },
  +#endif
  +
  +#if defined(MS_REMOUNT)
  + { "remount", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_REMOUNT,
  +     N_("remount"), N_("MS_REMOUNT") },
  +#endif
  +#if defined(MS_MANDLOCK)
  + { "mand", '\0', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MS_MANDLOCK,
  +     N_("mand"), N_("MS_MANDLOCK") },
  +#endif
  +#if defined(MS_DIRSYNC)
  + { "dirsync", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_DIRSYNC,
  +     N_("dirsync"), N_("MS_DIRSYNC") },
  +#endif
  +
  +#if defined(MS_NOATIME)
  + { "atime", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,  &rpmioMountFlags,       
MS_NOATIME,
  +     N_("atime"), N_("MS_NOATIME") },
  +#endif
  +#if defined(MNT_NOATIME)
  + { "atime", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,  &rpmioMountFlags,       
MNT_NOATIME,
  +     N_("atime"), N_("MNT_NOATIME") },
  +#endif
  +
  +#if defined(MS_NODIRATIME)
  + { "diratime", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,       
&rpmioMountFlags,       MS_NODIRATIME,
  +     N_("diratime"), N_("MS_NODIRATIME") },
  +#endif
  +#if defined(MS_BIND)
  + { "bind", '\0', POPT_BIT_SET,               &rpmioMountFlags,       MS_BIND,
  +     N_("bind"), N_("MS_BIND") },
  +#endif
  +#if defined(MS_MOVE)
  + { "move", '\0', POPT_BIT_SET,               &rpmioMountFlags,       MS_MOVE,
  +     N_("move"), N_("MS_MOVE") },
  +#endif
  +#if defined(MS_REC)
  + { "rec", '\0', POPT_BIT_SET,                &rpmioMountFlags,       MS_REC,
  +     N_("rec"), N_("MS_REC") },
  +#endif
  +#if defined(MS_SILENT)
  + { "silent", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_SILENT,
  +     N_("silent"), N_("MS_SILENT") },
  +#endif
  +
  +#if defined(MS_POSIXACL)
  + { "posixacl", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MS_POSIXACL,
  +     N_("posixacl"), N_("MS_POSIXACL") },
  +#endif
  +#if defined(MNT_ACLS)
  + { "acls", '\0', POPT_BIT_SET,               &rpmioMountFlags,       
MNT_ACLS,
  +     N_("acls"), N_("MNT_ACLS") },
  +#endif
  +#if defined(MNT_NFS4ACLS)
  + { "nfsv4acls", '\0', POPT_BIT_SET,          &rpmioMountFlags,       
MNT_NFS4ACLS,
  +     N_("nfsv4acls"), N_("MNT_NFS4ACLS") },
  +#endif
  +
  +#if defined(MS_UNBINDABLE)
  + { "unbindable", '\0', POPT_BIT_SET, &rpmioMountFlags,       MS_UNBINDABLE,
  +     N_("bindable"), N_("MS_UNBINDABLE") },
  +#endif
  +#if defined(MS_PRIVATE)
  + { "private", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_PRIVATE,
  +     N_("private"), N_("MS_PRIVATE") },
  +#endif
  +#if defined(MS_SLAVE)
  + { "slave", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MS_SLAVE,
  +     N_("slave"), N_("MS_SLAVE") },
  +#endif
  +#if defined(MS_SHARED)
  + { "shared", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_SHARED,
  +     N_("shared"), N_("MS_SHARED") },
  +#endif
  +#if defined(MS_RELATIME)
  + { "relatime", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MS_RELATIME,
  +     N_("relatime"), N_("MS_RELATIME") },
  +#endif
  +#if defined(MS_KERNMOUNT)
  + { "kernmount", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MS_KERNMOUNT,
  +     N_("kernmount"), N_("MS_KERNMOUNT") },
  +#endif
  +#if defined(MS_I_VERSION)
  + { "iversion", '\0', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE,       
&rpmioMountFlags,       MS_I_VERSION,
  +     N_("iversion"), N_("MS_I_VERSION") },
  +#endif
  +#if defined(MS_STRICTATIME)
  + { "strictatime", '\0', POPT_BIT_SET,        &rpmioMountFlags,       
MS_STRICTATIME,
  +     N_("strictatime"), N_("MS_STRICTATIME") },
  +#endif
  +#if defined(MS_LAZYTIME)
  + { "lazytime", '\0', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE,       
&rpmioMountFlags,       MS_LAZYTIME,
  +     N_("lazytime"), N_("MS_LAZYTIME") },
  +#endif
  +#if defined(MS_ACTIVE)
  + { "active", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_ACTIVE,
  +     N_("active"), N_("MS_ACTIVE") },
  +#endif
  +#if defined(MS_NOUSER)
  + { "user", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,   &rpmioMountFlags,       
MS_NOUSER,
  +     N_("user"), N_("MS_NOUSER") },
  +#endif
  +
  +#if defined(MNT_NODEV)
  + { "dev", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,    &rpmioMountFlags,       
MNT_NODEV,
  +     N_("dev"), N_("MNT_NODEV") },
  +#endif
  +#if defined(MNT_UNION)
  + { "union", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_UNION,
  +     N_("union"), N_("MNT_UNION") },
  +#endif
  +#if defined(MNT_ASYNC)
  + { "async", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_ASYNC,
  +     N_("async"), N_("MNT_ASYNC") },
  +#endif
  +#if defined(MNT_CPROTECT)
  + { "cprotect", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_CPROTECT,
  +     N_("cprotect"), N_("MNT_CPROTECT") },
  +#endif
  +#if defined(MNT_EXPORTED)
  + { "exported", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_EXPORTED,
  +     N_("exported"), N_("MNT_EXPORTED") },
  +#endif
  +#if defined(MNT_QUARANTINE)
  + { "quarantine", '\0', POPT_BIT_SET, &rpmioMountFlags,       MNT_QUARANTINE,
  +     N_("quarantine"), N_("MNT_QUARANTINE") },
  +#endif
  +#if defined(MNT_LOCAL)
  + { "local", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_LOCAL,
  +     N_("local"), N_("MNT_LOCAL") },
  +#endif
  +#if defined(MNT_QUOTA)
  + { "quota", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_QUOTA,
  +     N_("quota"), N_("MNT_QUOTA") },
  +#endif
  +#if defined(MNT_ROOTFS)
  + { "rootfs", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_ROOTFS,
  +     N_("rootfs"), N_("MNT_ROOTFS") },
  +#endif
  +#if defined(MNT_DOVOLFS)
  + { "dovolfs", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MNT_DOVOLFS,
  +     N_("dovolfs"), N_("MNT_DOVOLFS") },
  +#endif
  +#if defined(MNT_DONTBROWSE)
  + { "dontbrowse", '\0', POPT_BIT_SET, &rpmioMountFlags,       MNT_DONTBROWSE,
  +     N_("dontbrowse"), N_("MNT_DONTBROWSE") },
  +#endif
  +
  +#if defined(MNT_IGNORE_OWNERSHIP)
  + { "ignore-ownership", '\0', POPT_BIT_SET, &rpmioMountFlags, 
MNT_IGNORE_OWNERSHIP,
  +     N_("ignore-ownership"), N_("MNT_IGNORE_OWNERSHIP") },
  +#endif
  +#if defined(MNT_UNKNOWNPERMOSSIONS)
  + { "unknownpermissions", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, 
&rpmioMountFlags,       MNT_UNKNOWNPERMISSIONS,
  +     N_("unknownpermissions"), N_("MNT_UNKNOWNPERMISSIONS") },
  +#endif
  +
  +#if defined(MNT_AUTOMOUNTED)
  + { "automounted", '\0', POPT_BIT_SET,        &rpmioMountFlags,       
MNT_AUTOMOUNTED,
  +     N_("automounted"), N_("MNT_AUTOMOUNTED") },
  +#endif
  +#if defined(MNT_JOURNALED)
  + { "journaled", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MNT_JOURNALED,
  +     N_("journaled"), N_("MNT_JOURNALED") },
  +#endif
  +#if defined(MNT_NOUSERXATTR)
  + { "userxattr", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,      
&rpmioMountFlags,       MNT_NOUSERXATTR,
  +     N_("userxattr"), N_("MNT_NOUSERXATTR") },
  +#endif
  +#if defined(MNT_DEFWRITE)
  + { "defwrite", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_DEFWRITE,
  +     N_("defwrite"), N_("MNT_DEFWRITE") },
  +#endif
  +#if defined(MNT_MULTILABEL)
  + { "multilabel", '\0', POPT_BIT_SET, &rpmioMountFlags,       MNT_MULTILABEL,
  +     N_("multilabel"), N_("MNT_MULTILABEL") },
  +#endif
  +
  +#if defined(MNT_UPDATE)
  + { "update", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_UPDATE,
  +     N_("update"), N_("MNT_UPDATE") },
  +#endif
  +#if defined(MNT_NOBLOCK)
  + { "block", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,  &rpmioMountFlags,       
MNT_NOBLOCK,
  +     N_("block"), N_("MNT_NOBLOCK") },
  +#endif
  +#if defined(MNT_RELOAD)
  + { "reload", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_RELOAD,
  +     N_("reload"), N_("MNT_RELOAD") },
  +#endif
  +#if defined(MNT_CMDFLAGS)
  + { "cmdflags", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_CMDFLAGS,
  +     N_("cmdflags"), N_("MNT_CMDFLAGS") },
  +#endif
  +
  +#if defined(MNT_NOSYMFOLLOW)
  + { "symfollow", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,      
&rpmioMountFlags,       MNT_NOSYMFOLLOW,
  +     N_("symfollow"), N_("MNT_NOSYMFOLLOW") },
  +#endif
  +#if defined(MNT_NOCLUSTERR)
  + { "clusterr", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,       
&rpmioMountFlags,       MNT_NOCLUSTERR,
  +     N_("clusterr"), N_("MNT_NOCLUSTERR") },
  +#endif
  +#if defined(MNT_NOCLUSTERW)
  + { "clusterw", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE,       
&rpmioMountFlags,       MNT_NOCLUSTERW,
  +     N_("clusterw"), N_("MNT_NOCLUSTERW") },
  +#endif
  +#if defined(MNT_SUIDDIR)
  + { "suiddir", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MNT_SUIDDIR,
  +     N_("suiddir"), N_("MNT_SUIDDIR") },
  +#endif
  +#if defined(MNT_SOFTDEP)
  + { "soft-updates", '\0', POPT_BIT_SET,       &rpmioMountFlags,       
MNT_SOFTDEP,
  +     N_("soft-updates"), N_("MNT_SOFTDEP") },
  +#endif
  +#if defined(MNT_SUJ)
  + { "journaled-soft-updates", '\0', POPT_BIT_SET,     &rpmioMountFlags,       
MNT_SUJ,
  +     N_("journaled-soft-updates"), N_("MNT_SUJ") },
  +#endif
  +#if defined(MNT_MULTILABEL)
  + { "multlabel", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MNT_MULTILABEL,
  +     N_("multlabel"), N_("MNT_MULTILABEL") },
  +#endif
  +#if defined(MNT_GJOURNAL)
  + { "gjournal", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_GJOURNAL,
  +     N_("gjournal"), N_("MNT_GJOURNAL") },
  +#endif
  +#if defined(MNT_GJOURNAL)
  + { "gjournal", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_GJOURNAL,
  +     N_("gjournal"), N_("MNT_GJOURNAL") },
  +#endif
  +#if defined(MNT_VERIFIED)
  + { "verified", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_VERIFIED,
  +     N_("verified"), N_("MNT_VERIFIED") },
  +#endif
  +
  +  POPT_TABLEEND
  +};
  +
  +unsigned rpmioUmountFlags = 0;
  +struct poptOption rpmioUmountFlagsTable[] = {
  +#if defined(MNT_FORCE)
  + { "force", '\0', POPT_BIT_SET,              &rpmioUmountFlags,      
MNT_FORCE,
  +     N_("force"), N_("MNT_FORCE") },
  +#endif
  +#if defined(MNT_DETACH)
  + { "detach", '\0', POPT_BIT_SET,     &rpmioUmountFlags,      MNT_DETACH,
  +     N_("detach"), N_("MNT_DETACH") },
  +#endif
  +#if defined(MNT_EXPIRE)
  + { "expire", '\0', POPT_BIT_SET,     &rpmioUmountFlags,      MNT_EXPIRE,
  +     N_("expire"), N_("MNT_EXPIRE") },
  +#endif
  +#if defined(UMOUNT_NOFOLLOW)
  + { "follow", '\0', POPT_BIT_CLR|POPT_ARGFLAG_TOGGLE, &rpmioUmountFlags,      
UMOUNT_NOFOLLOW,
  +     N_("follow"), N_("UMOUNT_NOFOLLOW") },
  +#endif
  +  POPT_TABLEEND
  +};
  +
   int Mount(const char *source, const char *target,
                const char *filesystemtype, unsigned long mountflags,
                const void *data)
   {
       int rc = mount(source, target, filesystemtype, mountflags, data);
  -fprintf(stderr, "<-- %s(%s,%s,%s,0x%lx,%p) rc %d\n", __FUNCTION__, source, 
target, filesystemtype, mountflags, data, rc);
  +    char * mflags = rpmioB2N(rpmioMountFlagsTable, mountflags);
  +fprintf(stderr, "<-- %s(%s, %s, %s, %s, %p) rc %d\n", __FUNCTION__, source, 
target, filesystemtype, mflags, data, rc);
  +    mflags = _free(mflags);
       return rc;
   }
   
  @@ -29,7 +356,9 @@
   int Umount2(const char *target, int flags)
   {
       int rc = umount2(target, flags);
  -fprintf(stderr, "<-- %s(%s,0x%x) rc %d\n", __FUNCTION__, target, flags, rc);
  +    char * uflags = rpmioB2N(rpmioUmountFlagsTable, flags);
  +fprintf(stderr, "<-- %s(%s, %s) rc %d\n", __FUNCTION__, target, uflags, rc);
  +    uflags = _free(uflags);
       return rc;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/poptIO.c
  ============================================================================
  $ cvs diff -u -r1.94.2.35 -r1.94.2.36 poptIO.c
  --- rpm/rpmio/poptIO.c        9 Jun 2017 04:39:11 -0000       1.94.2.35
  +++ rpm/rpmio/poptIO.c        10 Jun 2017 00:22:36 -0000      1.94.2.36
  @@ -807,276 +807,108 @@
      POPT_TABLEEND
   };
   
  -unsigned int rpmioMountFlags = 0;
  -struct poptOption rpmioMountFlagsTable[] = {
  -
  -#if defined(MS_RDONLY)
  - { "read-only", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MS_RDONLY,
  -     N_("read-only"), N_("MS_RDONLY") },
  -#endif
  -#if defined(MS_RDONLY)
  - { "ro", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MS_RDONLY,
  -     N_("read-only"), N_("MS_RDONLY") },
  -#endif
  -#if defined(MS_RDONLY)
  - { "read-write", '\0', POPT_BIT_CLR, &rpmioMountFlags,       MS_RDONLY,
  -     N_("read-write"), N_("~MS_RDONLY") },
  -#endif
  -#if defined(MS_RDONLY)
  - { "rw", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MS_RDONLY,
  -     N_("read-write"), N_("~MS_RDONLY") },
  -#endif
  -
  -#if defined(MNT_RDONLY)
  - { "read-only", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MNT_RDONLY,
  -     N_("read-only"), N_("MNT_RDONLY") },
  -#endif
  -#if defined(MNT_RDONLY)
  - { "ro", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MNT_RDONLY,
  -     N_("read-only"), N_("MNT_RDONLY") },
  -#endif
  -#if defined(MNT_RDONLY)
  - { "read-write", '\0', POPT_BIT_CLR, &rpmioMountFlags,       MNT_RDONLY,
  -     N_("read-write"), N_("~MNT_RDONLY") },
  -#endif
  -#if defined(MNT_RDONLY)
  - { "rw", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &rpmioMountFlags,       
MNT_RDONLY,
  -     N_("read-write"), N_("~MS_RDONLY") },
  -#endif
  -
  -#if defined(MS_NOSUID)
  - { "nosuid", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_NOSUID,
  -     N_("nosuid"), N_("MS_NOSUID") },
  -#endif
  -#if defined(MNT_NOSUID)
  - { "nosuid", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_NOSUID,
  -     N_("nosuid"), N_("MNT_NOSUID") },
  -#endif
  -
  -#if defined(MS_NOEXEC)
  - { "noexec", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_NOEXEC,
  -     N_("noexec"), N_("MS_NOEXEC") },
  -#endif
  -#if defined(MNT_NOEXEC)
  - { "noexec", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_NOEXEC,
  -     N_("noexec"), N_("MNT_NOEXEC") },
  -#endif
  -
  -#if defined(MS_SYNCHRONOUS)
  - { "sync", '\0', POPT_BIT_SET,               &rpmioMountFlags,       MS_SYNC,
  -     N_("sync"), N_("MS_SYNCHRONOUS") },
  -#endif
  -#if defined(MNT_SYNCHRONOUS)
  - { "sync", '\0', POPT_BIT_SET,               &rpmioMountFlags,       
MNT_SYNC,
  -     N_("sync"), N_("MNT_SYNCHRONOUS") },
  -#endif
  -
  -#if defined(MS_REMOUNT)
  - { "remount", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_REMOUNT,
  -     N_("remount"), N_("MS_REMOUNT") },
  -#endif
  -#if defined(MS_MANDLOCK)
  - { "mandlock", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MS_MANDLOCK,
  -     N_("mandlock"), N_("MS_MANDLOCK") },
  -#endif
  -#if defined(MS_DIRSYNC)
  - { "dirsync", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_DIRSYNC,
  -     N_("dirsync"), N_("MS_DIRSYNC") },
  -#endif
  -
  -#if defined(MS_NOATIME)
  - { "noatime", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_NOATIME,
  -     N_("noatime"), N_("MS_NOATIME") },
  -#endif
  -#if defined(MNT_NOATIME)
  - { "noatime", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MNT_NOATIME,
  -     N_("noatime"), N_("MNT_NOATIME") },
  -#endif
  -
  -#if defined(MS_NODIRATIME)
  - { "nodiratime", '\0', POPT_BIT_SET, &rpmioMountFlags,       MS_NODIRATIME,
  -     N_("nodiratime"), N_("MS_NODIRATIME") },
  -#endif
  -#if defined(MS_BIND)
  - { "bind", '\0', POPT_BIT_SET,               &rpmioMountFlags,       MS_BIND,
  -     N_("bind"), N_("MS_BIND") },
  -#endif
  -#if defined(MS_MOVE)
  - { "move", '\0', POPT_BIT_SET,               &rpmioMountFlags,       MS_MOVE,
  -     N_("move"), N_("MS_MOVE") },
  -#endif
  -#if defined(MS_REC)
  - { "rec", '\0', POPT_BIT_SET,                &rpmioMountFlags,       MS_REC,
  -     N_("rec"), N_("MS_REC") },
  -#endif
  -#if defined(MS_SILENT)
  - { "silent", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_SILENT,
  -     N_("silent"), N_("MS_SILENT") },
  -#endif
  -#if defined(MS_POSIXACL)
  - { "posixacl", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MS_POSIXACL,
  -     N_("posixacl"), N_("MS_POSIXACL") },
  -#endif
  -#if defined(MS_UNBINDABLE)
  - { "unbindable", '\0', POPT_BIT_SET, &rpmioMountFlags,       MS_UNBINDABLE,
  -     N_("bindable"), N_("MS_UNBINDABLE") },
  -#endif
  -#if defined(MS_PRIVATE)
  - { "private", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MS_PRIVATE,
  -     N_("private"), N_("MS_PRIVATE") },
  -#endif
  -#if defined(MS_SLAVE)
  - { "slave", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MS_SLAVE,
  -     N_("slave"), N_("MS_SLAVE") },
  -#endif
  -#if defined(MS_SHARED)
  - { "shared", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_SHARED,
  -     N_("shared"), N_("MS_SHARED") },
  -#endif
  -#if defined(MS_RELATIME)
  - { "relatime", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MS_RELATIME,
  -     N_("relatime"), N_("MS_RELATIME") },
  -#endif
  -#if defined(MS_KERNMOUNT)
  - { "kernmount", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MS_KERNMOUNT,
  -     N_("kernmount"), N_("MS_KERNMOUNT") },
  -#endif
  -#if defined(MS_I_VERSION)
  - { "i-version", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MS_I_VERSION,
  -     N_("i-version"), N_("MS_I_VERSION") },
  -#endif
  -#if defined(MS_STRICTATIME)
  - { "strictatime", '\0', POPT_BIT_SET,        &rpmioMountFlags,       
MS_STRICTATIME,
  -     N_("strictatime"), N_("MS_STRICTATIME") },
  -#endif
  -#if defined(MS_LAZYTIME)
  - { "lazytime", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MS_LAZYTIME,
  -     N_("lazytime"), N_("MS_LAZYTIME") },
  -#endif
  -#if defined(MS_ACTIVE)
  - { "active", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_ACTIVE,
  -     N_("active"), N_("MS_ACTIVE") },
  -#endif
  -#if defined(MS_NOUSER)
  - { "nouser", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MS_NOUSER,
  -     N_("nouser"), N_("MS_NOUSER") },
  -#endif
  -
  -#if defined(MNT_NODEV)
  - { "nodev", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_NODEV,
  -     N_("nodev"), N_("MNT_NODEV") },
  -#endif
  -#if defined(MNT_UNION)
  - { "union", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_UNION,
  -     N_("union"), N_("MNT_UNION") },
  -#endif
  -#if defined(MNT_ASYNC)
  - { "async", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_ASYNC,
  -     N_("async"), N_("MNT_ASYNC") },
  -#endif
  -#if defined(MNT_CPROTECT)
  - { "cprotect", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_CPROTECT,
  -     N_("cprotect"), N_("MNT_CPROTECT") },
  -#endif
  -#if defined(MNT_EXPORTED)
  - { "exported", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_EXPORTED,
  -     N_("exported"), N_("MNT_EXPORTED") },
  -#endif
  -#if defined(MNT_QUARANTINE)
  - { "quarantine", '\0', POPT_BIT_SET, &rpmioMountFlags,       MNT_QUARANTINE,
  -     N_("quarantine"), N_("MNT_QUARANTINE") },
  -#endif
  -#if defined(MNT_LOCAL)
  - { "local", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_LOCAL,
  -     N_("local"), N_("MNT_LOCAL") },
  -#endif
  -#if defined(MNT_QUOTA)
  - { "quota", '\0', POPT_BIT_SET,              &rpmioMountFlags,       
MNT_QUOTA,
  -     N_("quota"), N_("MNT_QUOTA") },
  -#endif
  -#if defined(MNT_ROOTFS)
  - { "rootfs", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_ROOTFS,
  -     N_("rootfs"), N_("MNT_ROOTFS") },
  -#endif
  -#if defined(MNT_DOVOLFS)
  - { "dovolfs", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MNT_DOVOLFS,
  -     N_("dovolfs"), N_("MNT_DOVOLFS") },
  -#endif
  -#if defined(MNT_DONTBROWSE)
  - { "dontbrowse", '\0', POPT_BIT_SET, &rpmioMountFlags,       MNT_DONTBROWSE,
  -     N_("dontbrowse"), N_("MNT_DONTBROWSE") },
  -#endif
  +char * rpmioB2N(struct poptOption * optTable, unsigned long optFlags)
  +{
  +    char t[BUFSIZ];
  +    char * te = t;
  +    struct poptOption * opt;
  +
  +#define      POPT_MASK   
(POPT_ARGFLAG_LOGICALOPS|POPT_ARGFLAG_NOT|POPT_ARG_MASK)
  +    for (opt=optTable; opt->longName || opt->shortName || opt->arg; opt++) {
  +     int argInfo = opt->argInfo;
  +
  +     switch (argInfo & POPT_MASK) {
  +     case POPT_BIT_SET:
  +     case POPT_BIT_CLR:
  +         if (!(optFlags & opt->val)) /* XXX limited to 32 bits */
  +             continue;
  +         break;
  +     default:
  +         continue;
  +         break;
  +     }
  +     if (te > t)
  +         *te++ = '|';
  +     if (opt->argDescrip)
  +         te = stpcpy(te, opt->argDescrip);
  +     else
  +         te += sprintf(te, "0x%x", opt->val);
  +     optFlags &= ~opt->val;          /* XXX first found only. */
  +    }
  +#undef       POPT_MASK
  +    if (te == t)
  +     te = stpcpy(te, "0");
  +    *te = '\0';
  +    return xstrdup(t);
  +}
   
  -#if defined(MNT_IGNORE_OWNERSHIP)
  - { "ignore-ownership", '\0', POPT_BIT_SET, &rpmioMountFlags, 
MNT_IGNORE_OWNERSHIP,
  -     N_("ignore-ownership"), N_("MNT_IGNORE_OWNERSHIP") },
  -#endif
  -#if defined(MNT_UNKNOWNPERMOSSIONS)
  - { "unknownpermissions", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, 
&rpmioMountFlags,       MNT_UNKNOWNPERMISSIONS,
  -     N_("unknownpermissions"), N_("MNT_UNKNOWNPERMISSIONS") },
  -#endif
  +unsigned long rpmioN2B(struct poptOption * optTable, const char * options)
  +{
  +    ARGV_t av = NULL;
  +    int xx = argvSplit(&av, options, ",");
  +    int ac = argvCount(av);
  +    struct poptOption * opt;
  +    unsigned long optFlags = 0;
  +    (void)xx;
  +
  +    for (int i = 0; i < ac; i++) {
  +     const char * o = av[i];
  +     int negate = 0;
  +
  +     /* Handle !foo and nofoo negated options. */
  +     if (*o == '!') {
  +         negate ^= 1;
  +         o++;
  +     }
  +     if (strchr("Nn", o[0]) && strchr("Oo", o[1])) {
  +         negate ^= 1;
  +         o += 2;
  +     }
  +     if (!(o && *o))
  +         continue;
   
  -#if defined(MNT_AUTOMOUNTED)
  - { "automounted", '\0', POPT_BIT_SET,        &rpmioMountFlags,       
MNT_AUTOMOUNTED,
  -     N_("automounted"), N_("MNT_AUTOMOUNTED") },
  -#endif
  -#if defined(MNT_JOURNALED)
  - { "journaled", '\0', POPT_BIT_SET,  &rpmioMountFlags,       MNT_JOURNALED,
  -     N_("journaled"), N_("MNT_JOURNALED") },
  -#endif
  -#if defined(MNT_NOUSERXATTR)
  - { "nouserxattr", '\0', POPT_BIT_SET,        &rpmioMountFlags,       
MNT_NOUSERXATTR,
  -     N_("nouserxattr"), N_("MNT_NOUSERXATTR") },
  -#endif
  -#if defined(MNT_DEFWRITE)
  - { "defwrite", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_DEFWRITE,
  -     N_("defwrite"), N_("MNT_DEFWRITE") },
  -#endif
  -#if defined(MNT_MULTILABEL)
  - { "multilabel", '\0', POPT_BIT_SET, &rpmioMountFlags,       MNT_MULTILABEL,
  -     N_("multilabel"), N_("MNT_MULTILABEL") },
  -#endif
  +     for (opt=optTable; opt->longName || opt->shortName || opt->arg; opt++) {
   
  -#if defined(MNT_UPDATE)
  - { "update", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_UPDATE,
  -     N_("update"), N_("MNT_UPDATE") },
  -#endif
  -#if defined(MNT_NOBLOCK)
  - { "noblock", '\0', POPT_BIT_SET,    &rpmioMountFlags,       MNT_NOBLOCK,
  -     N_("noblock"), N_("MNT_NOBLOCK") },
  -#endif
  -#if defined(MNT_RELOAD)
  - { "reload", '\0', POPT_BIT_SET,     &rpmioMountFlags,       MNT_RELOAD,
  -     N_("reload"), N_("MNT_RELOAD") },
  -#endif
  -#if defined(MNT_CMDFLAGS)
  - { "cmdflags", '\0', POPT_BIT_SET,   &rpmioMountFlags,       MNT_CMDFLAGS,
  -     N_("cmdflags"), N_("MNT_CMDFLAGS") },
  -#endif
  +         if (opt->longName == NULL)
  +             continue;
   
  -  POPT_TABLEEND
  -};
  +         int argInfo = opt->argInfo;
  +         if (argInfo & POPT_ARGFLAG_TOGGLE) {
  +             /* Is this the right bit (stripping optional prefix)? */
  +             if (strcasecmp(o, opt->longName))
  +                 continue;
  +
  +             /* Toggle the value (if requested). */
  +             if (negate) {
  +                 argInfo &= ~POPT_ARGFLAG_TOGGLE;
  +                 if (argInfo == POPT_BIT_SET)
  +                     argInfo = POPT_BIT_CLR;
  +                 else if (argInfo == POPT_BIT_CLR)
  +                     argInfo = POPT_BIT_SET;
  +                 argInfo |= POPT_ARGFLAG_TOGGLE;
  +             }
  +         } else {
  +             /* Is this the right bit (using full option name)? */
  +             if (strcasecmp(av[i], opt->longName))
  +                 continue;
  +         }
   
  -unsigned int rpmioUmountFlags = 0;
  -struct poptOption rpmioUmountFlagsTable[] = {
  -#if defined(MNT_FORCE)
  - { "force", '\0', POPT_BIT_SET,              &rpmioUmountFlags,      
MNT_FORCE,
  -     N_("force"), N_("MNT_FORCE") },
  -#endif
  -#if defined(MNT_DETACH)
  - { "detach", '\0', POPT_BIT_SET,     &rpmioUmountFlags,      MNT_DETACH,
  -     N_("detach"), N_("MNT_DETACH") },
  -#endif
  -#if defined(MNT_EXPIRE)
  - { "expire", '\0', POPT_BIT_SET,     &rpmioUmountFlags,      MNT_EXPIRE,
  -     N_("expire"), N_("MNT_EXPIRE") },
  -#endif
  -#if defined(UMOUNT_NOFOLLOW)
  - { "nofollow", '\0', POPT_BIT_SET,   &rpmioUmountFlags,      UMOUNT_NOFOLLOW,
  -     N_("nofollow"), N_("UMOUNT_NOFOLLOW") },
  -#endif
  -  POPT_TABLEEND
  -};
  +         switch (argInfo & POPT_ARG_MASK) {
  +         case POPT_ARG_VAL:
  +             (void) poptSaveInt((int *)&optFlags, argInfo, (long)opt->val);
  +             break;
  +         default:
  +             break;
  +         }
  +         o = NULL;           /* XXX option processed. */
  +         break;
  +     }
  +     if (o)
  +         fprintf(stderr, "*** unknown option \"%s\" was ignored\n", o);
  +    }
  +    av = argvFree(av);
  +    return optFlags;
  +}
   
   unsigned rpmioFtsFlags = 0;
   struct poptOption rpmioFtsFlagsTable[] = {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/poptIO.h
  ============================================================================
  $ cvs diff -u -r1.8.4.7 -r1.8.4.8 poptIO.h
  --- rpm/rpmio/poptIO.h        9 Jun 2017 04:39:11 -0000       1.8.4.7
  +++ rpm/rpmio/poptIO.h        10 Jun 2017 00:22:36 -0000      1.8.4.8
  @@ -54,6 +54,22 @@
   extern unsigned int rpmioUmountFlags;
   extern struct poptOption             rpmioUmountFlagsTable[];
   
  +/** \ingroup rpmio
  + * Return names from bits using a popt table (limited to 32 bits by popt).
  + * @param optTable           popt table
  + * @param optFlags           bits
  + * @return                   (malloc'd) name string
  + */
  +char * rpmioB2N(struct poptOption * optTable, unsigned long optFlags);
  +
  +/** \ingroup rpmio
  + * Return bits from names using a popt table (limited to 32 bits by popt).
  + * @param optTable           popt table
  + * @param options            names
  + * @return                   bits
  + */
  +unsigned long rpmioN2B(struct poptOption * optTable, const char * options);
  +
   extern const char * rpmioPipeOutput;
   
   extern const char * rpmioRootDir;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio_internal.h
  ============================================================================
  $ cvs diff -u -r2.127.2.15 -r2.127.2.16 rpmio_internal.h
  --- rpm/rpmio/rpmio_internal.h        3 Jun 2017 09:02:26 -0000       
2.127.2.15
  +++ rpm/rpmio/rpmio_internal.h        10 Jun 2017 00:22:36 -0000      
2.127.2.16
  @@ -205,7 +205,7 @@
       return fd->flags;
   }
   static inline
  -int fdSetFlags(FD_t fd, int flags)
  +int fdSetFlags(FD_t fd, fdFlags flags)
   {
       FDSANE(fd);
       int old_flags = fd->flags;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tmount.c
  ============================================================================
  $ cvs diff -u -r1.1.2.1 -r1.1.2.2 tmount.c
  --- rpm/rpmio/tmount.c        9 Jun 2017 04:39:11 -0000       1.1.2.1
  +++ rpm/rpmio/tmount.c        10 Jun 2017 00:22:36 -0000      1.1.2.2
  @@ -9,6 +9,7 @@
   #include "system.h"
   
   #include <sys/mount.h>
  +#include <mntent.h>
   
   #include "rpmio.h"
   #include <rpmlog.h>
  @@ -18,6 +19,158 @@
   
   #include "debug.h"
   
  +typedef      struct rpmmu_s * rpmmu;
  +struct rpmmu_s {
  +    ARGV_t av;
  +    int ac;
  +    unsigned flags;
  +
  +    const char ** options;
  +
  +    const char * source;
  +    const char * target;
  +    const char * fstype;
  +    unsigned long mflags;
  +    const void * data;
  +
  +    int uflags;
  +};
  +
  +/*==============================================================*/
  +#ifdef       DYING
  +const char * rpmioB2N(struct poptOption * optTable, unsigned optFlags)
  +{
  +    char t[BUFSIZ];
  +    char * te = t;
  +    struct poptOption * opt;
  +
  +#define      POPT_MASK   
(POPT_ARGFLAG_LOGICALOPS|POPT_ARGFLAG_NOT|POPT_ARG_MASK)
  +    for (opt=optTable; opt->longName || opt->shortName || opt->arg; opt++) {
  +     int argInfo = opt->argInfo;
  +
  +     switch (argInfo & POPT_MASK) {
  +     case POPT_BIT_SET:
  +     case POPT_BIT_CLR:
  +         if (!(optFlags & opt->val))
  +             continue;
  +         break;
  +     default:
  +         continue;
  +         break;
  +     }
  +     if (te > t)
  +         *te++ = '|';
  +     if (opt->argDescrip)
  +         te = stpcpy(te, opt->argDescrip);
  +     else
  +         te += sprintf(te, "0x%x", opt->val);
  +     optFlags &= ~opt->val;          /* XXX first found only. */
  +    }
  +#undef       POPT_MASK
  +    if (te == t)
  +     te = stpcpy(te, "0x0");
  +    *te = '\0';
  +    return xstrdup(t);
  +}
  +
  +unsigned rpmioN2B(struct poptOption * optTable, const char * options)
  +{
  +    ARGV_t av = NULL;
  +    int xx = argvSplit(&av, options, ",");
  +    int ac = argvCount(av);
  +    struct poptOption * opt;
  +    unsigned optFlags = 0;
  +    (void)xx;
  +
  +    for (int i = 0; i < ac; i++) {
  +     const char * o = av[i];
  +     int negate = 0;
  +
  +     /* Handle negated options. */
  +     if (*o == '!') {
  +         negate ^= 1;
  +         o++;
  +     }
  +     if (strchr("Nn", o[0]) && strchr("Oo", o[1])) {
  +         negate ^= 1;
  +         o += 2;
  +     }
  +     if (!(o && *o))
  +         continue;
  +
  +     for (opt=optTable; opt->longName || opt->shortName || opt->arg; opt++) {
  +
  +         if (opt->longName == NULL || strcasecmp(o, opt->longName))
  +             continue;
  +
  +         int argInfo = opt->argInfo;
  +         if (negate && (argInfo & POPT_ARGFLAG_TOGGLE)) {
  +             argInfo &= ~POPT_ARGFLAG_TOGGLE;
  +             if (argInfo == POPT_BIT_SET)
  +                 argInfo = POPT_BIT_CLR;
  +             else if (argInfo == POPT_BIT_CLR)
  +                 argInfo = POPT_BIT_SET;
  +             argInfo |= POPT_ARGFLAG_TOGGLE;
  +         }
  +         switch (argInfo & POPT_ARG_MASK) {
  +         case POPT_ARG_VAL:
  +             (void) poptSaveInt((int *)&optFlags, argInfo, (long)opt->val);
  +             break;
  +         default:
  +             break;
  +         }
  +         o = NULL;           /* XXX option processed. */
  +         break;
  +     }
  +     if (o)
  +         fprintf(stderr, "*** unknown option \"%s\" was ignored\n", o);
  +    }
  +    av = argvFree(av);
  +    return optFlags;
  +}
  +#endif       /* DYING */
  +
  +/*==============================================================*/
  +static int rpmmuList(const char *fn, FILE *ofp)
  +{
  +    FILE * ifp = NULL;
  +    struct mntent *mnt;
  +    int rc = -2;
  +    int ix = 0;
  +
  +    if (ofp == NULL)
  +     ofp = stderr;
  +
  +    ifp = setmntent(fn, "r");
  +    if (ifp == NULL)
  +     goto exit;
  +
  +#ifdef       NOTYET
  +    struct mntent mntbuf;
  +    char b[BUFSIZ];
  +    size_t nb = sizeof(nb);
  +    while ((mnt = getmntent_r(ifp, &mntbuf, b, nb)) != NULL)
  +#else
  +    while ((mnt = getmntent(ifp)) != NULL)
  +#endif
  +    {
  +     fprintf(ofp, "========= %s #%d\n", fn, ix++);
  +     fprintf(ofp, "%8s: %s\n", "fsname", mnt->mnt_fsname);
  +     fprintf(ofp, "%8s: %s\n", "dir", mnt->mnt_dir);
  +     fprintf(ofp, "%8s: %s\n", "type", mnt->mnt_type);
  +     fprintf(ofp, "%8s: %s\n", "opts", mnt->mnt_opts);
  +     fprintf(ofp, "%8s: %d\n", "freq", mnt->mnt_freq);
  +     fprintf(ofp, "%8s: %d\n", "passno", mnt->mnt_passno);
  +    }
  +
  +    rc = 0;
  +
  +exit:
  +    if (ifp)
  +     (void) endmntent(ifp);
  +    return rc;
  +}
  +
   /*==============================================================*/
   
   #if !defined(POPT_BIT_XOR)
  @@ -242,39 +395,49 @@
   int
   main(int argc, char *argv[])
   {
  -    const char * _mount_source  = xstrdup("sysfs.img");
  -    const char * _mount_target = xstrdup("/mnt/initrd");
  -    const char * _mount_type = xstrdup("sysfs");
  -    const char * _mount_options = NULL;
  -
  -    unsigned long _mount_flags = 0;
  -    const void * _mount_data = NULL;
  -    int _umount_flags = MNT_FORCE;
  +    struct rpmmu_s _mu = {
  +     .av = NULL,
  +     .ac = 0,
  +     .flags = 0,
  +
  +     .options = NULL,
  +
  +     .source = xstrdup("sysfs.img"),         /* XXX */
  +     .target = xstrdup("/mnt/initrd"),       /* XXX */
  +     .fstype = xstrdup("sysfs"),             /* XXX */
  +     .mflags = 0,
  +     .data = NULL,
  +
  +     .uflags = 0,
  +    };
  +    struct rpmmu_s *mu = &_mu;
   
       struct poptOption rpmmountOptionsTable[] = {
        { "debug", 'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, 1,
        NULL, NULL },
   
  -     { "source", '\0', POPT_ARG_STRING,      &_mount_source, 0,
  +     { "source", '\0', POPT_ARG_STRING,      &mu->source,    0,
        N_("file system SOURCE"), N_("SOURCE") },
  -     { "target", '\0', POPT_ARG_STRING,      &_mount_target, 0,
  +     { "target", '\0', POPT_ARG_STRING,      &mu->target,    0,
        N_("file system TARGET"), N_("TARGET") },
  -     { "type", 't', POPT_ARG_STRING, &_mount_type,   0,
  +     { "type", 't', POPT_ARG_STRING, &mu->fstype,    0,
        N_("file system TYPE"), N_("TYPE") },
  -     { "options", 'o', POPT_ARG_STRING,      &_mount_type,   0,
  +     { "options", 'o', POPT_ARG_ARGV,        &mu->options,   0,
        N_("file system OPTIONS"), N_("OPTIONS") },
   
  -     { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioOpenFlagsTable, 0,
  -     N_("Open(2) flags:"), NULL },
  -
        { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioMountFlagsTable, 0,
        N_("Mount(2) flags:"), NULL },
   
        { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioUmountFlagsTable, 0,
        N_("Umount(2) flags:"), NULL },
   
  +#ifdef       DYING
  +     { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioOpenFlagsTable, 0,
  +     N_("Open(2) flags:"), NULL },
  +
        { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioFtsFlagsTable, 0,
        N_("Fts(3) traversal flags:"), NULL },
  +#endif
   
        { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0,
        N_("Common options for all rpmio executables:"), NULL },
  @@ -285,32 +448,55 @@
       };
   
       poptContext con = rpmioInit(argc, argv, rpmmountOptionsTable);
  -#ifdef       NOTYET
  -    ARGV_t av = poptGetArgs(con);
  -    int ac = argvCount(av);
  -#endif       /* NOTYET */
       int ec = 0;
       int rc;
   
  -    _mount_flags = rpmioMountFlags;
  +    mu->av = (ARGV_t) poptGetArgs(con);
  +    mu->ac = argvCount(mu->av);
  +
  +    mu->mflags = rpmioMountFlags;
  +fprintf(stderr, "*** flags: 0x%lx\n", mu->mflags);
   
  +    if (mu->options) {
  +     char * optStr = argvJoin(mu->options, ',');
  +     unsigned _optFlags = rpmioN2B(rpmioMountFlagsTable, optStr);
  +fprintf(stderr, "*** option flags: 0x%x\n", _optFlags);
  +     mu->mflags |= _optFlags;
  +     optStr = _free(optStr);
  +    }
  +
  +char * mflags = rpmioB2N(rpmioMountFlagsTable, mu->mflags);
  +fprintf(stderr, "--> %s(%s, %s, %s, %s, %p)\n", "Mount", mu->source, 
mu->target, mu->fstype, mflags, mu->data);
  +mflags = _free(mflags);
   #if defined(__linux__)
  -    _mount_flags |= MS_MGC_VAL;
  +    mu->mflags |= MS_MGC_VAL;
   #endif
   #if defined(__APPLE__) || defined(MNT_VISFLAGMASK)
  -    _mount_flags &= MNT_VISFLAGMASK;
  +    mu->mflags &= MNT_VISFLAGMASK;
   #endif
   
  -    _umount_flags = rpmioUmountFlags;
  +    rc = Mount(mu->source, mu->target, mu->fstype, mu->mflags, mu->data);
   
  -    rc = Mount(_mount_source, _mount_target, _mount_type, _mount_flags, 
_mount_data);
  +#ifdef       NOISY
  +    rc = rpmmuList("/etc/mtab", NULL);
  +#endif
   
  -    rc = Umount2(_mount_target, _umount_flags);
  +    mu->uflags = rpmioUmountFlags;
   
  -    _mount_source = _free(_mount_source);
  -    _mount_target = _free(_mount_target);
  -    _mount_type = _free(_mount_type);
  -    _mount_options = _free(_mount_options);
  +char * uflags = rpmioB2N(rpmioUmountFlagsTable, mu->uflags);
  +fprintf(stderr, "--> %s(%s, %s)\n", "Umount2", mu->target, uflags);
  +uflags = _free(uflags);
  +
  +    rc = Umount2(mu->target, mu->uflags);
  +
  +    mu->source = _free(mu->source);
  +    mu->target = _free(mu->target);
  +    mu->fstype = _free(mu->fstype);
  +    mu->options = argvFree(mu->options);
  +
  +    mu->av = argvFree(mu->av);
  +    mu->ac = 0;
  +    mu->flags = 0;
   
       con = rpmioFini(con);
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tzstd.c
  ============================================================================
  $ cvs diff -u -r1.1.2.6 -r1.1.2.7 tzstd.c
  --- rpm/rpmio/tzstd.c 9 Jun 2017 04:39:11 -0000       1.1.2.6
  +++ rpm/rpmio/tzstd.c 10 Jun 2017 00:22:36 -0000      1.1.2.7
  @@ -199,10 +199,16 @@
       const char * ofn = rpmGetPath(av[0], ".zst", NULL);
   
       _rpmzstdOFlags = rpmioOpenFlags;
  +char * ostr = NULL;
  +#define      OFLAGS(_bits)   rpmioB2N(rpmioOpenFlagsTable, _bits)
   rpmzstd zstd = NULL;
  -SPEW("*** O_TMPFILE: %#o\n", O_TMPFILE);
  -SPEW("***     OMask: %#o\n", _rpmioOMask);
  -SPEW("***    OFlags: %#o\n", _rpmzstdOFlags);
  +SPEW("*** O_TMPFILE: %#o: %s\n", O_TMPFILE, (ostr=OFLAGS(O_TMPFILE)));
  +ostr = _free(ostr);
  +SPEW("***     OMask: %#o: %s\n", _rpmioOMask, (ostr=OFLAGS(_rpmioOMask)));
  +ostr = _free(ostr);
  +SPEW("***    OFlags: %#o: %s\n", _rpmzstdOFlags, 
(ostr=OFLAGS(_rpmzstdOFlags)));
  +ostr = _free(ostr);
  +#undef       OFLAGS
   
       switch (climode) {
       case 1:  ec = compressFile(ifn, "w3?.zstdio");   break;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to