1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
10 #include "puffs_priv.h"
13 /*===========================================================================*
15 *===========================================================================*/
18 /* Somebody has used an illegal system call number */
19 lpuffs_debug("no_sys: invalid call %d\n", req_nr
);
24 /*===========================================================================*
26 *===========================================================================*/
27 void mfs_nul_f(const char *file
, int line
, char *str
, unsigned int len
,
30 if (len
< maxlen
&& str
[len
-1] != '\0') {
31 lpuffs_debug("%s:%d string (length %d,maxlen %d) not null-terminated\n",
32 file
, line
, len
, maxlen
);
37 /*===========================================================================*
39 *===========================================================================*/
42 /* This routine returns the time in seconds since 1.1.1970. MINIX is an
43 * astrophysically naive system that assumes the earth rotates at a constant
44 * rate and that such things as leap seconds do not exist.
51 if ((k
=getuptime2(&uptime
, &boottime
)) != OK
)
52 panic("clock_time: getuptme2 failed: %d", k
);
54 return( (time_t) (boottime
+ (uptime
/sys_hz())));
58 /*===========================================================================*
60 *===========================================================================*/
61 int update_times(struct puffs_node
*pn
, int flags
, time_t t
)
66 PUFFS_MAKECRED(pcr
, &global_kcred
);
71 if (global_pu
->pu_ops
.puffs_node_setattr
== NULL
)
74 new_time
= t
!= 0 ? t
: clock_time();
76 puffs_vattr_null(&va
);
77 /* librefuse modifies atime and mtime together,
78 * so set old values to avoid setting either one
79 * to PUFFS_VNOVAL (set by puffs_vattr_null).
81 va
.va_atime
.tv_sec
= pn
->pn_va
.va_atime
.tv_sec
;
82 va
.va_mtime
.tv_sec
= pn
->pn_va
.va_mtime
.tv_sec
;
85 va
.va_atime
.tv_sec
= new_time
;
86 va
.va_atime
.tv_nsec
= 0;
89 va
.va_mtime
.tv_sec
= new_time
;
90 va
.va_mtime
.tv_nsec
= 0;
93 va
.va_ctime
.tv_sec
= new_time
;
94 va
.va_ctime
.tv_nsec
= 0;
97 r
= global_pu
->pu_ops
.puffs_node_setattr(global_pu
, pn
, &va
, pcr
);
103 /*===========================================================================*
105 *===========================================================================*/
106 void lpuffs_debug(const char *format
, ...)
110 va_start (args
, format
);
111 vsprintf (buffer
,format
, args
);
112 printf("%s: %s", fs_name
, buffer
);