Remove building with NOCRYPTO option
[minix.git] / minix / lib / libpuffs / utility.c
blob4c0a6bad8be1a61bbdcbec107fb5ef3d00e71210
1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
3 */
5 #include "fs.h"
7 #include <stdarg.h>
9 /*
10 * Match by inode number in a puffs_pn_nodewalk call. This should not exist.
12 void *
13 find_inode_cb(struct puffs_usermount * __unused pu, struct puffs_node * pn,
14 void * arg)
17 if (pn->pn_va.va_fileid == *(ino_t *)arg)
18 return pn;
19 else
20 return NULL;
23 /*===========================================================================*
24 * update_timens *
25 *===========================================================================*/
26 int update_timens(struct puffs_node *pn, int flags, struct timespec *t)
28 int r;
29 struct vattr va;
30 struct timespec new_time;
31 PUFFS_MAKECRED(pcr, &global_kcred);
33 if (!flags)
34 return 0;
36 if (global_pu->pu_ops.puffs_node_setattr == NULL)
37 return EINVAL;
39 if (t != NULL)
40 new_time = *t;
41 else
42 (void)clock_time(&new_time);
44 puffs_vattr_null(&va);
45 /* librefuse modifies atime and mtime together,
46 * so set old values to avoid setting either one
47 * to PUFFS_VNOVAL (set by puffs_vattr_null).
49 va.va_atime = pn->pn_va.va_atime;
50 va.va_mtime = pn->pn_va.va_mtime;
52 if (flags & ATIME)
53 va.va_atime = new_time;
54 if (flags & MTIME)
55 va.va_mtime = new_time;
56 if (flags & CTIME)
57 va.va_ctime = new_time;
59 r = global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr);
61 return(r);
65 /*===========================================================================*
66 * lpuffs_debug *
67 *===========================================================================*/
68 void lpuffs_debug(const char *format, ...)
70 char buffer[256];
71 va_list args;
72 va_start (args, format);
73 vsprintf (buffer,format, args);
74 printf("%s: %s", fs_name, buffer);
75 va_end (args);