+/*
+ * Determine if a file may be read/written.
+ *
+ * Given a ptr to an open file table entry and a flag indicating desired
+ * access return non-zero if the file record indicates that the access is
+ * permitted or zero, if not.
+ *
+ * 'r' for read access check
+ * 'w' for write access check
+ */
+
+#define F_CHKRW(_fil, _c) \
+ (((_c) == 'r' && !((_fil)->f_flags & O_WRONLY)) || \
+ ((_c) == 'w' && ((_fil)->f_flags & (O_WRONLY | O_RDWR))))
+