Changeset 8f88beb in mainline for uspace/lib/c/include/double_to_str.h


Ignore:
Timestamp:
2012-11-25T21:34:07Z (11 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e1a27be
Parents:
150a271 (diff), 7462674 (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.
Message:

Merge mainline changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/double_to_str.h

    r150a271 r8f88beb  
    11/*
    2  * Copyright (c) 2006 Martin Decky
    3  * Copyright (c) 2011 Martin Sucha
     2 * Copyright (c) 2012 Adam Hraska
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup fs
    31  * @{
    32  */
     29#ifndef DOUBLE_TO_STR_H_
     30#define DOUBLE_TO_STR_H_
    3331
    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.
    3740 */
     41#define MAX_DOUBLE_STR_LEN (20 + 1)
    3842
    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
    4947
    50 #define NAME    "ext2fs"
     48/* Fwd decl.*/
     49struct ieee_double_t_tag;
    5150
    52 vfs_info_t ext2fs_vfs_info = {
    53         .name = NAME,
    54         .instance = 0,
    55 };
     51extern int double_to_short_str(struct ieee_double_t_tag, char *, size_t, int *);
     52extern int double_to_fixed_str(struct ieee_double_t_tag, int, int, char *,
     53    size_t, int *);
    5654
    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
Note: See TracChangeset for help on using the changeset viewer.