[PATCH 2/2] ntdll: Check for case-insensitive volumes. (try 6 resend)

Alexandre Julliard julliard at winehq.org
Tue Dec 14 05:03:04 CST 2010


Charles Davis <cdavis at mymail.mines.edu> writes:

> +#if defined(HAVE_GETATTRLIST) && defined(ATTR_VOL_CAPABILITIES) && \
> +    defined(VOL_CAPABILITIES_FORMAT) && defined(VOL_CAP_FMT_CASE_SENSITIVE)
> +    char *mntpoint = NULL;
> +    struct attrlist attr;
> +    struct vol_caps caps;
> +    struct get_fsid get_fsid;
> +    struct fs_cache *entry;
> +
> +    /* First get the FS ID of the volume */
> +    attr.bitmapcount = ATTR_BIT_MAP_COUNT;
> +    attr.reserved = 0;
> +    attr.commonattr = ATTR_CMN_DEVID|ATTR_CMN_FSID;
> +    attr.volattr = attr.dirattr = attr.fileattr = attr.forkattr = 0;
> +    get_fsid.size = 0;
> +    if (getattrlist( dir, &attr, &get_fsid, sizeof(get_fsid), 0 ) != 0 ||
> +        get_fsid.size != sizeof(get_fsid))
> +        return TRUE;
> +    /* Try to look it up in the cache */
> +    entry = look_up_fs_cache( get_fsid.dev );
> +    if (entry && !memcmp( &entry->fsid, &get_fsid.fsid, sizeof(fsid_t) ))
> +        /* Cache lookup succeeded */
> +        return entry->case_sensitive;
> +    /* Cache is stale at this point, we have to update it */
> +
> +    mntpoint = get_device_mount_point( get_fsid.dev );
> +    /* Now look up the case-sensitivity */
> +    attr.commonattr = 0;
> +    attr.volattr = ATTR_VOL_INFO|ATTR_VOL_CAPABILITIES;
> +    if (getattrlist( mntpoint, &attr, &caps, sizeof(caps), 0 ) == 0)
> +    {

If that can fail then you need to structure this differently, otherwise
you'll end up looking up the mount point on every call. Also please put
that chunk in a separate function, it's totally different from the
statfs code path.

> +#elif defined(__linux__)
> +    /* Only assume CIOPFS is case insensitive. */
> +    /* Normally, we'd have to parse the mtab to find out exactly what
> +     * kind of FUSE FS this is. But, someone on wine-devel suggested
> +     * a shortcut. We'll stat a special file in the directory. If it's
> +     * there, we'll assume it's a CIOPFS, else not.
> +     * This will break if somebody puts a file named ".ciopfs" in a non-
> +     * CIOPFS directory.
> +     */
> +    cifile = RtlAllocateHeap( GetProcessHeap(), 0, strlen( dir )+sizeof("/.ciopfs") );
> +    if (!cifile) return TRUE;
> +    strcpy( cifile, dir );
> +    strcat( cifile, "/.ciopfs" );
> +    if (stat( cifile, &st ) == 0)
> +    {
> +        RtlFreeHeap( GetProcessHeap(), 0, cifile );
> +        return FALSE;
> +    }

You lost the statfs here.

> @@ -1872,7 +2097,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
>                      {
>                          ret = ntdll_umbstowcs( 0, de[1].d_name, strlen(de[1].d_name),
>                                                 buffer, MAX_DIR_ENTRY_LEN );
> -                        if (ret == length && !memicmpW( buffer, name, length))
> +                        if (ret == length && !memicmpW( buffer, name, length ))

Please avoid gratuitous whitespace changes.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list