Changeset c739102 in mainline for uspace/lib/c/include
- Timestamp:
- 2012-11-21T23:26:22Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2c80a
- Parents:
- bebf97d (diff), 1f7753a (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. - Location:
- uspace/lib/c/include
- Files:
-
- 1 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/double_to_str.h
rbebf97d rc739102 1 1 /* 2 * Copyright (c) 2006 Martin Decky 3 * Copyright (c) 2011 Martin Sucha 2 * Copyright (c) 2012 Adam Hraska 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup fs 31 * @{ 32 */ 29 #ifndef DOUBLE_TO_STR_H_ 30 #define DOUBLE_TO_STR_H_ 33 31 34 /** 35 * @file ext2.c 36 * @brief EXT2 file system driver for HelenOS. 32 #include <unistd.h> 33 34 /** Maximum number of digits double_to_*_str conversion functions produce. 35 * 36 * Both double_to_short_str and double_to_fixed_str generate digits out 37 * of a 64bit unsigned int number representation. The max number of 38 * of digits is therefore 20. Add 1 to help users who forget to reserve 39 * space for a null terminator. 37 40 */ 41 #define MAX_DOUBLE_STR_LEN (20 + 1) 38 42 39 #include "ext2fs.h" 40 #include <ipc/services.h> 41 #include <ns.h> 42 #include <async.h> 43 #include <errno.h> 44 #include <unistd.h> 45 #include <task.h> 46 #include <stdio.h> 47 #include <libfs.h> 48 #include "../../vfs/vfs.h" 43 /** Maximum buffer size needed to store the output of double_to_*_str 44 * functions. 45 */ 46 #define MAX_DOUBLE_STR_BUF_SIZE 21 49 47 50 #define NAME "ext2fs" 48 /* Fwd decl.*/ 49 struct ieee_double_t_tag; 51 50 52 vfs_info_t ext2fs_vfs_info = { 53 .name = NAME, 54 .instance = 0, 55 }; 51 extern int double_to_short_str(struct ieee_double_t_tag, char *, size_t, int *); 52 extern int double_to_fixed_str(struct ieee_double_t_tag, int, int, char *, 53 size_t, int *); 56 54 57 int main(int argc, char **argv) 58 { 59 printf(NAME ": HelenOS EXT2 file system server\n"); 60 61 if (argc == 3) { 62 if (!str_cmp(argv[1], "--instance")) 63 ext2fs_vfs_info.instance = strtol(argv[2], NULL, 10); 64 else { 65 printf(NAME " Unrecognized parameters"); 66 return -1; 67 } 68 } 69 70 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 71 SERVICE_VFS, 0, 0); 72 if (!vfs_sess) { 73 printf(NAME ": failed to connect to VFS\n"); 74 return -1; 75 } 76 77 int rc = ext2fs_global_init(); 78 if (rc != EOK) { 79 printf(NAME ": Failed global initialization\n"); 80 return 1; 81 } 82 83 rc = fs_register(vfs_sess, &ext2fs_vfs_info, &ext2fs_ops, 84 &ext2fs_libfs_ops); 85 if (rc != EOK) { 86 fprintf(stdout, NAME ": Failed to register fs (%d)\n", rc); 87 return 1; 88 } 89 90 printf(NAME ": Accepting connections\n"); 91 task_retval(0); 92 async_manager(); 93 /* not reached */ 94 return 0; 95 } 96 97 /** 98 * @} 99 */ 55 #endif -
uspace/lib/c/include/ieee_double.h
rbebf97d rc739102 1 1 /* 2 * Copyright (c) 201 1 Martin Sucha2 * Copyright (c) 2012 Adam Hraska 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libext2 30 * @{ 31 */ 32 /** 33 * @file 34 */ 29 #ifndef IEEE_DOUBLE_H_ 30 #define IEEE_DOUBLE_H_ 35 31 36 #i fndef LIBEXT2_LIBEXT2_BLOCK_GROUP_H_37 # define LIBEXT2_LIBEXT2_BLOCK_GROUP_H_32 #include <stdint.h> 33 #include <bool.h> 38 34 39 #include <block.h> 35 /** Represents a non-negative floating point number: significand * 2^exponent */ 36 typedef struct fp_num_t_tag { 37 /** Significand (aka mantissa). */ 38 uint64_t significand; 39 /** Binary exponent. */ 40 int exponent; 41 } fp_num_t; 40 42 41 typedef struct ext2_block_group { 42 uint32_t block_bitmap_block; // Block ID for block bitmap 43 uint32_t inode_bitmap_block; // Block ID for inode bitmap 44 uint32_t inode_table_first_block; // Block ID of first block of inode table 45 uint16_t free_block_count; // Count of free blocks 46 uint16_t free_inode_count; // Count of free inodes 47 uint16_t directory_inode_count; // Number of inodes allocated to directories 48 } ext2_block_group_t; 43 /** Double number description according to IEEE 754. */ 44 typedef struct ieee_double_t_tag { 45 /** The number is a NaN or infinity. */ 46 bool is_special; 47 /** Not a number. */ 48 bool is_nan; 49 bool is_negative; 50 /** The number denoted infinity. */ 51 bool is_infinity; 52 /** The number could not be represented as a normalized double. */ 53 bool is_denormal; 54 /** 55 * The predecessor double is closer than the successor. This happens 56 * if a normal number is of the form 2^k and it is not the smallest 57 * normal number. 58 */ 59 bool is_accuracy_step; 60 /** 61 * If !is_special the double's value is: 62 * pos_val.significand * 2^pos_val.exponent 63 */ 64 fp_num_t pos_val; 65 } ieee_double_t; 49 66 50 typedef struct ext2_block_group_ref { 51 block_t *block; // Reference to a block containing this block group descr 52 ext2_block_group_t *block_group; 53 } ext2_block_group_ref_t; 54 55 #define EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE 32 56 57 extern uint32_t ext2_block_group_get_block_bitmap_block(ext2_block_group_t *); 58 extern uint32_t ext2_block_group_get_inode_bitmap_block(ext2_block_group_t *); 59 extern uint32_t ext2_block_group_get_inode_table_first_block(ext2_block_group_t *); 60 extern uint16_t ext2_block_group_get_free_block_count(ext2_block_group_t *); 61 extern uint16_t ext2_block_group_get_free_inode_count(ext2_block_group_t *); 62 extern uint16_t ext2_block_group_get_directory_inode_count(ext2_block_group_t *); 63 64 extern void ext2_block_group_set_free_block_count(ext2_block_group_t *, uint16_t); 67 extern ieee_double_t extract_ieee_double(double); 65 68 66 69 #endif 67 68 /** @}69 */ -
uspace/lib/c/include/macros.h
rbebf97d rc739102 38 38 #define min(a, b) ((a) < (b) ? (a) : (b)) 39 39 #define max(a, b) ((a) > (b) ? (a) : (b)) 40 #define abs(a) ((a) >= 0 ? (a) : (-a)) 41 40 42 41 43 #define KiB2SIZE(kb) ((kb) << 10) -
uspace/lib/c/include/stack.h
rbebf97d rc739102 1 1 /* 2 * Copyright (c) 201 1 Martin Sucha2 * Copyright (c) 2012 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib ext229 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 /** 33 * @file 32 /** @file 34 33 */ 35 34 36 #ifndef LIB EXT2_LIBEXT2_H_37 #define LIB EXT2_LIBEXT2_H_35 #ifndef LIBC_STACK_H_ 36 #define LIBC_STACK_H_ 38 37 39 #include "libext2_superblock.h" 40 #include "libext2_block_group.h" 41 #include "libext2_inode.h" 42 #include "libext2_filesystem.h" 43 #include "libext2_directory.h" 38 #include <libarch/types.h> 39 40 extern size_t stack_size_get(void); 44 41 45 42 #endif
Note:
See TracChangeset
for help on using the changeset viewer.