]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/hostfs/hostfs_user.c
Merge tag 'xtensa-20150416' of git://github.com/czankel/xtensa-linux
[karo-tx-linux.git] / fs / hostfs / hostfs_user.c
index 9765dab95cbdaefa4e53d8fdd51a72ffca4e6061..9c1e0f01988039356874c7445459179f80730511 100644 (file)
@@ -97,21 +97,27 @@ void *open_dir(char *path, int *err_out)
        return dir;
 }
 
-char *read_dir(void *stream, unsigned long long *pos,
+void seek_dir(void *stream, unsigned long long pos)
+{
+       DIR *dir = stream;
+
+       seekdir(dir, pos);
+}
+
+char *read_dir(void *stream, unsigned long long *pos_out,
               unsigned long long *ino_out, int *len_out,
               unsigned int *type_out)
 {
        DIR *dir = stream;
        struct dirent *ent;
 
-       seekdir(dir, *pos);
        ent = readdir(dir);
        if (ent == NULL)
                return NULL;
        *len_out = strlen(ent->d_name);
        *ino_out = ent->d_ino;
        *type_out = ent->d_type;
-       *pos = telldir(dir);
+       *pos_out = ent->d_off;
        return ent->d_name;
 }
 
@@ -175,21 +181,10 @@ void close_dir(void *stream)
        closedir(stream);
 }
 
-int file_create(char *name, int ur, int uw, int ux, int gr,
-               int gw, int gx, int or, int ow, int ox)
+int file_create(char *name, int mode)
 {
-       int mode, fd;
-
-       mode = 0;
-       mode |= ur ? S_IRUSR : 0;
-       mode |= uw ? S_IWUSR : 0;
-       mode |= ux ? S_IXUSR : 0;
-       mode |= gr ? S_IRGRP : 0;
-       mode |= gw ? S_IWGRP : 0;
-       mode |= gx ? S_IXGRP : 0;
-       mode |= or ? S_IROTH : 0;
-       mode |= ow ? S_IWOTH : 0;
-       mode |= ox ? S_IXOTH : 0;
+       int fd;
+
        fd = open64(name, O_CREAT | O_RDWR, mode);
        if (fd < 0)
                return -errno;