source: rtems/cpukit/libcsupport/include/rtems/libio_.h @ 183af89

4.11
Last change on this file since 183af89 was 3b7c123, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 13, 2012 at 10:33:51 AM

Filesystem: Reference counting for locations

o A new data structure rtems_filesystem_global_location_t was

introduced to be used for

o the mount point location in the mount table entry,
o the file system root location in the mount table entry,
o the root directory location in the user environment, and
o the current directory location in the user environment.

During the path evaluation global start locations are obtained to
ensure that the current file system instance will be not unmounted in
the meantime.

o The user environment uses now reference counting and is protected

from concurrent access.

o The path evaluation process was completely rewritten and simplified.

The IMFS, RFS, NFS, and DOSFS use now a generic path evaluation
method. Recursive calls in the path evaluation have been replaced
with iteration to avoid stack overflows. Only the evaluation of
symbolic links is recursive. No dynamic memory allocations and
intermediate buffers are used in the high level path evaluation. No
global locks are held during the file system instance specific path
evaluation process.

o Recursive symbolic link evaluation is now limited by

RTEMS_FILESYSTEM_SYMLOOP_MAX. Applications can retrieve this value
via sysconf().

o The device file system (devFS) uses now no global variables and

allocation from the workspace. Node names are allocated from the
heap.

o The upper layer lseek() performs now some parameter checks.
o The upper layer ftruncate() performs now some parameter checks.
o unmask() is now restricted to the RWX flags and protected from

concurrent access.

o The fchmod_h and rmnod_h file system node handlers are now a file

system operation.

o The unlink_h operation has been removed. All nodes are now destroyed

with the rmnod_h operation.

o New lock_h, unlock_h, clonenod_h, and are_nodes_equal_h file system

operations.

o The path evaluation and file system operations are now protected by

per file system instance lock and unlock operations.

o Fix and test file descriptor duplicate in fcntl().
o New test fstests/fsnofs01.

  • Property mode set to 100644
