Changeset cc76be3 in mainline


Ignore:
Timestamp:
2007-12-14T18:12:17Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74303b6
Parents:
5832e9b
Message:

VFS work.
During VFS_REGISTER, use strncmp() instead of strcmp().
Add one excessive convenience byte to vfs_info.name to support the
above-mentioned change. In case the fs name spans all available
characters, make sure this convenience byte is zero.

Location:
uspace/srv/vfs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    r5832e9b rcc76be3  
    8484typedef struct {
    8585        /** Unique identifier of the fs. */
    86         char name[FS_NAME_MAXLEN];
     86        char name[FS_NAME_MAXLEN + 1];
    8787       
    8888        /** Operations. */
  • uspace/srv/vfs/vfs_register.c

    r5832e9b rcc76be3  
    8888                        }
    8989                }
     90        }
     91        /*
     92         * This check is not redundant. It ensures that the name is
     93         * NULL-terminated, even if FS_NAME_MAXLEN characters are used.
     94         */
     95        if (info->name[i] != '\0') {
     96                dprintf("The name is not properly NULL-terminated.\n");
     97                return false;
    9098        }
    9199       
     
    401409        for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
    402410                fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
    403                 if (strcmp(fs->vfs_info.name, name) == 0) { /* XXX: strncmp() */
     411                if (strncmp(fs->vfs_info.name, name,
     412                    sizeof(fs->vfs_info.name)) == 0) {
    404413                        handle = fs->fs_handle;
    405414                        break;
Note: See TracChangeset for help on using the changeset viewer.