Changeset 8ff0bd2 in mainline for uspace/srv/fs/exfat/exfat.c
- Timestamp:
- 2011-09-04T11:30:58Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 03bc76a
- Parents:
- d2c67e7 (diff), deac215e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat.c
rd2c67e7 r8ff0bd2 1 1 /* 2 * Copyright (c) 2011 Vojtech Horky 2 * Copyright (c) 2006 Martin Decky 3 * Copyright (c) 2008 Jakub Jermar 4 * Copyright (c) 2011 Oleg Romanenko 3 5 * All rights reserved. 4 6 * … … 27 29 */ 28 30 29 /** @addtogroup tester 30 * @brief Test devman service. 31 /** @addtogroup fs 31 32 * @{ 32 */ 33 */ 34 33 35 /** 34 * @file 36 * @file exfat.c 37 * @brief FAT file system driver for HelenOS. 35 38 */ 36 39 37 #include <inttypes.h> 40 #include "exfat.h" 41 #include <ipc/services.h> 42 #include <ns.h> 43 #include <async.h> 38 44 #include <errno.h> 39 #include <str_error.h> 40 #include <sys/types.h> 41 #include <async.h> 42 #include <devman.h> 43 #include <str.h> 44 #include <async.h> 45 #include <vfs/vfs.h> 46 #include <vfs/vfs_sess.h> 47 #include <sys/stat.h> 48 #include <fcntl.h> 49 #include "../tester.h" 45 #include <unistd.h> 46 #include <task.h> 47 #include <stdio.h> 48 #include <libfs.h> 49 #include "../../vfs/vfs.h" 50 50 51 #define DEVICE_CLASS "test3"51 #define NAME "exfat" 52 52 53 const char *test_devman2(void) 53 vfs_info_t exfat_vfs_info = { 54 .name = NAME, 55 .concurrent_read_write = false, 56 .write_retains_size = false, 57 }; 58 59 int main(int argc, char **argv) 54 60 { 55 size_t idx = 1; 56 int rc = EOK; 57 const char *err_msg = NULL; 58 char *path = NULL; 59 while (rc == EOK) { 60 rc = asprintf(&path, "/dev/class/%s\\%zu", DEVICE_CLASS, idx); 61 if (rc < 0) { 62 continue; 63 } 64 int fd = open(path, O_RDONLY); 65 if (fd < 0) { 66 TPRINTF("Failed opening `%s': %s.\n", 67 path, str_error(fd)); 68 rc = fd; 69 err_msg = "Failed opening file"; 70 continue; 71 } 72 async_sess_t *sess = fd_session(EXCHANGE_SERIALIZE, fd); 73 close(fd); 74 if (sess == NULL) { 75 TPRINTF("Failed opening phone: %s.\n", str_error(errno)); 76 rc = errno; 77 err_msg = "Failed opening file descriptor phone"; 78 continue; 79 } 80 async_hangup(sess); 81 TPRINTF("Path `%s' okay.\n", path); 82 free(path); 83 idx++; 84 rc = EOK; 61 printf(NAME ": HelenOS exFAT file system server\n"); 62 63 int rc = exfat_idx_init(); 64 if (rc != EOK) 65 goto err; 66 67 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 68 SERVICE_VFS, 0, 0); 69 if (!vfs_sess) { 70 printf(NAME ": failed to connect to VFS\n"); 71 return -1; 85 72 } 86 73 87 if (path != NULL) 88 free(path); 74 rc = fs_register(vfs_sess, &exfat_vfs_info, &exfat_ops, &exfat_libfs_ops); 75 if (rc != EOK) { 76 exfat_idx_fini(); 77 goto err; 78 } 89 79 90 return err_msg; 80 printf(NAME ": Accepting connections\n"); 81 task_retval(0); 82 async_manager(); 83 84 /* not reached */ 85 return 0; 86 87 err: 88 printf(NAME ": Failed to register file system (%d)\n", rc); 89 return rc; 91 90 } 92 91 93 /** @} 92 93 /** 94 * @} 94 95 */
Note:
See TracChangeset
for help on using the changeset viewer.