Changeset e095644 in mainline for uspace/lib


Ignore:
Timestamp:
2010-01-24T17:32:20Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50fda24
Parents:
fea0ce6 (diff), ae75e2e3 (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 partial support for the unmount feature.
VFS_OUT_UNMOUNT and VFS_OUT_UNMOUNTED not yet implemented by DEVFS, FAT and
TMPFS.

Location:
uspace/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/adt/hash_table.c

    rfea0ce6 re095644  
    193193}
    194194
     195/** Apply fucntion to all items in hash table.
     196 *
     197 * @param h             Hash table.
     198 * @param f             Function to be applied.
     199 * @param arg           Argument to be passed to the function.
     200 */
     201void
     202hash_table_apply(hash_table_t *h, void (*f)(link_t *, void *), void *arg)
     203{
     204        hash_index_t bucket;
     205        link_t *cur;
     206
     207        for (bucket = 0; bucket < h->entries; bucket++) {
     208                for (cur = h->entry[bucket].next; cur != &h->entry[bucket];
     209                    cur = cur->next) {
     210                        f(cur, arg);
     211                }
     212        }
     213}
     214
    195215/** @}
    196216 */
  • uspace/lib/libc/generic/vfs/vfs.c

    rfea0ce6 re095644  
    197197}
    198198
     199int unmount(const char *mp)
     200{
     201        ipcarg_t rc;
     202        ipcarg_t rc_orig;
     203        aid_t req;
     204        size_t mpa_size;
     205        char *mpa;
     206       
     207        mpa = absolutize(mp, &mpa_size);
     208        if (!mpa)
     209                return ENOMEM;
     210       
     211        futex_down(&vfs_phone_futex);
     212        async_serialize_start();
     213        vfs_connect();
     214       
     215        req = async_send_0(vfs_phone, VFS_IN_UNMOUNT, NULL);
     216        rc = async_data_write_start(vfs_phone, (void *) mpa, mpa_size);
     217        if (rc != EOK) {
     218                async_wait_for(req, &rc_orig);
     219                async_serialize_end();
     220                futex_up(&vfs_phone_futex);
     221                free(mpa);
     222                if (rc_orig == EOK)
     223                        return (int) rc;
     224                else
     225                        return (int) rc_orig;
     226        }
     227       
     228
     229        async_wait_for(req, &rc);
     230        async_serialize_end();
     231        futex_up(&vfs_phone_futex);
     232        free(mpa);
     233       
     234        return (int) rc;
     235}
     236
    199237static int open_internal(const char *abs, size_t abs_size, int lflag, int oflag)
    200238{
  • uspace/lib/libc/include/adt/hash_table.h

    rfea0ce6 re095644  
    8888extern void hash_table_remove(hash_table_t *, unsigned long [], hash_count_t);
    8989extern void hash_table_destroy(hash_table_t *);
     90extern void hash_table_apply(hash_table_t *, void (*)(link_t *, void *),
     91    void *);
    9092
    9193#endif
  • uspace/lib/libc/include/ipc/vfs.h

    rfea0ce6 re095644  
    8686        VFS_OUT_MOUNTED,
    8787        VFS_OUT_UNMOUNT,
     88        VFS_OUT_UNMOUNTED,
    8889        VFS_OUT_SYNC,
    8990        VFS_OUT_STAT,
     
    140141
    141142/**
    142  * L_OPEN is used to indicate that the lookup operation is a part of VFS_OPEN
     143 * L_OPEN is used to indicate that the lookup operation is a part of VFS_IN_OPEN
    143144 * call from the client. This means that the server might allocate some
    144145 * resources for the opened file. This flag cannot be passed directly by the
     
    147148#define L_OPEN  64
    148149
     150/**
     151 * L_NOCROSS_LAST_MP is used exclusively during the VFS_IN_UNMOUNT operation. It
     152 * tells the lookup routine not to cross the last mount point in the lookup
     153 * path.
     154 */
     155#define L_NOCROSS_LAST_MP       128
     156
    149157#endif
    150158
  • uspace/lib/libc/include/vfs/vfs.h

    rfea0ce6 re095644  
    5555extern int mount(const char *, const char *, const char *, const char *,
    5656    unsigned int);
     57extern int unmount(const char *);
    5758
    5859extern void __stdio_init(int filc, fdi_node_t *filv[]);
  • uspace/lib/libfs/libfs.c

    rfea0ce6 re095644  
    304304                on_error(rc, goto out_with_answer);
    305305               
    306                 if ((tmp) && (tmp->mp_data.mp_active)) {
     306                /*
     307                 * If the matching component is a mount point, there are two
     308                 * legitimate semantics of the lookup operation. The first is
     309                 * the commonly used one in which the lookup crosses each mount
     310                 * point into the mounted file system. The second semantics is
     311                 * used mostly during unmount() and differs from the first one
     312                 * only in that the last mount point in the looked up path,
     313                 * which is also its last component, is not crossed.
     314                 */
     315
     316                if ((tmp) && (tmp->mp_data.mp_active) &&
     317                    (!(lflag & L_NOCROSS_LAST_MP) || (next <= last))) {
    307318                        if (next > last)
    308319                                next = last = first;
Note: See TracChangeset for help on using the changeset viewer.