Changeset 14c331a in mainline


Ignore:
Timestamp:
2008-11-25T12:14:31Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46321fb
Parents:
49df572
Message:

Consider "prd" and "prd." to be the same FAT dentry names.

Location:
uspace/srv/fs/fat
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_dentry.c

    r49df572 r14c331a  
    3838#include "fat_dentry.h"
    3939#include <ctype.h>
     40#include <string.h>
    4041
    4142#define FAT_PAD                 ' '
     
    5253        else
    5354                return false;
     55}
     56
     57/** Compare path component with the name read from the dentry.
     58 *
     59 * This function compares the path component with the name read from the dentry.
     60 * The comparison is case insensitive and tolerates a mismatch on the trailing
     61 * dot character at the end of the name (i.e. when there is a dot, but no
     62 * extension).
     63 *
     64 * @param name          Node name read from the dentry.
     65 * @param component     Path component.
     66 *
     67 * @return              Zero on match, non-zero otherwise.
     68 */
     69int fat_dentry_namecmp(char *name, const char *component)
     70{
     71        int rc;
     72        if (!(rc = stricmp(name, component)))
     73                return rc;
     74        if (!strchr(name, '.')) {
     75                /*
     76                 * There is no '.' in the name, so we know that there is enough
     77                 * space for appending an extra '.' to name.
     78                 */
     79                name[strlen(name)] = '.';
     80                name[strlen(name) + 1] = '\0';
     81                rc = stricmp(name, component);
     82        }
     83        return rc;
    5484}
    5585
  • uspace/srv/fs/fat/fat_dentry.h

    r49df572 r14c331a  
    7373} __attribute__ ((packed)) fat_dentry_t;
    7474
     75extern int fat_dentry_namecmp(char *, const char *);
    7576extern bool fat_dentry_name_verify(const char *);
    7677extern void fat_dentry_name_get(const fat_dentry_t *, char *);
  • uspace/srv/fs/fat/fat_ops.c

    r49df572 r14c331a  
    517517                                break;
    518518                        }
    519                         if (stricmp(name, component) == 0) {
     519                        if (fat_dentry_namecmp(name, component) == 0) {
    520520                                /* hit */
    521521                                void *node;
Note: See TracChangeset for help on using the changeset viewer.