diff options
author | Chris Johns <chrisj@rtems.org> | 2010-03-04 06:36:51 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2010-03-04 06:36:51 +0000 |
commit | 8ec7abb551a23bdf47509189145885a364810006 (patch) | |
tree | 7b5fa486b93583479b97f05a51c7370dd0c2d69f /cpukit/libfs/src/dosfs/msdos_create.c | |
parent | This commit was generated by cvs2svn to compensate for changes in r22694, (diff) | |
download | rtems-8ec7abb551a23bdf47509189145885a364810006.tar.bz2 |
010-03-04 Chris Johns <chrisj@rtems.org>
* libcsupport/include/rtems/libio.h, libcsupport/src/_rename_r.c:
Add a rename file op and have rename use it.
* libfs/Makefile.am, libfs/src/dosfs/msdos_rename.c,
libfs/src/imfs/imfs_rename.c: New files to support the rename file
op.
* libfs/src/imfs/imfs.h: Add rename interface.
* libfs/src/imfs/imfs_init.c: Add rename handler.
* libfs/src/imfs/miniimfs_init.c: Fix up ops struct.
* libfs/src/dosfs/msdos.h: Add msdos_rename and remove
msdos_file_link.
* libfs/src/dosfs/msdos_create.c: Remove the link call.
* libfs/src/dosfs/msdos_eval.c: Fix a path parsing bug.
* libfs/src/dosfs/msdos_init.c: Add rename handler and clean up
the struct naming.
* libfs/src/rfs/rtems-rfs-link.c, libfs/src/rfs/rtems-rfs-link.h:
Change the link call to allow linking of directories if told to
and change the unlink to handle unlink directories that are not
empty so rename can be supported.
* libfs/src/rfs/rtems-rfs-rtems-dir.c: Fix the link/unlink calls.
* libfs/src/rfs/rtems-rfs-rtems.c: Add a rename handler. Fix the
link/unlink calls.
* libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_format.c,
libfs/src/dosfs/msdos_misc.c, httpd/asp.c,
libfs/src/nfsclient/src/nfs.c: Work around a newlib warning when
using the is*() family of calls.
Diffstat (limited to 'cpukit/libfs/src/dosfs/msdos_create.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_create.c | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_create.c b/cpukit/libfs/src/dosfs/msdos_create.c index a9d8dbaac3..bab4a63fa8 100644 --- a/cpukit/libfs/src/dosfs/msdos_create.c +++ b/cpukit/libfs/src/dosfs/msdos_create.c @@ -267,88 +267,3 @@ err: msdos_set_first_char4file_name(parent_loc->mt_entry, &dir_pos, 0xE5); return rc; } - -/* msdos_file_link -- - * Replacement for a file "link" operation. - * MSDOS FAT FS does not support links, but this call is needed to - * allow "rename" operations. The current NEWLIB rename performs a link - * from the old to the new name and then deletes the old filename. - * - * This pseudo-"link" operation will create a new directory entry, - * copy the file size and cluster information from the "old" - * to the "new" directory entry and then clear the file size and cluster - * info from the "old" filename, leaving this file as - * a valid, but empty entry. - * - * When this "link" call is part of a "rename" sequence, the "old" - * entry will be deleted in a subsequent "rmnod" call - * - * This function has been implemented by Thomas Doerfler, - * <Thomas.Doerfler@imd-systems.de> - * - * PARAMETERS: - * to_loc - node description for "existing" node - * par_loc - node description for "new" node - * token - name of new node - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set appropriately) - */ -int -msdos_file_link(rtems_filesystem_location_info_t *to_loc, - rtems_filesystem_location_info_t *par_loc, - const char *name -) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = to_loc->mt_entry->fs_info; - fat_file_fd_t *to_fat_fd = to_loc->node_access; - const char *token; - int len; - - /* - * check spelling and format new node name - */ - if (MSDOS_NAME != msdos_get_token(name, strlen(name), &token, &len)) { - rtems_set_errno_and_return_minus_one(ENAMETOOLONG); - } - /* - * verify, that the existing node can be linked to - * check that nodes are in same FS/volume? - */ - if (to_loc->mt_entry->fs_info != par_loc->mt_entry->fs_info) { - rtems_set_errno_and_return_minus_one(EXDEV); - } - /* - * lock volume - */ - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); - - - /* - * create new directory entry as "hard link", - * copying relevant info from existing file - */ - rc = msdos_creat_node(par_loc,MSDOS_HARD_LINK,name,len,S_IFREG, - to_loc->node_access); - /* - * set file size and first cluster number of old entry to 0 - */ - if (rc == RC_OK) { - to_fat_fd->fat_file_size = 0; - to_fat_fd->cln = FAT_EOF; - rc = msdos_set_first_cluster_num(to_loc->mt_entry, to_fat_fd); - if (rc == RC_OK) { - rc = msdos_set_file_size(par_loc->mt_entry, to_fat_fd); - } - } - /* - * FIXME: check error/abort handling - */ - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} |