Clarified which inode is local ino_t and which is Rock Ridge uint32_t.

This commit is contained in:
Thomas Schmitt 2014-05-27 21:31:53 +02:00
parent 1df1642a61
commit c17ba1980a
6 changed files with 26 additions and 19 deletions

View File

@ -1122,6 +1122,11 @@ int family_set_ino(Ecma119Image *img, Ecma119Node **nodes, size_t family_start,
*/
if (img_ino == prev_ino)
img_ino = 0;
/* Accept only if it is within the 32 bit range. */
if (((uint64_t) img_ino) > 0xffffffff)
img_ino = 0;
}
if (img_ino == 0) {
img_ino = img_give_ino_number(img->image, 0);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* 2012 Thomas Schmitt
* 2012 - 2014 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
@ -64,9 +64,7 @@ struct ecma119_node
IsoNode *node; /*< reference to the iso node */
/* >>> ts A90501 : Shouldn't this be uint32_t
as this is what PX will take ? */
ino_t ino;
uint32_t ino;
nlink_t nlink;

View File

@ -955,7 +955,8 @@ int catalog_is_repeatable(IsoStream *stream)
/**
* fs_id will be the id reserved for El-Torito
* dev_id will be 0 for catalog, 1 for boot image (if needed)
* we leave ino_id for future use when we support multiple boot images
* ino_id 0 is supposed to be unique. At write time it will get assigned
* an automatic file serial number in the ISO, if needed.
*/
static
void catalog_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,

View File

@ -320,8 +320,8 @@ typedef struct
/* Whether inode numbers from PX entries shall be discarded */
unsigned int make_new_ino : 1 ;
/* Inode number generator counter */
ino_t inode_counter;
/* Inode number generator counter. 32 bit because for Rock Ridge PX. */
uint32_t inode_counter;
/* PX inode number status
bit0= there were nodes with PX inode numbers

View File

@ -674,7 +674,8 @@ ex:;
/**
* A global counter for inode numbers for the ISO image filesystem.
* A global counter for Rock Ridge inode numbers in the ISO image filesystem.
*
* On image import it gets maxed by the eventual inode numbers from PX
* entries. Up to the first 32 bit rollover it simply increments the counter.
* After the first rollover it uses a look ahead bitmap which gets filled
@ -684,13 +685,13 @@ ex:;
* @param image The image where the number shall be used
* @param flag bit0= reset count (Caution: image must get new inos then)
* @return
* Since ino_t 0 is used as default and considered self-unique,
* Since 0 is used as default and considered self-unique,
* the value 0 should only be returned in case of error.
*/
ino_t img_give_ino_number(IsoImage *image, int flag)
uint32_t img_give_ino_number(IsoImage *image, int flag)
{
int ret;
ino_t new_ino, ino_idx;
uint64_t new_ino, ino_idx;
static uint64_t limit = 0xffffffff;
if (flag & 1) {
@ -700,10 +701,10 @@ ino_t img_give_ino_number(IsoImage *image, int flag)
image->used_inodes = NULL;
image->used_inodes_start = 0;
}
new_ino = image->inode_counter + 1;
new_ino = ((uint64_t) image->inode_counter) + 1;
if (image->used_inodes == NULL) {
if (new_ino > 0 && new_ino <= limit) {
image->inode_counter = new_ino;
image->inode_counter = (uint32_t) new_ino;
return image->inode_counter;
}
}

View File

@ -171,18 +171,20 @@ struct Iso_Image
* Inode number management. inode_counter is taken over from
* IsoImageFilesystem._ImageFsData after image import.
* It is to be used with img_give_ino_number()
*/
ino_t inode_counter;
* This is a Rock Ridge file serial number. Thus 32 bit.
*/
uint32_t inode_counter;
/*
* A bitmap of used inode numbers in an interval beginning at
* used_inodes_start and holding ISO_USED_INODE_RANGE bits.
* If a bit is set, then the corresponding inode number is occupied.
* This interval is kept around inode_counter and eventually gets
* advanced by ISO_USED_INODE_RANGE numbers in a tree traversal
* done by img_collect_inos().
* done by img_collect_inos(). The value will stay in the 32 bit range,
* although used_inodes_start is 64 bit to better handle rollovers.
*/
uint8_t *used_inodes;
ino_t used_inodes_start;
uint64_t used_inodes_start;
/**
* Array of MD5 checksums as announced by xattr "isofs.ca" of the
@ -236,10 +238,10 @@ int img_collect_inos(IsoImage *image, IsoDir *dir, int flag);
* @param image The image where the number shall be used
* @param flag bit0= reset count (Caution: image must get new inos then)
* @return
* Since ino_t 0 is used as default and considered self-unique,
* Since 0 is used as default and considered self-unique,
* the value 0 should only be returned in case of error.
*/
ino_t img_give_ino_number(IsoImage *image, int flag);
uint32_t img_give_ino_number(IsoImage *image, int flag);
/* @param flag bit0= overwrite any ino, else only ino == 0
bit1= install inode with non-data, non-directory files