Blame source/uds/indexVersion.c

Packit Service 310c69
/*
Packit Service 310c69
 * Copyright (c) 2020 Red Hat, Inc.
Packit Service 310c69
 *
Packit Service 310c69
 * This program is free software; you can redistribute it and/or
Packit Service 310c69
 * modify it under the terms of the GNU General Public License
Packit Service 310c69
 * as published by the Free Software Foundation; either version 2
Packit Service 310c69
 * of the License, or (at your option) any later version.
Packit Service 310c69
 * 
Packit Service 310c69
 * This program is distributed in the hope that it will be useful,
Packit Service 310c69
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 310c69
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 310c69
 * GNU General Public License for more details.
Packit Service 310c69
 * 
Packit Service 310c69
 * You should have received a copy of the GNU General Public License
Packit Service 310c69
 * along with this program; if not, write to the Free Software
Packit Service 310c69
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit Service 310c69
 * 02110-1301, USA. 
Packit Service 310c69
 *
Packit Service 310c69
 * $Id: //eng/uds-releases/jasper/src/uds/indexVersion.c#1 $
Packit Service 310c69
 */
Packit Service 310c69
Packit Service 310c69
#include "indexVersion.h"
Packit Service 310c69
Packit Service 310c69
void initializeIndexVersion(struct index_version *version,
Packit Service 310c69
                            uint32_t              superVersion)
Packit Service 310c69
{
Packit Service 310c69
  /*
Packit Service 310c69
   * Version 1 was introduced for the first single file layout. It was used in
Packit Service 310c69
   * RHEL7 and in RHEL8.0 Beta.  No kernel index ever used an earlier version.
Packit Service 310c69
   */
Packit Service 310c69
   
Packit Service 310c69
  /*
Packit Service 310c69
   * Version 2 was created when we discovered that the volume header page was
Packit Service 310c69
   * written in native endian format.  It was used in RHEL8.0 and RHEL8.1.  We
Packit Service 310c69
   * stopped reading and the volume header page, and changed to version 2 so 
Packit Service 310c69
   * that an index creaed on RHEL8 cannot be taken back an used on RHEL7.
Packit Service 310c69
   *
Packit Service 310c69
   * Versions 1 and 2 are identical in normal operation (i.e. after the index
Packit Service 310c69
   * is loaded).
Packit Service 310c69
   */
Packit Service 310c69
  
Packit Service 310c69
  /*
Packit Service 310c69
   * Version 3 was created when we discovered the the chapter index headers
Packit Service 310c69
   * were written in native endian format.  It was first used in RHEL8.2 and is
Packit Service 310c69
   * the current version for new indices.
Packit Service 310c69
   *
Packit Service 310c69
   * Versions before 3 read and write native endian chapter headers.  Version 3
Packit Service 310c69
   * reads chapter headers in any endian order, and writes little-endian
Packit Service 310c69
   * chapter headers.
Packit Service 310c69
   */
Packit Service 310c69
  bool chapterIndexHeaderNativeEndian = superVersion < 3;
Packit Service 310c69
Packit Service 310c69
  *version = (struct index_version) {
Packit Service 310c69
    .chapterIndexHeaderNativeEndian = chapterIndexHeaderNativeEndian,
Packit Service 310c69
  };
Packit Service 310c69
}