aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hostfs/hostfs_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hostfs/hostfs_user.c')
-rw-r--r--fs/hostfs/hostfs_user.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 9765dab95cbd..9c1e0f019880 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -97,21 +97,27 @@ void *open_dir(char *path, int *err_out)
97 return dir; 97 return dir;
98} 98}
99 99
100char *read_dir(void *stream, unsigned long long *pos, 100void seek_dir(void *stream, unsigned long long pos)
101{
102 DIR *dir = stream;
103
104 seekdir(dir, pos);
105}
106
107char *read_dir(void *stream, unsigned long long *pos_out,
101 unsigned long long *ino_out, int *len_out, 108 unsigned long long *ino_out, int *len_out,
102 unsigned int *type_out) 109 unsigned int *type_out)
103{ 110{
104 DIR *dir = stream; 111 DIR *dir = stream;
105 struct dirent *ent; 112 struct dirent *ent;
106 113
107 seekdir(dir, *pos);
108 ent = readdir(dir); 114 ent = readdir(dir);
109 if (ent == NULL) 115 if (ent == NULL)
110 return NULL; 116 return NULL;
111 *len_out = strlen(ent->d_name); 117 *len_out = strlen(ent->d_name);
112 *ino_out = ent->d_ino; 118 *ino_out = ent->d_ino;
113 *type_out = ent->d_type; 119 *type_out = ent->d_type;
114 *pos = telldir(dir); 120 *pos_out = ent->d_off;
115 return ent->d_name; 121 return ent->d_name;
116} 122}
117 123
@@ -175,21 +181,10 @@ void close_dir(void *stream)
175 closedir(stream); 181 closedir(stream);
176} 182}
177 183
178int file_create(char *name, int ur, int uw, int ux, int gr, 184int file_create(char *name, int mode)
179 int gw, int gx, int or, int ow, int ox)
180{ 185{
181 int mode, fd; 186 int fd;
182 187
183 mode = 0;
184 mode |= ur ? S_IRUSR : 0;
185 mode |= uw ? S_IWUSR : 0;
186 mode |= ux ? S_IXUSR : 0;
187 mode |= gr ? S_IRGRP : 0;
188 mode |= gw ? S_IWGRP : 0;
189 mode |= gx ? S_IXGRP : 0;
190 mode |= or ? S_IROTH : 0;
191 mode |= ow ? S_IWOTH : 0;
192 mode |= ox ? S_IXOTH : 0;
193 fd = open64(name, O_CREAT | O_RDWR, mode); 188 fd = open64(name, O_CREAT | O_RDWR, mode);
194 if (fd < 0) 189 if (fd < 0)
195 return -errno; 190 return -errno;