7 /*===========================================================================*
9 *===========================================================================*/
12 /* Somebody has used an illegal system call number */
13 printf("no_sys: invalid call %d\n", req_nr
);
18 /*===========================================================================*
20 *===========================================================================*/
21 unsigned conv2(norm
, w
)
22 int norm
; /* TRUE if no swap, FALSE for byte swap */
23 int w
; /* promotion of 16-bit word to be swapped */
25 /* Possibly swap a 16-bit word between 8086 and 68000 byte order. */
26 if (norm
) return( (unsigned) w
& 0xFFFF);
27 return( ((w
&BYTE
) << 8) | ( (w
>>8) & BYTE
));
31 /*===========================================================================*
33 *===========================================================================*/
35 int norm
; /* TRUE if no swap, FALSE for byte swap */
36 long x
; /* 32-bit long to be byte swapped */
38 /* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
42 if (norm
) return(x
); /* byte order was already ok */
43 lo
= conv2(FALSE
, (int) x
& 0xFFFF); /* low-order half, byte swapped */
44 hi
= conv2(FALSE
, (int) (x
>>16) & 0xFFFF); /* high-order half, swapped */
45 l
= ( (long) lo
<<16) | hi
;
50 /*===========================================================================*
52 *===========================================================================*/
55 /* This routine returns the time in seconds since 1.1.1970. MINIX is an
56 * astrophysically naive system that assumes the earth rotates at a constant
57 * rate and that such things as leap seconds do not exist.
64 if ( (k
=getuptime2(&uptime
, &boottime
)) != OK
)
65 panic("clock_time: getuptme2 failed: %d", k
);
67 return( (time_t) (boottime
+ (uptime
/sys_hz())));
71 /*===========================================================================*
73 *===========================================================================*/
74 int min(unsigned int l
, unsigned int r
)
82 /*===========================================================================*
84 *===========================================================================*/
85 void mfs_nul_f(char *file
, int line
, char *str
, unsigned int len
,
88 if(len
< maxlen
&& str
[len
-1] != '\0') {
89 printf("MFS %s:%d string (length %d, maxlen %d) not null-terminated\n",
90 file
, line
, len
, maxlen
);
94 #define MYASSERT(c) if(!(c)) { printf("MFS:%s:%d: sanity check: %s failed\n", \
95 file, line, #c); panic("sanity check " #c " failed: %d", __LINE__); }
98 /*===========================================================================*
100 *===========================================================================*/
101 void sanitycheck(char *file
, int line
)
103 MYASSERT(SELF_E
> 0);
104 if(superblock
.s_dev
!= NO_DEV
) {
105 MYASSERT(superblock
.s_dev
== fs_dev
);
106 MYASSERT(superblock
.s_block_size
== lmfs_fs_block_size());
108 MYASSERT(_MIN_BLOCK_SIZE
== lmfs_fs_block_size());