]> git.ozlabs.org Git - yaboot.git/blob - second/iso_util.c
Remove some DEBUG code.
[yaboot.git] / second / iso_util.c
1 /*
2  *  linux/fs/isofs/util.c
3  *
4  *  The special functions in the file are numbered according to the section
5  *  of the iso 9660 standard in which they are described.  isonum_733 will
6  *  convert numbers according to section 7.3.3, etc.
7  *
8  *  isofs special functions.  This file was lifted in its entirety from
9  *  the 386BSD iso9660 filesystem, by Pace Willisson <pace@blitz.com>.
10  */
11
12 int
13 isonum_711 (char * p)
14 {
15      return (*p & 0xff);
16 }
17
18 int
19 isonum_712 (char * p)
20 {
21      int val;
22
23      val = *p;
24      if (val & 0x80)
25           val |= 0xffffff00;
26      return (val);
27 }
28
29 int
30 isonum_721 (char * p)
31 {
32      return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
33 }
34
35 int
36 isonum_722 (char * p)
37 {
38      return (((p[0] & 0xff) << 8) | (p[1] & 0xff));
39 }
40
41 int
42 isonum_723 (char * p)
43 {
44 #if 0
45      if (p[0] != p[3] || p[1] != p[2]) {
46           fprintf (stderr, "invalid format 7.2.3 number\n");
47           exit (1);
48      }
49 #endif
50      return (isonum_721 (p));
51 }
52
53 int
54 isonum_731 (char * p)
55 {
56      return ((p[0] & 0xff)
57              | ((p[1] & 0xff) << 8)
58              | ((p[2] & 0xff) << 16)
59              | ((p[3] & 0xff) << 24));
60 }
61
62 int
63 isonum_732 (char * p)
64 {
65      return (((p[0] & 0xff) << 24)
66              | ((p[1] & 0xff) << 16)
67              | ((p[2] & 0xff) << 8)
68              | (p[3] & 0xff));
69 }
70
71 int
72 isonum_733 (char * p)
73 {
74 #if 0
75      int i;
76
77      for (i = 0; i < 4; i++) {
78           if (p[i] != p[7-i]) {
79                fprintf (stderr, "bad format 7.3.3 number\n");
80                exit (1);
81           }
82      }
83 #endif
84      return (isonum_731 (p));
85 }
86
87 /*
88  * Local variables:
89  * c-file-style: "k&r"
90  * c-basic-offset: 8
91  * End:
92  */