diff options
Diffstat (limited to 'ipc/shm.c')
-rw-r--r-- | ipc/shm.c | 32 |
1 files changed, 26 insertions, 6 deletions
@@ -285,21 +285,41 @@ static int shm_release(struct inode *ino, struct file *file) | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | #ifndef CONFIG_MMU | 288 | static int shm_fsync(struct file *file, struct dentry *dentry, int datasync) |
289 | { | ||
290 | int (*fsync) (struct file *, struct dentry *, int datasync); | ||
291 | struct shm_file_data *sfd = shm_file_data(file); | ||
292 | int ret = -EINVAL; | ||
293 | |||
294 | fsync = sfd->file->f_op->fsync; | ||
295 | if (fsync) | ||
296 | ret = fsync(sfd->file, sfd->file->f_path.dentry, datasync); | ||
297 | return ret; | ||
298 | } | ||
299 | |||
289 | static unsigned long shm_get_unmapped_area(struct file *file, | 300 | static unsigned long shm_get_unmapped_area(struct file *file, |
290 | unsigned long addr, unsigned long len, unsigned long pgoff, | 301 | unsigned long addr, unsigned long len, unsigned long pgoff, |
291 | unsigned long flags) | 302 | unsigned long flags) |
292 | { | 303 | { |
293 | struct shm_file_data *sfd = shm_file_data(file); | 304 | struct shm_file_data *sfd = shm_file_data(file); |
294 | return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len, pgoff, | 305 | return get_unmapped_area(sfd->file, addr, len, pgoff, flags); |
295 | flags); | 306 | } |
307 | |||
308 | int is_file_shm_hugepages(struct file *file) | ||
309 | { | ||
310 | int ret = 0; | ||
311 | |||
312 | if (file->f_op == &shm_file_operations) { | ||
313 | struct shm_file_data *sfd; | ||
314 | sfd = shm_file_data(file); | ||
315 | ret = is_file_hugepages(sfd->file); | ||
316 | } | ||
317 | return ret; | ||
296 | } | 318 | } |
297 | #else | ||
298 | #define shm_get_unmapped_area NULL | ||
299 | #endif | ||
300 | 319 | ||
301 | static const struct file_operations shm_file_operations = { | 320 | static const struct file_operations shm_file_operations = { |
302 | .mmap = shm_mmap, | 321 | .mmap = shm_mmap, |
322 | .fsync = shm_fsync, | ||
303 | .release = shm_release, | 323 | .release = shm_release, |
304 | .get_unmapped_area = shm_get_unmapped_area, | 324 | .get_unmapped_area = shm_get_unmapped_area, |
305 | }; | 325 | }; |