source: rtems/cpukit/libcsupport/include/rtems/libio_.h @ b6657c39

4.115
Last change on this file since b6657c39 was b6657c39, checked in by Sebastian Huber <sebastian.huber@…>, on 09/11/13 at 08:34:02

Filesystem: Add and use rtems_filesystem_chmod()

Implement POSIX requirements in the high-level file system layer.

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