Deleted Added
full compact
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley
6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
7 * Support code is derived from software contributed to Berkeley
8 * by Atsushi Murai (amurai@spec.co.jp).

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
39 * $Id: cd9660_node.c,v 1.6 1994/09/26 00:32:56 gpalmer Exp $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/mount.h>
45#include <sys/proc.h>
46#include <sys/file.h>
47#include <sys/buf.h>

--- 213 unchanged lines hidden (view full) ---

261
262 vp = ITOV(ip);
263
264 /*
265 * Setup time stamp, attribute
266 */
267 vp->v_type = VNON;
268 switch (imp->iso_ftype) {
269 default: /* ISO_FTYPE_9660 */
270 if ((imp->im_flags&ISOFSMNT_EXTATT)
271 && isonum_711(isodir->ext_attr_length))
272 iso_blkatoff(ip,-isonum_711(isodir->ext_attr_length),
273 &bp2);
274 cd9660_defattr(isodir,ip,bp2 );
275 cd9660_deftstamp(isodir,ip,bp2 );
276 break;
277 case ISO_FTYPE_RRIP:
278 result = cd9660_rrip_analyze(isodir,ip,imp);
279 break;
280 }
281 if (bp2)
282 brelse(bp2);
283 if (bp)

--- 164 unchanged lines hidden (view full) ---

448 }
449 return (0);
450}
451
452/*
453 * File attributes
454 */
455void
456cd9660_defattr(isodir,inop,bp)
457 struct iso_directory_record *isodir;
458 struct iso_node *inop;
459 struct buf *bp;
460{
461 struct buf *bp2 = NULL;
462 struct iso_mnt *imp;
463 struct iso_extended_attributes *ap = NULL;
464 int off;
465
466 if (isonum_711(isodir->flags)&2) {
467 inop->inode.iso_mode = S_IFDIR;
468 /*
469 * If we return 2, fts() will assume there are no subdirectories
470 * (just links for the path and .), so instead we return 1.
471 */
472 inop->inode.iso_links = 1;
473 } else {
474 inop->inode.iso_mode = S_IFREG;

--- 34 unchanged lines hidden (view full) ---

509 if (bp2)
510 brelse(bp2);
511}
512
513/*
514 * Time stamps
515 */
516void
517cd9660_deftstamp(isodir,inop,bp)
518 struct iso_directory_record *isodir;
519 struct iso_node *inop;
520 struct buf *bp;
521{
522 struct buf *bp2 = NULL;
523 struct iso_mnt *imp;
524 struct iso_extended_attributes *ap = NULL;
525 int off;
526
527 if (!bp
528 && ((imp = inop->i_mnt)->im_flags&ISOFSMNT_EXTATT)
529 && (off = isonum_711(isodir->ext_attr_length))) {
530 iso_blkatoff(inop,-off * imp->logical_block_size,&bp2);
531 bp = bp2;
532 }
533 if (bp) {
534 ap = (struct iso_extended_attributes *)bp->b_un.b_addr;
535
536 if (isonum_711(ap->version) == 1) {
537 if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
538 cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_atime);
539 if (!cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_ctime))
540 inop->inode.iso_ctime = inop->inode.iso_atime;
541 if (!cd9660_tstamp_conv17(ap->mtime,&inop->inode.iso_mtime))
542 inop->inode.iso_mtime = inop->inode.iso_ctime;
543 } else
544 ap = NULL;
545 }
546 if (!ap) {
547 cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime);
548 inop->inode.iso_atime = inop->inode.iso_ctime;
549 inop->inode.iso_mtime = inop->inode.iso_ctime;
550 }
551 if (bp2)
552 brelse(bp2);
553}
554
555int
556cd9660_tstamp_conv7(pi,pu)
557char *pi;
558struct timespec *pu;
559{
560 int crtime, days;
561 int y, m, d, hour, minute, second, tz;
562
563 y = pi[0] + 1900;
564 m = pi[1];
565 d = pi[2];
566 hour = pi[3];
567 minute = pi[4];
568 second = pi[5];
569 tz = pi[6];
570
571 if (y < 1970) {
572 pu->ts_sec = 0;
573 pu->ts_nsec = 0;
574 return 0;
575 } else {
576#ifdef ORIGINAL
577 /* computes day number relative to Sept. 19th,1989 */

--- 33 unchanged lines hidden (view full) ---

611
612int
613cd9660_tstamp_conv17(pi,pu)
614 unsigned char *pi;
615 struct timespec *pu;
616{
617 unsigned char buf[7];
618
619 /* year:"0001"-"9999" -> -1900 */
620 buf[0] = cd9660_chars2ui(pi,4) - 1900;
621
622 /* month: " 1"-"12" -> 1 - 12 */
623 buf[1] = cd9660_chars2ui(pi + 4,2);
624
625 /* day: " 1"-"31" -> 1 - 31 */
626 buf[2] = cd9660_chars2ui(pi + 6,2);
627
628 /* hour: " 0"-"23" -> 0 - 23 */
629 buf[3] = cd9660_chars2ui(pi + 8,2);
630
631 /* minute:" 0"-"59" -> 0 - 59 */
632 buf[4] = cd9660_chars2ui(pi + 10,2);
633
634 /* second:" 0"-"59" -> 0 - 59 */
635 buf[5] = cd9660_chars2ui(pi + 12,2);
636
637 /* difference of GMT */
638 buf[6] = pi[16];
639
640 return cd9660_tstamp_conv7(buf,pu);
641}
642
643void
644isodirino(inump,isodir,imp)
645 ino_t *inump;
646 struct iso_directory_record *isodir;
647 struct iso_mnt *imp;
648{
649 *inump = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length))
650 * imp->logical_block_size;
651}