source: rtems/cpukit/libfs/src/dosfs/msdos_rmnod.c @ 53da07e

4.115
Last change on this file since 53da07e was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  MSDOS directory handlers implementation
3 *
4 *  Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
5 *  Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13  #include "config.h"
14#endif
15
16#include "msdos.h"
17
18int
19msdos_rmnod(const rtems_filesystem_location_info_t *parent_pathloc,
20            const rtems_filesystem_location_info_t *pathloc)
21{
22    int                rc = RC_OK;
23    fat_file_fd_t     *fat_fd = pathloc->node_access;
24
25    if (fat_fd->fat_file_type == MSDOS_DIRECTORY)
26    {
27        bool is_empty = false;
28
29        /*
30         * You cannot remove a node that still has children
31         */
32        rc = msdos_dir_is_empty(pathloc->mt_entry, fat_fd, &is_empty);
33        if (rc != RC_OK)
34        {
35            return rc;
36        }
37
38        if (!is_empty)
39        {
40            rtems_set_errno_and_return_minus_one(ENOTEMPTY);
41        }
42
43        /*
44         * We deny attempts to delete open directory (if directory is current
45         * directory we assume it is open one)
46         */
47        if (fat_fd->links_num > 1)
48        {
49            rtems_set_errno_and_return_minus_one(EBUSY);
50        }
51
52        /*
53         * You cannot remove the file system root node.
54         */
55        if (rtems_filesystem_location_is_root(pathloc))
56        {
57            rtems_set_errno_and_return_minus_one(EBUSY);
58        }
59
60        /*
61         * You cannot remove a mountpoint.
62         * not used - mount() not implemenetd yet.
63         */
64    }
65
66    /* mark file removed */
67    rc = msdos_set_first_char4file_name(pathloc->mt_entry, &fat_fd->dir_pos,
68                                        MSDOS_THIS_DIR_ENTRY_EMPTY);
69    if (rc != RC_OK)
70    {
71        return rc;
72    }
73
74    fat_file_mark_removed(pathloc->mt_entry, fat_fd);
75
76    return rc;
77}
Note: See TracBrowser for help on using the repository browser.