| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 #include <assert.h> | 6 #include <assert.h> |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <ppapi/c/pp_file_info.h> | 8 #include <ppapi/c/pp_file_info.h> |
| 9 #include <ppapi/c/ppb_file_io.h> | 9 #include <ppapi/c/ppb_file_io.h> |
| 10 #include <ppapi/cpp/file_io.h> | 10 #include <ppapi/cpp/file_io.h> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 job->set_query_buf(q_buf); | 170 job->set_query_buf(q_buf); |
| 171 int ret = runner_->RunJob(job); | 171 int ret = runner_->RunJob(job); |
| 172 if (ret < 0) { | 172 if (ret < 0) { |
| 173 dbgprintf("stat error %d\n", ret); | 173 dbgprintf("stat error %d\n", ret); |
| 174 errno = EIO; | 174 errno = EIO; |
| 175 return -1; | 175 return -1; |
| 176 } | 176 } |
| 177 | 177 |
| 178 memset(buf, 0, sizeof(struct stat)); | 178 memset(buf, 0, sizeof(struct stat)); |
| 179 buf->st_ino = (ino_t)slot; | 179 buf->st_ino = (ino_t)slot; |
| 180 buf->st_mode = S_IFREG | 0777; | 180 buf->st_mode = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
| 181 | S_IWOTH; |
| 181 buf->st_size = q_buf->size; | 182 buf->st_size = q_buf->size; |
| 182 buf->st_uid = 1001; | 183 buf->st_uid = 1001; |
| 183 buf->st_gid = 1002; | 184 buf->st_gid = 1002; |
| 184 buf->st_blksize = 1024; | 185 buf->st_blksize = 1024; |
| 185 return 0; | 186 return 0; |
| 186 } | 187 } |
| 187 | 188 |
| 188 ssize_t PepperMount::Read(ino_t slot, off_t offset, void *buf, | 189 ssize_t PepperMount::Read(ino_t slot, off_t offset, void *buf, |
| 189 size_t count) { | 190 size_t count) { |
| 190 SimpleAutoLock lock(&pp_lock_); | 191 SimpleAutoLock lock(&pp_lock_); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 // will return null if d_ino is zero. | 335 // will return null if d_ino is zero. |
| 335 dir->d_ino = 0x60061E; | 336 dir->d_ino = 0x60061E; |
| 336 dir->d_off = sizeof(struct dirent); | 337 dir->d_off = sizeof(struct dirent); |
| 337 dir->d_reclen = sizeof(struct dirent); | 338 dir->d_reclen = sizeof(struct dirent); |
| 338 strncpy(dir->d_name, it->c_str(), sizeof(dir->d_name)); | 339 strncpy(dir->d_name, it->c_str(), sizeof(dir->d_name)); |
| 339 ++dir; | 340 ++dir; |
| 340 bytes_read += sizeof(struct dirent); | 341 bytes_read += sizeof(struct dirent); |
| 341 } | 342 } |
| 342 return bytes_read; | 343 return bytes_read; |
| 343 } | 344 } |
| OLD | NEW |