1 # define DEBUG_SUBSYSTEM S_LNET
4 #include <linux/kdev_t.h>
5 #include <linux/ctype.h>
6 #include <asm/uaccess.h>
8 #include <libcfs/libcfs.h>
11 cfs_filp_open (const char *name, int flags, int mode, int *err)
14 * Maybe we need to handle flags and mode in the future
16 cfs_file_t *filp = NULL;
18 filp = filp_open(name, flags, mode);
23 printk(KERN_ERR "LustreError: can't open %s file: err %d\n",
32 /* write a userspace buffer to disk.
33 * NOTE: this returns 0 on success, not the number of bytes written. */
35 cfs_user_write (cfs_file_t *filp, const char *buf, size_t count, loff_t *offset)
43 size = filp->f_op->write(filp, (char *)buf, count, offset);
54 #if !(CFS_O_CREAT == O_CREAT && CFS_O_EXCL == O_EXCL && \
55 CFS_O_TRUNC == O_TRUNC && CFS_O_APPEND == O_APPEND &&\
56 CFS_O_NONBLOCK == O_NONBLOCK && CFS_O_NDELAY == O_NDELAY &&\
57 CFS_O_SYNC == O_SYNC && CFS_O_ASYNC == FASYNC &&\
58 CFS_O_DIRECT == O_DIRECT && CFS_O_LARGEFILE == O_LARGEFILE &&\
59 CFS_O_DIRECTORY == O_DIRECTORY && CFS_O_NOFOLLOW == O_NOFOLLOW)
61 int cfs_oflags2univ(int flags)
65 f = flags & O_ACCMODE;
66 f |= (flags & O_CREAT) ? CFS_O_CREAT: 0;
67 f |= (flags & O_EXCL) ? CFS_O_EXCL: 0;
68 f |= (flags & O_NOCTTY) ? CFS_O_NOCTTY: 0;
69 f |= (flags & O_TRUNC) ? CFS_O_TRUNC: 0;
70 f |= (flags & O_APPEND) ? CFS_O_APPEND: 0;
71 f |= (flags & O_NONBLOCK) ? CFS_O_NONBLOCK: 0;
72 f |= (flags & O_SYNC)? CFS_O_SYNC: 0;
73 f |= (flags & FASYNC)? CFS_O_ASYNC: 0;
74 f |= (flags & O_DIRECTORY)? CFS_O_DIRECTORY: 0;
75 f |= (flags & O_DIRECT)? CFS_O_DIRECT: 0;
76 f |= (flags & O_LARGEFILE)? CFS_O_LARGEFILE: 0;
77 f |= (flags & O_NOFOLLOW)? CFS_O_NOFOLLOW: 0;
78 f |= (flags & O_NOATIME)? CFS_O_NOATIME: 0;
83 int cfs_oflags2univ(int flags)
90 * XXX Liang: we don't need cfs_univ2oflags() now.
92 int cfs_univ2oflags(int flags)
97 EXPORT_SYMBOL(cfs_filp_open);
98 EXPORT_SYMBOL(cfs_user_write);
99 EXPORT_SYMBOL(cfs_oflags2univ);
100 EXPORT_SYMBOL(cfs_univ2oflags);