sdcard: Force file names to lower case in order to provide case insensitivity
Change-Id: I2cdb12c7e296e1c28b66e32c7037dce060eecd67 Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
parent
98af303d44
commit
51b3a2d77a
|
@ -442,6 +442,13 @@ void lookup_entry(struct fuse *fuse, struct node *node,
|
|||
fuse_reply(fuse, unique, &out, sizeof(out));
|
||||
}
|
||||
|
||||
static void normalize_name(char *name)
|
||||
{
|
||||
char ch;
|
||||
while ((ch = *name) != 0)
|
||||
*name++ = tolower(ch);
|
||||
}
|
||||
|
||||
void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *data, unsigned len)
|
||||
{
|
||||
struct node *node;
|
||||
|
@ -465,6 +472,7 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
|
||||
switch (hdr->opcode) {
|
||||
case FUSE_LOOKUP: { /* bytez[] -> entry_out */
|
||||
normalize_name((char*) data);
|
||||
TRACE("LOOKUP %llx %s\n", hdr->nodeid, (char*) data);
|
||||
lookup_entry(fuse, node, (char*) data, hdr->unique);
|
||||
return;
|
||||
|
@ -523,6 +531,9 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
char *path, buffer[PATH_BUFFER_SIZE];
|
||||
char *name = ((char*) data) + sizeof(*req);
|
||||
int res;
|
||||
|
||||
normalize_name(name);
|
||||
|
||||
TRACE("MKNOD %s @ %llx\n", name, hdr->nodeid);
|
||||
path = node_get_path(node, buffer, name);
|
||||
|
||||
|
@ -541,6 +552,9 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
char *path, buffer[PATH_BUFFER_SIZE];
|
||||
char *name = ((char*) data) + sizeof(*req);
|
||||
int res;
|
||||
|
||||
normalize_name(name);
|
||||
|
||||
TRACE("MKDIR %s @ %llx 0%o\n", name, hdr->nodeid, req->mode);
|
||||
path = node_get_path(node, buffer, name);
|
||||
|
||||
|
@ -556,6 +570,7 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
case FUSE_UNLINK: { /* bytez[] -> */
|
||||
char *path, buffer[PATH_BUFFER_SIZE];
|
||||
int res;
|
||||
normalize_name((char*) data);
|
||||
TRACE("UNLINK %s @ %llx\n", (char*) data, hdr->nodeid);
|
||||
path = node_get_path(node, buffer, (char*) data);
|
||||
res = unlink(path);
|
||||
|
@ -565,6 +580,7 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
case FUSE_RMDIR: { /* bytez[] -> */
|
||||
char *path, buffer[PATH_BUFFER_SIZE];
|
||||
int res;
|
||||
normalize_name((char*) data);
|
||||
TRACE("RMDIR %s @ %llx\n", (char*) data, hdr->nodeid);
|
||||
path = node_get_path(node, buffer, (char*) data);
|
||||
res = rmdir(path);
|
||||
|
@ -581,6 +597,9 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
struct node *newparent;
|
||||
int res;
|
||||
|
||||
normalize_name(oldname);
|
||||
normalize_name(newname);
|
||||
|
||||
TRACE("RENAME %s->%s @ %llx\n", oldname, newname, hdr->nodeid);
|
||||
|
||||
target = lookup_child_by_name(node, oldname);
|
||||
|
@ -627,6 +646,7 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
return;
|
||||
}
|
||||
|
||||
normalize_name(buffer);
|
||||
path = node_get_path(node, buffer, 0);
|
||||
TRACE("OPEN %llx '%s' 0%o fh=%p\n", hdr->nodeid, path, req->flags, h);
|
||||
h->fd = open(path, req->flags);
|
||||
|
@ -728,6 +748,7 @@ void handle_fuse_request(struct fuse *fuse, struct fuse_in_header *hdr, void *da
|
|||
return;
|
||||
}
|
||||
|
||||
normalize_name(buffer);
|
||||
path = node_get_path(node, buffer, 0);
|
||||
TRACE("OPENDIR %llx '%s'\n", hdr->nodeid, path);
|
||||
h->d = opendir(path);
|
||||
|
|
Loading…
Reference in New Issue