diff --git a/src/ecma119.c b/src/ecma119.c index ad831d1..415e0be 100644 --- a/src/ecma119.c +++ b/src/ecma119.c @@ -713,6 +713,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, target->iso_level = opts->level; target->rockridge = 1; //TODO + target->ino = 0; target->omit_version_numbers = opts->omit_version_numbers; target->allow_deep_paths = 0; //TODO target->sort_files = opts->sort_files; diff --git a/src/ecma119.h b/src/ecma119.h index f8f4bd7..915bccb 100644 --- a/src/ecma119.h +++ b/src/ecma119.h @@ -54,6 +54,12 @@ struct ecma119_image { // uid_t uid; int sort_files; /**< if sort files or not. Sorting is based of * the weight of each file */ + + /** + * In the CD, each file must have an unique inode number. So each + * time we add a new file, this is incremented. + */ + ino_t ino; char *input_charset; diff --git a/src/ecma119_tree.c b/src/ecma119_tree.c index e4d1370..97aa175 100644 --- a/src/ecma119_tree.c +++ b/src/ecma119_tree.c @@ -79,10 +79,10 @@ int create_ecma119_node(Ecma119Image *img, IsoNode *iso, Ecma119Node **node) ecma->node = iso; iso_node_ref(iso); - // TODO what to do with full name? For now, not a problem, as we - // haven't support for charset conversion. However, one we had it, - // we need to choose whether to do it here (consumes more memory) - // or on writting + // TODO better handling of this, add support for harlinks + ecma->nlink = 1; + ecma->ino = ++img->ino; + *node = ecma; return ISO_SUCCESS; } @@ -605,6 +605,8 @@ int create_placeholder(Ecma119Node *parent, ret->parent = parent; ret->type = ECMA119_PLACEHOLDER; ret->info.real_me = real; + ret->ino = real->ino; + ret->nlink = real->nlink; *node = ret; return ISO_SUCCESS; diff --git a/src/ecma119_tree.h b/src/ecma119_tree.h index 57150e4..d1a34d4 100644 --- a/src/ecma119_tree.h +++ b/src/ecma119_tree.h @@ -60,7 +60,11 @@ struct ecma119_node Ecma119Node *parent; IsoNode *node; /*< reference to the iso node */ - + + // TODO add true support for this + ino_t ino; + nlink_t nlink; + /**< file, symlink, special, directory or placeholder */ enum ecma119_node_type type; union { diff --git a/src/rockridge.c b/src/rockridge.c index b76342c..12c286e 100644 --- a/src/rockridge.c +++ b/src/rockridge.c @@ -62,13 +62,10 @@ int rrip_add_PX(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp) PX[2] = 44; PX[3] = 1; iso_bb(&PX[4], n->node->mode, 4); - // TODO support nlink and ino - // TODO n->node->nlink - iso_bb(&PX[12], 1, 4); + iso_bb(&PX[12], n->nlink, 4); iso_bb(&PX[20], n->node->uid, 4); iso_bb(&PX[28], n->node->gid, 4); - // TODO n->node->ino - iso_bb(&PX[36], (int)n->node, 4); + iso_bb(&PX[36], n->ino, 4); return susp_append(t, susp, PX); } @@ -720,6 +717,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type, /* * SP must be the first entry for the "." record of the root directory + * (SUSP, 5.3) */ if (type == 1 && n->parent == NULL) { ret = susp_add_SP(t, info); @@ -785,7 +783,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type, uint8_t **comps = NULL; /* components of the SL field */ size_t n_comp = 0; /* number of components */ - // TODO handle output stream + // TODO handle output charset name = n->node->name; namelen = strlen(name); @@ -847,13 +845,13 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type, */ if (28 <= sua_free) { /* the CE entry fills without reducing NM */ - sua_free -= 28; //TODO needed? + sua_free -= 28; cew = 1; } else { /* we need to reduce NM */ nm_type = 1; ce_len = (28 - sua_free) + 5; - sua_free = 0;//su_size = space; + sua_free = 0; cew = 1; } } else {