1 /* This file contains various utility functions.
3 * The entry points into this file are:
4 * get_name retrieve a path component string from VFS
5 * do_noop handle file system calls that do nothing and succeed
6 * no_sys handle file system calls that are not implemented
9 * April 2009 (D.C. van Moolenbroek)
14 /*===========================================================================*
16 *===========================================================================*/
17 int get_name(grant
, len
, name
)
18 cp_grant_id_t grant
; /* memory grant for the path component */
19 size_t len
; /* length of the name, including '\0' */
20 char name
[NAME_MAX
+1]; /* buffer in which store the result */
22 /* Retrieve a path component from the caller, using a given grant.
26 /* Copy in the name of the directory entry. */
27 if (len
<= 1) return EINVAL
;
28 if (len
> NAME_MAX
+1) return ENAMETOOLONG
;
30 r
= sys_safecopyfrom(m_in
.m_source
, grant
, 0, (vir_bytes
) name
, len
);
32 if (r
!= OK
) return r
;
34 if (name
[len
-1] != 0) {
35 printf("%s: VFS did not zero-terminate path component!\n", sffs_name
);
43 /*===========================================================================*
45 *===========================================================================*/
48 /* Generic handler for no-op system calls.
54 /*===========================================================================*
56 *===========================================================================*/
59 /* Generic handler for unimplemented system calls.