source: rtems/cpukit/libfs/src/dosfs/msdos_rename.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.5 KB
Line 
1/*
2 * Routine to rename a MSDOS filesystem node
3 *
4 * Copyright (C) 2010 Chris Johns <chrisj@rtems.org>
5 *
6 * The license and distribution terms for this file may be
7 * found in the file LICENSE in this distribution or at
8 * http://www.rtems.com/license/LICENSE.
9 *
10 */
11#if HAVE_CONFIG_H
12#include "config.h"
13#endif
14
15#include <errno.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include <rtems/libio_.h>
20#include <time.h>
21
22#include "fat.h"
23#include "fat_fat_operations.h"
24#include "fat_file.h"
25
26#include "msdos.h"
27
28/* msdos_rename --
29 *     Rename the node by removing the exitsing directory entry and creating a
30 *     new one.
31 */
32int
33msdos_rename(
34    const rtems_filesystem_location_info_t *old_parent_loc,
35    const rtems_filesystem_location_info_t *old_loc,
36    const rtems_filesystem_location_info_t *new_parent_loc,
37    const char *new_name,
38    size_t new_namelen
39)
40{
41    int                rc = RC_OK;
42    fat_file_fd_t     *old_fat_fd  = old_loc->node_access;
43
44    /*
45     * create new directory entry as "hard link", copying relevant info from
46     * existing file
47     */
48    rc = msdos_creat_node(new_parent_loc,
49                          MSDOS_HARD_LINK,new_name,new_namelen,S_IFREG,
50                          old_fat_fd);
51    if (rc != RC_OK)
52    {
53        return rc;
54    }
55
56    /*
57     * mark file removed
58     */
59    rc = msdos_set_first_char4file_name(old_loc->mt_entry,
60                                        &old_fat_fd->dir_pos,
61                                        MSDOS_THIS_DIR_ENTRY_EMPTY);
62
63    return rc;
64}
Note: See TracBrowser for help on using the repository browser.