Mercurial > illumos > illumos-gate
changeset 4399:d5f991296d2a
backout 4294956/6489267/6490818: causes 6566056
author | dm120769 |
---|---|
date | Wed, 06 Jun 2007 15:56:51 -0700 |
parents | 52e14649304c |
children | a2a727ce4dcc |
files | usr/src/uts/common/fs/hsfs/hsfs_node.c usr/src/uts/common/fs/hsfs/hsfs_rrip.c usr/src/uts/common/fs/hsfs/hsfs_subr.c usr/src/uts/common/fs/hsfs/hsfs_susp_subr.c usr/src/uts/common/fs/hsfs/hsfs_vfsops.c usr/src/uts/common/fs/hsfs/hsfs_vnops.c usr/src/uts/common/sys/fs/hsfs_impl.h usr/src/uts/common/sys/fs/hsfs_node.h usr/src/uts/common/sys/fs/hsfs_rrip.h usr/src/uts/common/sys/fs/hsfs_susp.h |
diffstat | 10 files changed, 86 insertions(+), 240 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/hsfs/hsfs_node.c Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_node.c Wed Jun 06 15:56:51 2007 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -103,12 +103,6 @@ */ static int strict_iso9660_ordering = 0; -/* - * This tunable allows us to ignore inode numbers from rrip-1.12. - * In this case, we fall back to our default inode algorithm. - */ -int use_rrip_inodes = 1; - static void hs_hsnode_cache_reclaim(void *unused); static void hs_addfreeb(struct hsfs *fsp, struct hsnode *hp); static enum dirblock_result process_dirblock(struct fbuf *fbp, uint_t *offset, @@ -368,15 +362,12 @@ /* * Look for hsnode in hash list. - * If the inode number is != HS_DUMMY_INO (16), then - * only the inode number is used for the check. If the - * inode number is == HS_DUMMY_INO, we always in - * addition check equality of fsid and nodeid. + * Check equality of fsid and nodeid. * If found, reactivate it if inactive. * Must be entered with hsfs_hash_lock held. */ struct vnode * -hs_findhash(ino64_t nodeid, uint_t lbn, uint_t off, struct vfs *vfsp) +hs_findhash(ino64_t nodeid, struct vfs *vfsp) { struct hsnode *tp; struct hsfs *fsp; @@ -390,21 +381,6 @@ if (tp->hs_nodeid == nodeid) { struct vnode *vp; - if (nodeid == HS_DUMMY_INO) { - /* - * If this is the dummy inode number, look for - * matching dir_lbn and dir_off. - */ - for (; tp != NULL; tp = tp->hs_hash) { - if (tp->hs_nodeid == nodeid && - tp->hs_dir_lbn == lbn && - tp->hs_dir_off == off) - break; - } - if (tp == NULL) - return (NULL); - } - mutex_enter(&tp->hs_contents_lock); vp = HTOV(tp); VN_HOLD(vp); @@ -522,15 +498,14 @@ fsp = VFS_TO_HSFS(vfsp); /* - * Construct the data that allows us to re-read the meta data without - * knowing the name of the file: in the case of a directory + * Construct the nodeid: in the case of a directory * entry, this should point to the canonical dirent, the "." * directory entry for the directory. This dirent is pointed * to by all directory entries for that dir (including the ".") * entry itself. * In the case of a file, simply point to the dirent for that - * file (there are hard links in Rock Ridge, so we need to use - * different data to contruct the node id). + * file (there are no hard links in Rock Ridge, so there's no + * need to determine what the canonical dirent is. */ if (dp->type == VDIR) { lbn = dp->ext_lbn; @@ -544,27 +519,13 @@ hvp = &fsp->hsfs_vol; lbn += off >> hvp->lbn_shift; off &= hvp->lbn_maxoffset; - /* - * If the media carries rrip-v1.12 or newer, and we trust the inodes - * from the rrip data (use_rrip_inodes != 0), use that data. If the - * media has been created by a recent mkisofs version, we may trust - * all numbers in the starting extent number; otherwise, we cannot - * do this for zero sized files. We use HS_DUMMY_INO in this case and - * make sure that we will not map all files to the same meta data. - */ - if (dp->inode != 0 && use_rrip_inodes) { - nodeid = dp->inode; - } else { - nodeid = dp->ext_lbn; - if (dp->ext_size == 0 && (fsp->hsfs_flags & HSFSMNT_INODE) == 0) - nodeid = HS_DUMMY_INO; - } + nodeid = (ino64_t)MAKE_NODEID(lbn, off, vfsp); /* look for hsnode in cache first */ rw_enter(&fsp->hsfs_hash_lock, RW_READER); - if ((vp = hs_findhash(nodeid, lbn, off, vfsp)) == NULL) { + if ((vp = hs_findhash(nodeid, vfsp)) == NULL) { /* * Not in cache. However, someone else may have come @@ -574,7 +535,7 @@ rw_exit(&fsp->hsfs_hash_lock); rw_enter(&fsp->hsfs_hash_lock, RW_WRITER); - if ((vp = hs_findhash(nodeid, lbn, off, vfsp)) == NULL) { + if ((vp = hs_findhash(nodeid, vfsp)) == NULL) { /* * Now we are really sure that the hsnode is not * in the cache. Get one off freelist or else @@ -761,7 +722,7 @@ struct hsfs *fsp; int error = 0; uint_t offset; /* real offset in directory */ - uint_t last_offset; /* last index in directory */ + uint_t last_offset; /* last index into current dir block */ char *cmpname; /* case-folded name */ int cmpname_size; /* how much memory we allocate for it */ int cmpnamelen; @@ -919,7 +880,7 @@ struct hs_direntry *hdp, char *dnp, int *dnlen, - int last_offset) /* last offset in dirp */ + int last_offset) { char *on_disk_name; int on_disk_namelen; @@ -992,7 +953,6 @@ hdp->uid = fsp -> hsfs_vol.vol_uid; hdp->gid = fsp -> hsfs_vol.vol_gid; hdp->mode = hdp-> mode | (fsp -> hsfs_vol.vol_prot & 0777); - hdp->inode = 0; /* initialize with 0, then check rrip */ /* * Having this all filled in, let's see if we have any @@ -1000,8 +960,7 @@ */ if (IS_SUSP_IMPLEMENTED(fsp)) { error = parse_sua((uchar_t *)dnp, dnlen, - &name_change_flag, dirp, last_offset, - hdp, fsp, + &name_change_flag, dirp, hdp, fsp, (uchar_t *)NULL, NULL); if (error) { if (hdp->sym_link) { @@ -1453,7 +1412,7 @@ int dnamelen; /* length of name */ struct hs_direntry hd; int hdlen; - uchar_t *dirp; /* the directory entry */ + uchar_t *dirp; /* the directory entry */ int res; int parsedir_res; int is_rrip; @@ -1562,8 +1521,7 @@ rrip_name_str[0] = '\0'; rr_namelen = rrip_namecopy(nm, &rrip_name_str[0], - &rrip_tmp_name[0], dirp, last_offset - *offset, - fsp, &hd); + &rrip_tmp_name[0], dirp, fsp, &hd); if (hd.sym_link) { kmem_free(hd.sym_link, (size_t)(hd.ext_size+1)); @@ -1651,7 +1609,7 @@ /* name matches */ parsedir_res = hs_parsedir(fsp, dirp, &hd, (char *)NULL, (int *)NULL, - last_offset - *offset); + last_offset - rel_offset(*offset)); if (!parsedir_res) { uint_t lbn; /* logical block number */
--- a/usr/src/uts/common/fs/hsfs/hsfs_rrip.c Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_rrip.c Wed Jun 06 15:56:51 2007 -0700 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -129,11 +129,6 @@ hdp->uid = RRIP_UID(px_ptr); hdp->gid = RRIP_GID(px_ptr); - if (SUF_LEN(px_ptr) >= RRIP_PX_SIZE) - hdp->inode = (ino64_t)RRIP_INO(px_ptr); - else - hdp->inode = 0; - hdp->type = IFTOVT(hdp->mode); return (px_ptr + SUF_LEN(px_ptr)); @@ -216,9 +211,6 @@ int dst_size) /* limit dest string to */ /* this value */ { - size_t off; - size_t len; - if (IS_NAME_BIT_SET(rrip_flags, RRIP_NAME_ROOT)) (void) strcpy((char *)dst, "/"); @@ -257,21 +249,17 @@ * Unfortunately, strlcat() cannot deal with input strings * that are not NULL-terminated - like SUA_string can be in * our case here. So we can't use it :( - * Now strncat() doesn't work either - because it doesn't deal - * with strings for which the 'potential NULL-termination' isn't - * accessible - strncat(dst, NULL, 0) crashes although it copies - * nothing in any case. If the SUA ends on a mapping boundary, - * then telling strncat() to copy no more than the remaining bytes - * in the buffer is of no avail if there's no NULL byte in them. - * - * Hence - binary copy. What are all these str* funcs for ?? + * We therefore have to emulate its behaviour using strncat(), + * which will never access more bytes from the input string + * than specified. Since strncat() doesn't necessarily NULL- + * terminate the result, make sure we've got space for the + * Nullbyte at the end. */ dst_size--; /* trailing '\0' */ - off = strlen((char *)dst); - len = MIN(dst_size - off, SUA_string_len); - bcopy((char *)SUA_string, (char *)(dst + off), len); - dst[off + len] = '\0'; + (void) strncat((char *)dst, (char *)SUA_string, + MIN(dst_size - strlen((char *)dst), SUA_string_len)); + dst[dst_size] = '\0'; *dst_lenp = strlen((char *)dst); if (IS_NAME_BIT_SET(rrip_flags, RRIP_NAME_CONTINUE)) @@ -445,7 +433,6 @@ char *to, /* string to copy "from" to */ char *tmp_name, /* temp storage for original name */ uchar_t *dirp, /* directory entry pointer */ - uint_t last_offset, /* last index into current dir block */ struct hsfs *fsp, /* filesystem pointer */ struct hs_direntry *hdp) /* directory entry pointer to put */ /* all that good info in */ @@ -473,8 +460,7 @@ } - ret_val = parse_sua((uchar_t *)to, &size, &change_flag, - dirp, last_offset, + ret_val = parse_sua((uchar_t *)to, &size, &change_flag, dirp, hdp, fsp, (uchar_t *)NULL, NULL); if (IS_NAME_BIT_SET(change_flag, RRIP_NAME_CHANGE) && !ret_val)
--- a/usr/src/uts/common/fs/hsfs/hsfs_subr.c Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_subr.c Wed Jun 06 15:56:51 2007 -0700 @@ -21,7 +21,7 @@ /* * Miscellaneous support subroutines for High Sierra filesystem * - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,16 +115,6 @@ "has inconsistent data:", "invalid directory or file name length (ignored)\n", 1, 0, - /* HSFS_ERR_NEG_SUA_LEN */ - "hsfs: Warning: file system mounted on %s " - "has inconsistent Rock Ridge data:", - "negative SUA len\n", - 1, 0, - /* HSFS_ERR_BAD_SUA_LEN */ - "hsfs: Warning: file system mounted on %s " - "has inconsistent Rock Ridge data:", - "SUA len too big\n", - 1, 0, };
--- a/usr/src/uts/common/fs/hsfs/hsfs_susp_subr.c Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_susp_subr.c Wed Jun 06 15:56:51 2007 -0700 @@ -22,7 +22,7 @@ * System Use Sharing protocol subroutines for High Sierra filesystem */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -84,7 +84,6 @@ int *name_len_p, /* location to put name len */ int *name_change_p, /* flags to signal name chg */ uchar_t *dirp, /* pointer to ISO dir entry */ - uint_t last_offset, /* last ind. in cur. dirblock */ struct hs_direntry *hdp, /* loc to store dir info */ struct hsfs *fsp, /* filesystem pointer */ uchar_t *search_sig, /* signature to search for */ @@ -111,15 +110,8 @@ * between sizes of SUA and ISO directory entry. This entry * is corrupted, return an appropriate error. */ - if (SUA_len < 0) { - hs_log_bogus_disk_warning(fsp, HSFS_ERR_NEG_SUA_LEN, 0); + if (SUA_len < 0) return (SUA_EINVAL); - } - - if ((tmp_SUA_p + tmp_SUA_len) > (dirp + last_offset)) { - hs_log_bogus_disk_warning(fsp, HSFS_ERR_BAD_SUA_LEN, 0); - return (SUA_EINVAL); - } /* * Make sure that the continuation lenth is zero, as that is @@ -429,24 +421,11 @@ if ((susp_sp->sig_handler)(&sig_args) == (uchar_t *)NULL) { goto end; } - } else { + } else goto end; - } - /* - * If the "ER" signature in the root directory is past any non SU - * signature, the Rock Ridge signatures will be ignored. This happens - * e.g. for filesystems created by mkisofs. In this case, - * IS_RRIP_IMPLEMENTED(fsp) will return 0 when the "ER" signature is - * parsed. Unfortunately, the results of this run will be cached for - * the root vnode. The solution is to run hs_parsedir() a second time - * for the root directory. - */ - if (hs_parsedir(fsp, root_ptr, hdp, (char *)NULL, (int *)NULL, - HS_SECTOR_SIZE - secoff) == 0) { - (void) hs_parsedir(fsp, root_ptr, hdp, (char *)NULL, - (int *)NULL, HS_SECTOR_SIZE - secoff); - } + (void) hs_parsedir(fsp, root_ptr, hdp, (char *)NULL, (int *)NULL, + HS_SECTOR_SIZE - secoff); /* * If we did not get at least 1 extension, let's assume ISO and
--- a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c Wed Jun 06 15:56:51 2007 -0700 @@ -476,10 +476,9 @@ rw_enter(&fsp->hsfs_hash_lock, RW_READER); - nodeid = fid->hf_ino; + nodeid = (ino64_t)MAKE_NODEID(fid->hf_dir_lbn, fid->hf_dir_off, vfsp); - if ((*vpp = hs_findhash(nodeid, fid->hf_dir_lbn, - (uint_t)fid->hf_dir_off, vfsp)) == NULL) { + if ((*vpp = hs_findhash(nodeid, vfsp)) == NULL) { /* * Not in cache, so we need to remake it. * hs_remakenode() will read the directory entry @@ -884,10 +883,7 @@ break; } - /* - * Add the HSFSMNT_INODE pseudo mount flag to the current mount flags. - */ - fsp->hsfs_flags = mount_flags | (fsp->hsfs_flags & HSFSMNT_INODE); + fsp->hsfs_flags = mount_flags; DTRACE_PROBE1(mount__done, struct hsfs *, fsp); @@ -897,9 +893,6 @@ fsp->hsfs_magic = HSFS_MAGIC; mutex_exit(&hs_mounttab_lock); - kmem_free(svp, sizeof (*svp)); - kmem_free(jvp, sizeof (*jvp)); - return (0); cleanup: @@ -970,7 +963,6 @@ { struct buf *secbp; int i; - int n; uchar_t *volp; int error; uint_t secno; @@ -987,12 +979,7 @@ volp = (uchar_t *)secbp->b_un.b_addr; - /* - * To avoid that we read the whole medium in case that someone prepares - * a malicious "fs image", we read at most 32 blocks. - */ - for (n = 0; n < 32 && - HSV_DESC_TYPE(volp) != VD_EOV; n++) { + while (HSV_DESC_TYPE(volp) != VD_EOV) { for (i = 0; i < HSV_ID_STRLEN; i++) if (HSV_STD_ID(volp)[i] != HSV_ID_STRING[i]) goto cantfind; @@ -1100,14 +1087,12 @@ { struct buf *secbp; int i; - int n; uchar_t *volp; int error; uint_t secno; int foundpvd = 0; int foundsvd = 0; int foundjvd = 0; - int pvd_sum = 0; secno = hs_findvoldesc(vp->v_rdev, ISO_VOLDESC_SEC); secbp = bread(vp->v_rdev, secno * 4, ISO_SECTOR_SIZE); @@ -1121,12 +1106,7 @@ volp = (uchar_t *)secbp->b_un.b_addr; - /* - * To avoid that we read the whole medium in case that someone prepares - * a malicious "fs image", we read at most 32 blocks. - */ - for (n = 0; n < 32 && - (enum iso_voldesc_type) ISO_DESC_TYPE(volp) != ISO_VD_EOV; n++) { + while ((enum iso_voldesc_type) ISO_DESC_TYPE(volp) != ISO_VD_EOV) { for (i = 0; i < ISO_ID_STRLEN; i++) if (ISO_STD_ID(volp)[i] != ISO_ID_STRING[i]) goto cantfind; @@ -1142,8 +1122,6 @@ return (error); } foundpvd = 1; - for (i = 0; i < ISO_SECTOR_SIZE; i++) - pvd_sum += volp[i]; } break; case ISO_VD_SVD: @@ -1188,38 +1166,6 @@ volp = (uchar_t *)secbp->b_un.b_addr; } - for (n = 0; n < 16; n++) { - brelse(secbp); - ++secno; - secbp = bread(vp->v_rdev, secno * 4, HS_SECTOR_SIZE); - error = geterror(secbp); - - if (error != 0) { - cmn_err(CE_NOTE, "hs_findisovol: bread: error=(%d)", - error); - brelse(secbp); - return (error); - } - - /* - * Check for the signature from mkisofs that grants that - * the current filesystem allows to use the extent lbn as - * inode number even in pure ISO9660 mode. - */ - volp = (uchar_t *)secbp->b_un.b_addr; - if (strncmp((char *)volp, "MKI ", 4) == 0) { - int sum; - - sum = volp[2045]; - sum *= 256; - sum += volp[2046]; - sum *= 256; - sum += volp[2047]; - if (sum == pvd_sum) - fsp->hsfs_flags |= HSFSMNT_INODE; - break; - } - } if (foundpvd) { brelse(secbp); return (0);
--- a/usr/src/uts/common/fs/hsfs/hsfs_vnops.c Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_vnops.c Wed Jun 06 15:56:51 2007 -0700 @@ -83,13 +83,6 @@ #include <fs/fs_subr.h> -/* - * This tunable allows us to ignore inode numbers from rrip-1.12. - * In this case, we fall back to our default inode algorithm. - */ -extern int use_rrip_inodes; - - /* ARGSUSED */ static int hsfs_fsync(vnode_t *cp, int syncflag, cred_t *cred) @@ -383,6 +376,7 @@ size_t dname_size; struct fbuf *fbp; uint_t last_offset; /* last index into current dir block */ + ulong_t dir_lbn; /* lbn of directory */ ino64_t dirino; /* temporary storage before storing in dirent */ off_t diroff; @@ -391,6 +385,7 @@ if (dhp->hs_dirent.ext_size == 0) hs_filldirent(vp, &dhp->hs_dirent); dirsiz = dhp->hs_dirent.ext_size; + dir_lbn = dhp->hs_dirent.ext_lbn; if (uiop->uio_loffset >= dirsiz) { /* at or beyond EOF */ if (eofp) *eofp = 1; @@ -452,7 +447,7 @@ */ if (!hs_parsedir(fsp, &blkp[rel_offset(offset)], &hd, dname, &dnamelen, - last_offset - offset)) { + last_offset - rel_offset(offset))) { /* * Determine if there is enough room */ @@ -466,26 +461,31 @@ diroff = offset + hdlen; /* - * If the media carries rrip-v1.12 or newer, - * and we trust the inodes from the rrip data - * (use_rrip_inodes != 0), use that data. If the - * media has been created by a recent mkisofs - * version, we may trust all numbers in the - * starting extent number; otherwise, we cannot - * do this for zero sized files. We use - * HS_DUMMY_INO in this case and make sure that - * we will not map all files to the same - * meta data. + * Generate nodeid. + * If a directory, nodeid points to the + * canonical dirent describing the directory: + * the dirent of the "." entry for the + * directory, which is pointed to by all + * dirents for that directory. + * Otherwise, nodeid points to dirent of file. */ - if (hd.inode != 0 && use_rrip_inodes) { - dirino = hd.inode; + if (hd.type == VDIR) { + dirino = (ino64_t) + MAKE_NODEID(hd.ext_lbn, 0, + vp->v_vfsp); } else { - dirino = hd.ext_lbn; - if (hd.ext_size == 0 && - (fsp->hsfs_flags & - HSFSMNT_INODE) == 0) { - dirino = HS_DUMMY_INO; - } + struct hs_volume *hvp; + offset_t lbn, off; + + /* + * Normalize lbn and off + */ + hvp = &fsp->hsfs_vol; + lbn = dir_lbn + + (offset >> hvp->lbn_shift); + off = offset & hvp->lbn_maxoffset; + dirino = (ino64_t)MAKE_NODEID(lbn, + off, vp->v_vfsp); } @@ -557,7 +557,6 @@ mutex_enter(&hp->hs_contents_lock); fid->hf_dir_lbn = hp->hs_dir_lbn; fid->hf_dir_off = (ushort_t)hp->hs_dir_off; - fid->hf_ino = hp->hs_nodeid; mutex_exit(&hp->hs_contents_lock); return (0); }
--- a/usr/src/uts/common/sys/fs/hsfs_impl.h Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/sys/fs/hsfs_impl.h Wed Jun 06 15:56:51 2007 -0700 @@ -22,7 +22,7 @@ * High Sierra filesystem internal routine definitions. */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -53,8 +53,7 @@ extern int hs_dirlook(struct vnode *dvp, char *name, int namlen, struct vnode **vpp, struct cred *cred); /* find an hsnode in the hash list */ -extern struct vnode *hs_findhash(ino64_t nodeid, uint_t lbn, uint_t off, - struct vfs *vfsp); +extern struct vnode *hs_findhash(ino64_t nodeid, struct vfs *vfsp); /* destroy an hsnode */ extern void hs_freenode(vnode_t *vp, struct hsfs *fsp, int nopage); /* parse a directory entry */
--- a/usr/src/uts/common/sys/fs/hsfs_node.h Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/sys/fs/hsfs_node.h Wed Jun 06 15:56:51 2007 -0700 @@ -22,7 +22,7 @@ * High Sierra filesystem structure definitions */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,7 +46,6 @@ uint_t nlink; /* no. of links to file */ uid_t uid; /* owner's user id */ gid_t gid; /* owner's group id */ - ino64_t inode; /* inode number from rrip data */ dev_t r_dev; /* major/minor device numbers */ uint_t xar_prot :1; /* 1 if protection in XAR */ uchar_t xar_len; /* no. of Logical blocks in XAR */ @@ -115,7 +114,6 @@ ushort_t hf_len; /* length of fid */ ushort_t hf_dir_off; /* offset in LBN of directory entry */ uint_t hf_dir_lbn; /* LBN of directory */ - uint32_t hf_ino; /* The inode number or HS_DUMMY_INO */ }; @@ -154,17 +152,6 @@ #define HS_HSNODESPACE 16384 /* approx. space used for hsnodes */ /* - * We usually use the starting extent LBA for the inode numbers of files and - * directories. As this will not work for zero sized files, we assign a dummy - * inode number to all zero sized files. We use the number 16 as this is the - * LBA for the PVD, this number cannot be a valid starting extent LBA for a - * file. In case that the node number is the HS_DUMMY_INO, we use the LBA and - * offset of the directory entry of this file (which is what we used before - * we started to support correct hard links). - */ -#define HS_DUMMY_INO 16 /* dummy inode number for empty files */ - -/* * High Sierra filesystem structure. * There is one of these for each mounted High Sierra filesystem. */ @@ -213,8 +200,6 @@ #define HSFS_ERR_BAD_JOLIET_FILE_LEN 5 #define HSFS_ERR_TRUNC_JOLIET_FILE_LEN 6 #define HSFS_ERR_BAD_DIR_ENTRY 7 -#define HSFS_ERR_NEG_SUA_LEN 8 -#define HSFS_ERR_BAD_SUA_LEN 9 #define HSFS_HAVE_LOWER_CASE(fsp) \ ((fsp)->hsfs_err_flags & (1 << HSFS_ERR_LOWER_CASE_NM)) @@ -256,6 +241,18 @@ #define BYTE_TO_LBN(boff, vfsp) ((boff)>>((struct hsfs *)((vfsp)->vfs_data))-> \ hsfs_vol.lbn_shift) +/* + * Create a nodeid. + * We construct the nodeid from the location of the directory + * entry which points to the file. We divide by 32 to + * compress the range of nodeids; we know that the minimum size + * for an ISO9660 dirent is 34, so we will never have adjacent + * dirents with the same nodeid. + */ +#define HSFS_MIN_DL_SHFT 5 +#define MAKE_NODEID(lbn, off, vfsp) \ + ((LBN_TO_BYTE((lbn), (vfsp)) + (off)) >> HSFS_MIN_DL_SHFT) + #ifdef __cplusplus } #endif
--- a/usr/src/uts/common/sys/fs/hsfs_rrip.h Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/sys/fs/hsfs_rrip.h Wed Jun 06 15:56:51 2007 -0700 @@ -22,7 +22,7 @@ * ISO 9660 RRIP extension filesystem specifications */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -48,8 +48,6 @@ #define HSFSMNT_NOJOLIET 0x20 /* ignore Joliet even if present */ #define HSFSMNT_JOLIETLONG 0x40 /* do not truncate Joliet filenames */ #define HSFSMNT_NOVERS2 0x80 /* ignore ISO-9660:1999 */ -#define HSFSMNT_INODE 0x1000 /* May use ext_lbn as inode #, */ - /* FS is from a recent mkisofs */ /* * XXX: The following flag was used in the past to instruct the kernel to @@ -179,12 +177,6 @@ #define RRIP_gid(x) (&((uchar_t *)x)[28]) #define RRIP_GID(x) (gid_t)BOTH_INT(RRIP_gid(x)) -#define RRIP_ino(x) (&((uchar_t *)x)[36]) -#define RRIP_INO(x) (uint32_t)BOTH_INT(RRIP_ino(x)) - -#define RRIP_PX_OLD_SIZE 36 -#define RRIP_PX_SIZE 44 - /* * "PN" Posix major/minor numbers */ @@ -298,8 +290,7 @@ extern uchar_t *rrip_reloc_dir(sig_args_t *); extern uchar_t *rrip_rock_ridge(sig_args_t *); extern void hs_check_root_dirent(struct vnode *vp, struct hs_direntry *hdp); -extern int rrip_namecopy(char *from, char *to, char *tmp_name, - uchar_t *dirp, uint_t last_offset, +extern int rrip_namecopy(char *from, char *to, char *tmp_name, uchar_t *dirp, struct hsfs *fsp, struct hs_direntry *hdp); #endif /* _KERNEL */
--- a/usr/src/uts/common/sys/fs/hsfs_susp.h Wed Jun 06 13:57:04 2007 -0700 +++ b/usr/src/uts/common/sys/fs/hsfs_susp.h Wed Jun 06 15:56:51 2007 -0700 @@ -2,8 +2,9 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,8 +21,8 @@ */ /* * ISO 9660 RRIP extension filesystem specifications - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1991,1997-1998,2000 by Sun Microsystems, Inc. + * All rights reserved. */ #ifndef _SYS_FS_HSFS_SUSP_H @@ -248,8 +249,8 @@ extern ext_signature_t *susp_sp; -extern int parse_sua(uchar_t *, int *name_len_p, int *, uchar_t *, uint_t, - struct hs_direntry *, struct hsfs *, uchar_t *, int search_num); +extern int parse_sua(uchar_t *, int *name_len_p, int *, uchar_t *, struct + hs_direntry *, struct hsfs *, uchar_t *, int search_num); #endif /* _KERNEL */