File size: 20.0 KB
Line 
1/**
2 * @file rtems/libio_.h
3 *
4 * This file is the libio internal interface.
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  Modifications to support reference counting in the file system are
12 *  Copyright (c) 2012 embedded brains GmbH.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#ifndef _RTEMS_RTEMS_LIBIO__H
22#define _RTEMS_RTEMS_LIBIO__H
23
24#include <errno.h>
25
26#include <rtems.h>
27#include <rtems/libio.h>
28#include <rtems/seterr.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#define RTEMS_FILESYSTEM_SYMLOOP_MAX 32
35
36/*
37 *  Semaphore to protect the io table
38 */
39
40#define RTEMS_LIBIO_SEM         rtems_build_name('L', 'B', 'I', 'O')
41#define RTEMS_LIBIO_IOP_SEM(n)  rtems_build_name('L', 'B', 'I', n)
42
43extern rtems_id                          rtems_libio_semaphore;
44
45/*
46 *  File descriptor Table Information
47 */
48
49extern uint32_t        rtems_libio_number_iops;
50extern rtems_libio_t  *rtems_libio_iops;
51extern rtems_libio_t  *rtems_libio_last_iop;
52extern rtems_libio_t *rtems_libio_iop_freelist;
53
54extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
55
56extern rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry;
57
58/**
59 * @brief The global null location.
60 *
61 * Every operation and the open and fstat handlers of this location returns an
62 * error status.  The errno is not touched by these operations and handlers.
63 * The purpose of this location is to deliver the error return status for a
64 * previous error condition which must set the errno accordingly.
65 *
66 * The usage of this null location instead of the NULL pointer eliminates a lot
67 * of branches.
68 *
69 * The user environment root and current directory are statically initialized
70 * with the null location.  Due to that all file system services are in a
71 * defined state even if no root file system was mounted.
72 */
73extern rtems_filesystem_global_location_t rtems_filesystem_global_location_null;
74
75/*
76 *  rtems_libio_iop
77 *
78 *  Macro to return the file descriptor pointer.
79 */
80
81#define rtems_libio_iop(_fd) \
82  ((((uint32_t)(_fd)) < rtems_libio_number_iops) ? \
83         &rtems_libio_iops[_fd] : 0)
84
85/*
86 *  rtems_libio_iop_to_descriptor
87 *
88 *  Macro to convert an internal file descriptor pointer (iop) into
89 *  the integer file descriptor used by the "section 2" system calls.
90 */
91
92#define rtems_libio_iop_to_descriptor(_iop) \
93   ((!(_iop)) ? -1 : (_iop - rtems_libio_iops))
94
95/*
96 *  rtems_libio_check_is_open
97 *
98 *  Macro to check if a file descriptor is actually open.
99 */
100
101#define rtems_libio_check_is_open(_iop) \
102  do {                                               \
103      if (((_iop)->flags & LIBIO_FLAGS_OPEN) == 0) { \
104          errno = EBADF;                             \
105          return -1;                                 \
106      }                                              \
107  } while (0)
108
109/*
110 *  rtems_libio_check_fd
111 *
112 *  Macro to check if a file descriptor number is valid.
113 */
114
115#define rtems_libio_check_fd(_fd) \
116  do {                                                     \
117      if ((uint32_t) (_fd) >= rtems_libio_number_iops) {   \
118          errno = EBADF;                                   \
119          return -1;                                       \
120      }                                                    \
121  } while (0)
122
123/*
124 *  rtems_libio_check_buffer
125 *
126 *  Macro to check if a buffer pointer is valid.
127 */
128
129#define rtems_libio_check_buffer(_buffer) \
130  do {                                    \
131      if ((_buffer) == 0) {               \
132          errno = EINVAL;                 \
133          return -1;                      \
134      }                                   \
135  } while (0)
136
137/*
138 *  rtems_libio_check_count
139 *
140 *  Macro to check if a count or length is valid.
141 */
142
143#define rtems_libio_check_count(_count) \
144  do {                                  \
145      if ((_count) == 0) {              \
146          return 0;                     \
147      }                                 \
148  } while (0)
149
150/*
151 *  rtems_libio_check_permissions_with_error
152 *
153 *  Macro to check if a file descriptor is open for this operation.
154 *  On failure, return the user specified error.
155 */
156
157#define rtems_libio_check_permissions_with_error(_iop, _flag, _errno) \
158  do {                                                      \
159      if (((_iop)->flags & (_flag)) == 0) {                 \
160            rtems_set_errno_and_return_minus_one( _errno ); \
161            return -1;                                      \
162      }                                                     \
163  } while (0)
164
165/*
166 *  rtems_libio_check_permissions
167 *
168 *  Macro to check if a file descriptor is open for this operation.
169 *  On failure, return EINVAL
170 */
171
172#define rtems_libio_check_permissions(_iop, _flag) \
173   rtems_libio_check_permissions_with_error(_iop, _flag, EINVAL )
174
175/**
176 * @brief Clones a node.
177 *
178 * The caller must hold the file system instance lock.
179 *
180 * @param[out] clone The cloned location.
181 * @param[in] master The master location.
182 *
183 * @see rtems_filesystem_instance_lock().
184 */
185void rtems_filesystem_location_clone(
186  rtems_filesystem_location_info_t *clone,
187  const rtems_filesystem_location_info_t *master
188);
189
190/**
191 * @brief Returns the type of a node.
192 *
193 * This function obtains and releases the file system instance lock.
194 *
195 * @param[in] loc The location of the node.
196 *
197 * @return The node type.
198 *
199 * @see rtems_filesystem_instance_lock().
200 */
201rtems_filesystem_node_types_t rtems_filesystem_node_type(
202  const rtems_filesystem_location_info_t *loc
203);
204
205/**
206 * @brief Releases all resources of a location.
207 *
208 * This function may block on a mutex and may complete an unmount process.
209 *
210 * @param[in] loc The location to free.
211 *
212 * @note The file system root location is released by the file system instance
213 * destruction handler (see @ref rtems_filesystem_fsunmount_me_t).
214 *
215 * @see rtems_filesystem_freenode_t.
216 */
217void rtems_filesystem_location_free( rtems_filesystem_location_info_t *loc );
218
219/*
220 *  External structures
221 */
222#include <rtems/userenv.h>
223
224static inline void rtems_libio_lock( void )
225{
226  rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
227}
228
229static inline void rtems_libio_unlock( void )
230{
231  rtems_semaphore_release( rtems_libio_semaphore );
232}
233
234static inline void rtems_filesystem_mt_lock( void )
235{
236  rtems_libio_lock();
237}
238
239static inline void rtems_filesystem_mt_unlock( void )
240{
241  rtems_libio_unlock();
242}
243
244#define rtems_filesystem_mt_entry_declare_lock_context( ctx ) \
245  rtems_interrupt_level ctx
246
247#define rtems_filesystem_mt_entry_lock( ctx ) rtems_interrupt_disable( ctx )
248
249#define rtems_filesystem_mt_entry_unlock( ctx ) rtems_interrupt_enable( ctx )
250
251static inline void rtems_filesystem_instance_lock(
252  const rtems_filesystem_location_info_t *loc
253)
254{
255  (*loc->ops->lock_h)( loc->mt_entry );
256}
257
258static inline void rtems_filesystem_instance_unlock(
259  const rtems_filesystem_location_info_t *loc
260)
261{
262  (*loc->ops->unlock_h)( loc->mt_entry );
263}
264
265/*
266 *  File Descriptor Routine Prototypes
267 */
268
269rtems_libio_t *rtems_libio_allocate(void);
270
271uint32_t rtems_libio_fcntl_flags( int fcntl_flags );
272
273int rtems_libio_to_fcntl_flags( uint32_t flags );
274
275void rtems_libio_free(
276  rtems_libio_t *iop
277);
278
279/*
280 *  File System Routine Prototypes
281 */
282
283rtems_filesystem_location_info_t *
284rtems_filesystem_eval_path_start(
285  rtems_filesystem_eval_path_context_t *ctx,
286  const char *path,
287  int eval_flags
288);
289
290rtems_filesystem_location_info_t *
291rtems_filesystem_eval_path_start_with_parent(
292  rtems_filesystem_eval_path_context_t *ctx,
293  const char *path,
294  int eval_flags,
295  rtems_filesystem_location_info_t *parentloc,
296  int parent_eval_flags
297);
298
299rtems_filesystem_location_info_t *
300rtems_filesystem_eval_path_start_with_root_and_current(
301  rtems_filesystem_eval_path_context_t *ctx,
302  const char *path,
303  int eval_flags,
304  rtems_filesystem_global_location_t *const *global_root_ptr,
305  rtems_filesystem_global_location_t *const *global_current_ptr
306);
307
308void rtems_filesystem_eval_path_continue(
309  rtems_filesystem_eval_path_context_t *ctx
310);
311
312void rtems_filesystem_eval_path_cleanup(
313  rtems_filesystem_eval_path_context_t *ctx
314);
315
316void rtems_filesystem_eval_path_recursive(
317  rtems_filesystem_eval_path_context_t *ctx,
318  const char *path,
319  size_t pathlen
320);
321
322void rtems_filesystem_eval_path_cleanup_with_parent(
323  rtems_filesystem_eval_path_context_t *ctx,
324  rtems_filesystem_location_info_t *parentloc
325);
326
327/**
328 * @brief Requests a path evaluation restart.
329 *
330 * Sets the start and current location to the new start location.  The caller
331 * must terminate its current evaluation process.  The path evaluation
332 * continues in the next loop iteration within
333 * rtems_filesystem_eval_path_continue().  This avoids recursive invokations.
334 * The function obtains the new start location and clones it to set the new
335 * current location.  The previous start and current locations are released.
336 *
337 * @param[in, out] ctx The path evaluation context.
338 * @param[in, out] newstartloc_ptr Pointer to new start location.
339 */
340void rtems_filesystem_eval_path_restart(
341  rtems_filesystem_eval_path_context_t *ctx,
342  rtems_filesystem_global_location_t **newstartloc_ptr
343);
344
345typedef enum {
346  RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_CONTINUE,
347  RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_DONE,
348  RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_NO_ENTRY
349} rtems_filesystem_eval_path_generic_status;
350
351/**
352 * @brief Tests if the current location is a directory.
353 *
354 * @param[in, out] ctx The path evaluation context.
355 * @param[in, out] arg The handler argument.
356 *
357 * @retval true The current location is a directory.
358 * @retval false Otherwise.
359 *
360 * @see rtems_filesystem_eval_path_generic().
361 */
362typedef bool (*rtems_filesystem_eval_path_is_directory)(
363  rtems_filesystem_eval_path_context_t *ctx,
364  void *arg
365);
366
367/**
368 * @brief Evaluates a token.
369 *
370 * @param[in, out] ctx The path evaluation context.
371 * @param[in, out] arg The handler argument.
372 * @param[in] token The token contents.
373 * @param[in] tokenlen The token length in characters.
374 *
375 * @retval status The generic path evaluation status.
376 *
377 * @see rtems_filesystem_eval_path_generic().
378 */
379typedef rtems_filesystem_eval_path_generic_status
380(*rtems_filesystem_eval_path_eval_token)(
381  rtems_filesystem_eval_path_context_t *ctx,
382  void *arg,
383  const char *token,
384  size_t tokenlen
385);
386
387typedef struct {
388  rtems_filesystem_eval_path_is_directory is_directory;
389  rtems_filesystem_eval_path_eval_token eval_token;
390} rtems_filesystem_eval_path_generic_config;
391
392void rtems_filesystem_eval_path_generic(
393  rtems_filesystem_eval_path_context_t *ctx,
394  void *arg,
395  const rtems_filesystem_eval_path_generic_config *config
396);
397
398void rtems_filesystem_initialize(void);
399
400/**
401 * @brief Copies a location.
402 *
403 * A bitwise copy is performed.  The destination location will be added to the
404 * corresponding mount entry.
405 *
406 * @param[out] dst The destination location.
407 * @param[in] src The source location.
408 *
409 * @retval dst The destination location.
410 *
411 * @see rtems_filesystem_location_clone().
412 */
413rtems_filesystem_location_info_t *rtems_filesystem_location_copy(
414  rtems_filesystem_location_info_t *dst,
415  const rtems_filesystem_location_info_t *src
416);
417
418static inline rtems_filesystem_location_info_t *
419rtems_filesystem_location_initialize_to_null(
420  rtems_filesystem_location_info_t *loc
421)
422{
423  return rtems_filesystem_location_copy(
424    loc,
425    &rtems_filesystem_global_location_null.location
426  );
427}
428
429rtems_filesystem_global_location_t *
430rtems_filesystem_location_transform_to_global(
431  rtems_filesystem_location_info_t *loc
432);
433
434/**
435 * @brief Assigns a global file system location.
436 *
437 * @param[in, out] lhs_global_loc_ptr Pointer to the global left hand side file
438 * system location.  The current left hand side location will be released.
439 * @param[in] rhs_global_loc The global right hand side file system location.
440 */
441void rtems_filesystem_global_location_assign(
442  rtems_filesystem_global_location_t **lhs_global_loc_ptr,
443  rtems_filesystem_global_location_t *rhs_global_loc
444);
445
446/**
447 * @brief Obtains a global file system location.
448 *
449 * Deferred releases will be processed in this function.
450 *
451 * This function must be called from normal thread context and may block on a
452 * mutex.  Thread dispatching is disabled to protect some critical sections.
453 *
454 * @param[in] global_loc_ptr Pointer to the global file system location.
455 *
456 * @return A global file system location.  It returns always a valid object.
457 * In case of an error, the global null location will be returned.  Each
458 * operation or handler of the null location returns an error status.  The
459 * errno indicates the error.  The NULL pointer is never returned.
460 *
461 * @see rtems_filesystem_location_transform_to_global(),
462 * rtems_filesystem_global_location_obtain_null(), and
463 * rtems_filesystem_global_location_release().
464 */
465rtems_filesystem_global_location_t *rtems_filesystem_global_location_obtain(
466  rtems_filesystem_global_location_t *const *global_loc_ptr
467);
468
469/**
470 * @brief Releases a global file system location.
471 *
472 * In case the reference count reaches zero, all associated resources will be
473 * released.  This may include the complete unmount of the corresponding file
474 * system instance.
475 *
476 * This function may block on a mutex.  It may be called within critical
477 * sections of the operating system.  In this case the release will be
478 * deferred.  The next obtain call will do the actual release.
479 *
480 * @param[in] global_loc The global file system location.  It must not be NULL.
481 *
482 * @see rtems_filesystem_global_location_obtain().
483 */
484void rtems_filesystem_global_location_release(
485  rtems_filesystem_global_location_t *global_loc
486);
487
488void rtems_filesystem_location_detach(
489  rtems_filesystem_location_info_t *detach
490);
491
492void rtems_filesystem_location_copy_and_detach(
493  rtems_filesystem_location_info_t *copy,
494  rtems_filesystem_location_info_t *detach
495);
496
497static inline rtems_filesystem_global_location_t *
498rtems_filesystem_global_location_obtain_null(void)
499{
500  rtems_filesystem_global_location_t *global_loc = NULL;
501
502  return rtems_filesystem_global_location_obtain( &global_loc );
503}
504
505static inline bool rtems_filesystem_location_is_null(
506  const rtems_filesystem_location_info_t *loc
507)
508{
509  return loc->handlers == &rtems_filesystem_null_handlers;
510}
511
512static inline bool rtems_filesystem_global_location_is_null(
513  const rtems_filesystem_global_location_t *global_loc
514)
515{
516  return rtems_filesystem_location_is_null( &global_loc->location );
517}
518
519static inline void rtems_filesystem_location_error(
520  const rtems_filesystem_location_info_t *loc,
521  int eno
522)
523{
524  if ( !rtems_filesystem_location_is_null( loc ) ) {
525    errno = eno;
526  }
527}
528
529int rtems_filesystem_mknod(
530  const rtems_filesystem_location_info_t *parentloc,
531  const char *name,
532  size_t namelen,
533  mode_t mode,
534  dev_t dev
535);
536
537int rtems_filesystem_chdir( rtems_filesystem_location_info_t *loc );
538
539int rtems_filesystem_chown(
540  const char *path,
541  uid_t owner,
542  gid_t group,
543  int eval_follow_link
544);
545
546static inline bool rtems_filesystem_is_ready_for_unmount(
547  rtems_filesystem_mount_table_entry_t *mt_entry
548)
549{
550  bool ready = !mt_entry->mounted
551    && rtems_chain_has_only_one_node( &mt_entry->location_chain )
552    && mt_entry->mt_fs_root->reference_count == 1;
553
554  if ( ready ) {
555    rtems_chain_initialize_empty( &mt_entry->location_chain );
556  }
557
558  return ready;
559}
560
561static inline void rtems_filesystem_location_add_to_mt_entry(
562  rtems_filesystem_location_info_t *loc
563)
564{
565  rtems_filesystem_mt_entry_declare_lock_context( lock_context );
566
567  rtems_filesystem_mt_entry_lock( lock_context );
568  rtems_chain_append_unprotected(
569    &loc->mt_entry->location_chain,
570    &loc->mt_entry_node
571  );
572  rtems_filesystem_mt_entry_unlock( lock_context );
573}
574
575void rtems_filesystem_location_remove_from_mt_entry(
576  rtems_filesystem_location_info_t *loc
577);
578
579void rtems_filesystem_do_unmount(
580  rtems_filesystem_mount_table_entry_t *mt_entry
581);
582
583static inline bool rtems_filesystem_location_is_root(
584  const rtems_filesystem_location_info_t *loc
585)
586{
587  return (*loc->ops->are_nodes_equal_h)(
588    loc,
589    &loc->mt_entry->mt_fs_root->location
590  );
591}
592
593static inline const char *rtems_filesystem_eval_path_get_path(
594  rtems_filesystem_eval_path_context_t *ctx
595)
596{
597  return ctx->path;
598}
599
600static inline size_t rtems_filesystem_eval_path_get_pathlen(
601  rtems_filesystem_eval_path_context_t *ctx
602)
603{
604  return ctx->pathlen;
605}
606
607static inline void rtems_filesystem_eval_path_set_path(
608  rtems_filesystem_eval_path_context_t *ctx,
609  const char *path,
610  size_t pathlen
611)
612{
613  ctx->path = path;
614  ctx->pathlen = pathlen;
615}
616
617static inline void rtems_filesystem_eval_path_clear_path(
618  rtems_filesystem_eval_path_context_t *ctx
619)
620{
621  ctx->pathlen = 0;
622}
623
624static inline const char *rtems_filesystem_eval_path_get_token(
625  rtems_filesystem_eval_path_context_t *ctx
626)
627{
628  return ctx->token;
629}
630
631static inline size_t rtems_filesystem_eval_path_get_tokenlen(
632  rtems_filesystem_eval_path_context_t *ctx
633)
634{
635  return ctx->tokenlen;
636}
637
638static inline void rtems_filesystem_eval_path_set_token(
639  rtems_filesystem_eval_path_context_t *ctx,
640  const char *token,
641  size_t tokenlen
642)
643{
644  ctx->token = token;
645  ctx->tokenlen = tokenlen;
646}
647
648static inline void rtems_filesystem_eval_path_clear_token(
649  rtems_filesystem_eval_path_context_t *ctx
650)
651{
652  ctx->tokenlen = 0;
653}
654
655static inline void rtems_filesystem_eval_path_put_back_token(
656  rtems_filesystem_eval_path_context_t *ctx
657)
658{
659  size_t tokenlen = ctx->tokenlen;
660
661  ctx->path -= tokenlen;
662  ctx->pathlen += tokenlen;
663  ctx->tokenlen = 0;
664}
665
666void rtems_filesystem_eval_path_eat_delimiter(
667  rtems_filesystem_eval_path_context_t *ctx
668);
669
670void rtems_filesystem_eval_path_next_token(
671  rtems_filesystem_eval_path_context_t *ctx
672);
673
674static inline void rtems_filesystem_eval_path_get_next_token(
675  rtems_filesystem_eval_path_context_t *ctx,
676  const char **token,
677  size_t *tokenlen
678)
679{
680  rtems_filesystem_eval_path_next_token(ctx);
681  *token = ctx->token;
682  *tokenlen = ctx->tokenlen;
683}
684
685static inline rtems_filesystem_location_info_t *
686rtems_filesystem_eval_path_get_currentloc(
687  rtems_filesystem_eval_path_context_t *ctx
688)
689{
690  return &ctx->currentloc;
691}
692
693static inline bool rtems_filesystem_eval_path_has_path(
694  const rtems_filesystem_eval_path_context_t *ctx
695)
696{
697  return ctx->pathlen > 0;
698}
699
700static inline bool rtems_filesystem_eval_path_has_token(
701  const rtems_filesystem_eval_path_context_t *ctx
702)
703{
704  return ctx->tokenlen > 0;
705}
706
707static inline int rtems_filesystem_eval_path_get_flags(
708  const rtems_filesystem_eval_path_context_t *ctx
709)
710{
711  return ctx->flags;
712}
713
714static inline void rtems_filesystem_eval_path_set_flags(
715  rtems_filesystem_eval_path_context_t *ctx,
716  int flags
717)
718{
719  ctx->flags = flags;
720}
721
722static inline void rtems_filesystem_eval_path_clear_and_set_flags(
723  rtems_filesystem_eval_path_context_t *ctx,
724  int clear,
725  int set
726)
727{
728  int flags = ctx->flags;
729
730  flags &= ~clear;
731  flags |= set;
732
733  ctx->flags = flags;
734}
735
736static inline void rtems_filesystem_eval_path_extract_currentloc(
737  rtems_filesystem_eval_path_context_t *ctx,
738  rtems_filesystem_location_info_t *get
739)
740{
741  rtems_filesystem_location_copy_and_detach(
742    get,
743    &ctx->currentloc
744  );
745}
746
747void rtems_filesystem_eval_path_error(
748  rtems_filesystem_eval_path_context_t *ctx,
749  int eno
750);
751
752/**
753 * @brief Checks that the locations exist in the same file system instance.
754 *
755 * @retval 0 The locations exist and are in the same file system instance.
756 * @retval -1 An error occured.  The @c errno indicates the error.
757 */
758int rtems_filesystem_location_exists_in_same_fs_instance_as(
759  const rtems_filesystem_location_info_t *a,
760  const rtems_filesystem_location_info_t *b
761);
762
763bool rtems_filesystem_check_access(
764  int eval_flags,
765  mode_t node_mode,
766  uid_t node_uid,
767  gid_t node_gid
768);
769
770bool rtems_filesystem_eval_path_check_access(
771  rtems_filesystem_eval_path_context_t *ctx,
772  int eval_flags,
773  mode_t node_mode,
774  uid_t node_uid,
775  gid_t node_gid
776);
777
778static inline bool rtems_filesystem_is_delimiter(char c)
779{
780  return c == '/' || c == '\\';
781}
782
783static inline bool rtems_filesystem_is_current_directory(
784  const char *token,
785  size_t tokenlen
786)
787{
788  return tokenlen == 1 && token [0] == '.';
789}
790
791static inline bool rtems_filesystem_is_parent_directory(
792  const char *token,
793  size_t tokenlen
794)
795{
796  return tokenlen == 2 && token [0] == '.' && token [1] == '.';
797}
798
799#ifdef __cplusplus
800}
801#endif
802
803#endif
804/* end of include file */
Note: See TracBrowser for help on using the repository browser.