source: rtems/cpukit/libcsupport/src/chown.c @ da154e14

4.11
Last change on this file since da154e14 was da154e14, checked in by Sebastian Huber <sebastian.huber@…>, on May 14, 2012 at 2:55:41 PM

Filesystem: Move operations to mount table entry

The scope of the file system operations is the file system instance.
The scope of the file system node handlers is the file location. The
benefit of moving the operations to the mount table entry is a size
reduction of the file location (rtems_filesystem_location_info_t). The
code size is slightly increased due to additional load instructions.

Restructure rtems_filesystem_mount_table_entry_t to improve cache
efficiency.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  chown() - POSIX 1003.1b 5.6.5 - Change Owner and Group of a File
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  Modifications to support reference counting in the file system are
8 *  Copyright (c) 2012 embedded brains GmbH.
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include <unistd.h>
20
21#include <rtems/libio_.h>
22
23int rtems_filesystem_chown(
24  const char *path,
25  uid_t owner,
26  gid_t group,
27  int eval_follow_link
28)
29{
30  int rv = 0;
31  rtems_filesystem_eval_path_context_t ctx;
32  int eval_flags = eval_follow_link;
33  const rtems_filesystem_location_info_t *currentloc =
34    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
35  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
36
37  rv = (*ops->chown_h)( currentloc, owner, group );
38
39  rtems_filesystem_eval_path_cleanup( &ctx );
40
41  return rv;
42}
43
44int chown( const char *path, uid_t owner, gid_t group )
45{
46  return rtems_filesystem_chown( path, owner, group, RTEMS_FS_FOLLOW_LINK );
47}
Note: See TracBrowser for help on using the repository browser.