Changeset 0013b9ce in mainline


Ignore:
Timestamp:
2008-11-23T12:27:15Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7782030
Parents:
f714576
Message:

libfs operation link() should return standard error code instead of mere
true/false.

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libfs/libfs.c

    rf714576 r0013b9ce  
    197197                                            index);
    198198                                if (nodep) {
    199                                         if (!ops->link(cur, nodep, component)) {
     199                                        int rc;
     200
     201                                        rc = ops->link(cur, nodep, component);
     202                                        if (rc != EOK) {
    200203                                                if (lflag & L_CREATE) {
    201204                                                        (void)ops->destroy(
    202205                                                            nodep);
    203206                                                }
    204                                                 ipc_answer_0(rid, ENOSPC);
     207                                                ipc_answer_0(rid, rc);
    205208                                        } else {
    206209                                                ipc_answer_5(rid, EOK,
     
    267270                                nodep = ops->node_get(dev_handle, index);
    268271                        if (nodep) {
    269                                 if (!ops->link(cur, nodep, component)) {
     272                                int rc;
     273
     274                                rc = ops->link(cur, nodep, component);
     275                                if (rc != EOK) {
    270276                                        if (lflag & L_CREATE)
    271277                                                (void)ops->destroy(nodep);
    272                                         ipc_answer_0(rid, ENOSPC);
     278                                        ipc_answer_0(rid, rc);
    273279                                } else {
    274280                                        ipc_answer_5(rid, EOK,
  • uspace/lib/libfs/libfs.h

    rf714576 r0013b9ce  
    4848        void * (* create)(dev_handle_t, int);
    4949        int (* destroy)(void *);
    50         bool (* link)(void *, void *, const char *);
     50        int (* link)(void *, void *, const char *);
    5151        int (* unlink)(void *, void *);
    5252        fs_index_t (* index_get)(void *);
  • uspace/srv/fs/fat/fat_ops.c

    rf714576 r0013b9ce  
    224224static void *fat_create_node(dev_handle_t, int);
    225225static int fat_destroy_node(void *);
    226 static bool fat_link(void *, void *, const char *);
     226static int fat_link(void *, void *, const char *);
    227227static int fat_unlink(void *, void *);
    228228static void *fat_match(void *, const char *);
     
    342342}
    343343
    344 bool fat_link(void *prnt, void *chld, const char *name)
    345 {
    346         return false;   /* not supported at the moment */
     344int fat_link(void *prnt, void *chld, const char *name)
     345{
     346        return ENOTSUP; /* not supported at the moment */
    347347}
    348348
     
    526526};
    527527
     528/*
     529 * VFS operations.
     530 */
     531
    528532void fat_mounted(ipc_callid_t rid, ipc_call_t *request)
    529533{
  • uspace/srv/fs/tmpfs/tmpfs_dump.c

    rf714576 r0013b9ce  
    6060        struct rdentry entry;
    6161        libfs_ops_t *ops = &tmpfs_libfs_ops;
     62        int rc;
    6263       
    6364        do {
     
    9495                        fname[entry.len] = 0;
    9596                       
    96                         if (!ops->link((void *) parent, (void *) node, fname)) {
     97                        rc = ops->link((void *) parent, (void *) node, fname);
     98                        if (rc != EOK) {
    9799                                ops->destroy((void *) node);
    98100                                free(fname);
     
    135137                        }
    136138                        fname[entry.len] = 0;
    137                        
    138                         if (!ops->link((void *) parent, (void *) node, fname)) {
     139
     140                        rc = ops->link((void *) parent, (void *) node, fname);
     141                        if (rc != EOK) {
    139142                                ops->destroy((void *) node);
    140143                                free(fname);
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    rf714576 r0013b9ce  
    7676static void tmpfs_node_put(void *);
    7777static void *tmpfs_create_node(dev_handle_t, int);
    78 static bool tmpfs_link_node(void *, void *, const char *);
     78static int tmpfs_link_node(void *, void *, const char *);
    7979static int tmpfs_unlink_node(void *, void *);
    8080static int tmpfs_destroy_node(void *);
     
    309309}
    310310
    311 bool tmpfs_link_node(void *prnt, void *chld, const char *nm)
     311int tmpfs_link_node(void *prnt, void *chld, const char *nm)
    312312{
    313313        tmpfs_dentry_t *parentp = (tmpfs_dentry_t *) prnt;
     
    318318        tmpfs_name_t *namep = malloc(sizeof(tmpfs_name_t));
    319319        if (!namep)
    320                 return false;
     320                return ENOMEM;
    321321        tmpfs_name_initialize(namep);
    322322        size_t len = strlen(nm);
     
    324324        if (!namep->name) {
    325325                free(namep);
    326                 return false;
     326                return ENOMEM;
    327327        }
    328328        strcpy(namep->name, nm);
     
    344344        }
    345345
    346         return true;
     346        return EOK;
    347347}
    348348
Note: See TracChangeset for help on using the changeset viewer.