From 36fb5aee6de8bc049ff854a1978c335f379f750a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 24 Jan 1999 03:12:42 +0000 Subject: 1999-01-22 Roland McGrath * rr.c (rrip_work): Remove makedev macro definition. --- isofs/rr.c | 119 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 59 insertions(+), 60 deletions(-) (limited to 'isofs') diff --git a/isofs/rr.c b/isofs/rr.c index 11047198..cdb7a792 100644 --- a/isofs/rr.c +++ b/isofs/rr.c @@ -1,5 +1,5 @@ -/* - Copyright (C) 1997 Free Software Foundation, Inc. +/* + Copyright (C) 1997, 1999 Free Software Foundation, Inc. Written by Thomas Bushnell, n/BSG. This file is part of the GNU Hurd. @@ -91,18 +91,18 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, if (err) return 0; /* give up */ p = disk_image + (filestart << store->log2_block_size); - + /* Set C to the system use area. */ c = p->name + p->namelen; if ((int)c & 1) c++; - + /* There needs to be an SUSP SP field right here; make sure there is */ if (!bcmp (c, "SP\7\1\276\357", 6)) bp = c; else if (!bcmp (c + 15, "SP\7\1\276\357", 6)) /* Detect CD-ROM XA disk */ - bp = c + 15; + bp = c + 15; else /* No SUSP, give up. */ return 0; @@ -118,7 +118,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, bp += susp_skip; /* skip to start of susp area */ terminus = (char *) dr + dr->len; } - + /* Loop across all the fields, processing them one at a time. */ @@ -126,15 +126,15 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, { struct su_header *susp = bp; void *body; - + /* Make sure the whole thing fits */ if (bp + sizeof (struct su_header) > terminus || bp + susp->len > terminus) break; - + body = (char *) susp + sizeof (struct su_header); - /* CE means that further extension fields are elsewhere on + /* CE means that further extension fields are elsewhere on the disk. We just reset the pointers and keep going. */ if (susp->sig[0] == 'C' && susp->sig[1] == 'E' @@ -148,7 +148,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, offset = isonum_733 (ce->offset); location = isonum_733 (ce->continuation); size = isonum_733 (ce->size); - + /* Reset pointers */ bp = disk_image + (location * logical_block_size) + offset; terminus = bp + size; @@ -166,12 +166,12 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, { /* Sharing Protocol */ struct su_sp *sp = body; - + /* Verify magic numbers */ if (sp->check[0] == SU_SP_CHECK_0 && sp->check[1] == SU_SP_CHECK_1) susp_live = 1; - + susp_skip = sp->skip; goto next_field; @@ -180,7 +180,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, /* Only on the root node; ER signals that a specified extension is present. We implement and check for only the Rock Ridge extension. */ - if (initializing + if (initializing && susp->sig[0] == 'E' && susp->sig[1] == 'R' && susp->version == 1) @@ -192,7 +192,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, if ((void *) er->more + er->len_id + er->len_des + er->len_src < terminus) goto next_field; - + /* Check for rock-ridge */ if (er->ext_ver == ROCK_VERS && !memcmp (ROCK_ID, er->more, er->len_id)) @@ -216,14 +216,14 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, && susp->version == 1) /* All done */ break; - + /* The rest are Rock-Ridge, and are not interesting if we are doing setup. */ - + if (initializing || !rock_live) goto next_field; - - /* RE is present in a directory entry to mean that the node + + /* RE is present in a directory entry to mean that the node is specified by a CL field elsewhere. So this entry needs to be ignored by anyone who understands CL fields. */ if (susp->sig[0] == 'R' @@ -247,10 +247,10 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, size_t nmlen = susp->len - 5; char *name; size_t namelen; - + if (nomorenm) goto next_field; - + if (nm->flags & NAME_DOT) { name = "."; @@ -280,15 +280,15 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, else nmbuf = realloc (nmbuf, (nmbufsize += nmlen) + 1); assert (nmbuf); - + bcopy (nm->name, nmbuf + nmbufsize - nmlen, nmlen); - + if (nm->flags & NAME_CONTINUE) goto next_field; name = nmbuf; namelen = nmbufsize; - + finalize_nm: nomorenm = 1; @@ -296,7 +296,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, if (match_name && (match_name_len != namelen || memcmp (match_name, name, match_name_len))) return 0; - + /* Store the name */ rr->valid |= VALID_NM; if (name != nmbuf) @@ -309,7 +309,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, rr->name = name; name[namelen] = '\0'; } - + if (rr->valid & VALID_CL) /* Finalize CL processing. */ goto clrecurse; @@ -323,31 +323,30 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, && susp->version == 1) { struct rr_px *px = body; - + rr->valid |= VALID_PX; - + rr->mode = isonum_733 (px->mode); rr->nlink = isonum_733 (px->nlink); rr->uid = isonum_733 (px->uid); rr->gid = isonum_733 (px->gid); - + goto next_field; } - + /* PN, for S_ISCHR and S_ISDEV devices gives the magic numbers */ if (susp->sig[0] == 'P' && susp->sig[1] == 'N' && susp->version == 1) { -#define makedev(maj,min) ((((maj)&0xFF)<<8)+((min)&0xFF)) struct rr_pn *pn = body; - + rr->valid |= VALID_PN; rr->rdev = makedev (isonum_733 (pn->high), isonum_733 (pn->low)); - + goto next_field; } - + /* SL tells, for a symlink, what the target of the link is */ if (susp->sig[0] == 'S' && susp->sig[1] == 'L' @@ -358,7 +357,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, struct rr_sl_comp *comp; void *cp; size_t targalloced, targused; - + void add_comp (char *cname, size_t cnamelen) { if (rr->target == 0) @@ -370,11 +369,11 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, else if (targused + cnamelen > targalloced) rr->target = realloc (rr->target, targalloced *= 2); assert (rr->target); - + bcopy (cname, rr->target + targused, cnamelen); targused += cnamelen; } - + if (nomoresl) goto next_field; @@ -386,9 +385,9 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, else slbuf = realloc (slbuf, slbufsize += crlen); assert (slbuf); - + bcopy (sl->data, slbuf + slbufsize - crlen, crlen); - + if (sl->flags & 1) /* We'll finish later. */ goto next_field; @@ -398,7 +397,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, { comp = (struct rr_sl_comp *)cp; nomoresl = 1; - + /* Put in a slash after each component as we go, unless it's a "continuation" component. */ @@ -439,7 +438,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, free (slbuf); goto next_field; } - + /* TF gives atime, mtime, ctime (and others we don't care about); this overrides the time specified in the directory. */ if (susp->sig[0] == 'T' @@ -449,7 +448,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, char *(*convert)(char *, struct timespec *); struct rr_tf *tf = body; char *c; - + if (tf->flags & TF_LONG_FORM) convert = isodate_84261; else @@ -468,7 +467,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, goto next_field; } - + /* CL means that this entry is a relocated directory. We ignore the attributes in this directory entry (except for NM); they are fetched from the "." entry of the directory itself. The @@ -504,7 +503,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, realdir = rr->realdirent; rrip_work (realdir, rr, 0, 0, 0, 1); - + rr->valid |= VALID_CL; rr->realdirent = realdir; if (savename) @@ -512,19 +511,19 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, rr->valid |= VALID_NM; rr->name = savename; } - + /* If there's an NM field, then we must have matched if we got here. */ return (rr->valid & VALID_NM) ? 1 : 0; } - + /* We must keep looking for an NM record. When we find one, the NM code will goto the above piece of code. */ goto next_field; } - /* PL is found in the ".." entry of a relocated directory. - The present directory entry points to the fictitious parent + /* PL is found in the ".." entry of a relocated directory. + The present directory entry points to the fictitious parent (the one that holds the fictitious RE link here); the PL field identifies the real parent (the one that has the CL entry). */ @@ -533,8 +532,8 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, && susp->version == 1) { struct rr_pl *pl = body; - - rr->realfilestart = (isonum_733 (pl->loc) + + rr->realfilestart = (isonum_733 (pl->loc) * (logical_block_size >> store->log2_block_size)); rr->valid |= VALID_PL; @@ -557,21 +556,21 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, goto next_field; } - + if (susp->sig[0] == 'T' && susp->sig[1] == 'R' && susp->version == 1) { struct gn_tr *tr = body; - + rr->translen = tr->len; rr->trans = malloc (rr->translen); memcpy (tr->data, rr->trans, rr->translen); rr->valid |= VALID_TR; - + goto next_field; } - + if (susp->sig[0] == 'M' && susp->sig[1] == 'D' && susp->version == 1) @@ -580,19 +579,19 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, rr->allmode = isonum_733 (md->mode); rr->valid |= VALID_MD; - + goto next_field; } - + if (susp->sig[0] == 'F' && susp->sig[1] == 'L' && susp->version == 1) { struct gn_fl *fl = body; - + rr->flags = isonum_733 (fl->flags); rr->valid |= VALID_FL; - + goto next_field; } @@ -611,19 +610,19 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, /* Parse extensions for directory entry DR. If we encounter an NM record, and it does not match NAME (length NAMELEN), then stop immediately (but do note the NM file in RR->valid) and return zero. - If we encounter no NM record at all, then process all the fields + If we encounter no NM record at all, then process all the fields normally and return zero. If we encounter an NM field which matches the provided name, then process all the fields and return 1. In any case, fill RR with information corresponding to the fields we do encounter. */ int -rrip_match_lookup (struct dirrect *dr, char *name, size_t namelen, +rrip_match_lookup (struct dirrect *dr, char *name, size_t namelen, struct rrip_lookup *rr) { return rrip_work (dr, rr, name, namelen, 0, 0); } -/* Parse extensions for dirrect DR and store the results in RR. +/* Parse extensions for dirrect DR and store the results in RR. If IGNORENM, then do not bother with NM records. */ void rrip_lookup (struct dirrect *dr, struct rrip_lookup *rr, int ignorenm) -- cgit v1.2.3