Print this page
3015 lofiadm should use libz.so.1, not libz.so

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/lofiadm/main.c
          +++ new/usr/src/cmd/lofiadm/main.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   * Copyright 2012 Joyent, Inc.  All rights reserved.
  25   25   *
  26   26   * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
       27 + * Copyright (c) 2014 Gary Mills
  27   28   */
  28   29  
  29   30  /*
  30   31   * lofiadm - administer lofi(7d). Very simple, add and remove file<->device
  31   32   * associations, and display status. All the ioctls are private between
  32   33   * lofi and lofiadm, and so are very simple - device information is
  33   34   * communicated via a minor number.
  34   35   */
  35   36  
  36   37  #include <sys/types.h>
↓ open down ↓ 106 lines elided ↑ open up ↑
 143  144  /* For displaying lofi mappings */
 144  145  #define FORMAT                  "%-20s     %-30s        %s\n"
 145  146  
 146  147  #define COMPRESS_ALGORITHM      "gzip"
 147  148  #define COMPRESS_THRESHOLD      2048
 148  149  #define SEGSIZE                 131072
 149  150  #define BLOCK_SIZE              512
 150  151  #define KILOBYTE                1024
 151  152  #define MEGABYTE                (KILOBYTE * KILOBYTE)
 152  153  #define GIGABYTE                (KILOBYTE * MEGABYTE)
 153      -#define LIBZ                    "libz.so"
      154 +#define LIBZ                    "libz.so.1"
 154  155  
 155  156  static void
 156  157  usage(const char *pname)
 157  158  {
 158  159          (void) fprintf(stderr, gettext(USAGE), pname, pname, pname,
 159  160              pname, pname, pname, pname, pname, pname, pname);
 160  161          exit(E_USAGE);
 161  162  }
 162  163  
 163  164  static int
 164  165  gzip_compress(void *src, size_t srclen, void *dst, size_t *dstlen, int level)
 165  166  {
 166  167          static int (*compress2p)(void *, ulong_t *, void *, size_t, int) = NULL;
 167  168          void *libz_hdl = NULL;
 168  169  
 169  170          /*
 170  171           * The first time we are called, attempt to dlopen()
 171      -         * libz.so and get a pointer to the compress2() function
      172 +         * libz.so.1 and get a pointer to the compress2() function
 172  173           */
 173  174          if (compress2p == NULL) {
 174  175                  if ((libz_hdl = openlib(LIBZ)) == NULL)
 175  176                          die(gettext("could not find %s. "
 176  177                              "gzip compression unavailable\n"), LIBZ);
 177  178  
 178  179                  if ((compress2p =
 179  180                      (int (*)(void *, ulong_t *, void *, size_t, int))
 180  181                      dlsym(libz_hdl, "compress2")) == NULL) {
 181  182                          closelib();
↓ open down ↓ 1875 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX