Changeset b19e892 in mainline for uspace/srv


Ignore:
Timestamp:
2017-04-02T10:39:13Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c4cf0d
Parents:
80743a1
Message:

Merge open() with posix_open() and provide vfs_lookup_open() instead

vfs_lookup_open() is really just a convenience wrapper around
vfs_lookup() and vfs_open().

Location:
uspace/srv
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/driver.c

    r80743a1 rb19e892  
    3333#include <dirent.h>
    3434#include <errno.h>
    35 #include <fcntl.h>
    3635#include <io/log.h>
    3736#include <vfs/vfs.h>
  • uspace/srv/devman/match.c

    r80743a1 rb19e892  
    3232
    3333#include <errno.h>
    34 #include <fcntl.h>
    3534#include <io/log.h>
    3635#include <str.h>
     
    203202        struct stat st;
    204203       
    205         fd = open(conf_path, O_RDONLY);
     204        fd = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ);
    206205        if (fd < 0) {
    207206                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
  • uspace/srv/hid/input/ctl/kbdev.c

    r80743a1 rb19e892  
    3939#include <stdbool.h>
    4040#include <errno.h>
    41 #include <fcntl.h>
    4241#include <io/console.h>
    4342#include <io/keycode.h>
  • uspace/srv/hid/input/port/adb.c

    r80743a1 rb19e892  
    3838#include <async.h>
    3939#include <vfs/vfs.h>
    40 #include <fcntl.h>
    4140#include <errno.h>
    4241#include <loc.h>
  • uspace/srv/hid/input/proto/mousedev.c

    r80743a1 rb19e892  
    3737
    3838#include <stdio.h>
    39 #include <fcntl.h>
    4039#include <vfs/vfs_sess.h>
    4140#include <malloc.h>
  • uspace/srv/loader/main.c

    r80743a1 rb19e892  
    4848#include <unistd.h>
    4949#include <stdbool.h>
    50 #include <fcntl.h>
    5150#include <sys/types.h>
    5251#include <ipc/services.h>
  • uspace/srv/vfs/vfs_ipc.c

    r80743a1 rb19e892  
    9999{
    100100        int fd = IPC_GET_ARG1(*request);
    101         int flags = IPC_GET_ARG2(*request);
    102 
    103         int rc = vfs_op_open(fd, flags);
     101        int mode = IPC_GET_ARG2(*request);
     102
     103        int rc = vfs_op_open(fd, mode);
    104104        async_answer_0(rid, rc);
    105105}
  • uspace/srv/vfs/vfs_ops.c

    r80743a1 rb19e892  
    4949#include <unistd.h>
    5050#include <ctype.h>
    51 #include <fcntl.h>
    5251#include <assert.h>
    5352#include <vfs/canonify.h>
     
    274273}
    275274
    276 int vfs_op_open(int fd, int flags)
    277 {
    278         if (flags == 0)
     275int vfs_op_open(int fd, int mode)
     276{
     277        if (mode == 0)
    279278                return EINVAL;
    280279
     
    283282                return EBADF;
    284283       
    285         if ((flags & ~file->permissions) != 0) {
     284        if ((mode & ~file->permissions) != 0) {
    286285                vfs_file_put(file);
    287286                return EPERM;
     
    293292        }
    294293       
    295         file->open_read = (flags & MODE_READ) != 0;
    296         file->open_write = (flags & (MODE_WRITE | MODE_APPEND)) != 0;
    297         file->append = (flags & MODE_APPEND) != 0;
     294        file->open_read = (mode & MODE_READ) != 0;
     295        file->open_write = (mode & (MODE_WRITE | MODE_APPEND)) != 0;
     296        file->append = (mode & MODE_APPEND) != 0;
    298297       
    299298        if (!file->open_read && !file->open_write) {
Note: See TracChangeset for help on using the changeset viewer.