Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: parisc-linux@parisc-linux.org
Subject: [parisc-linux] pread/pwrite
Date: Tue, 10 Apr 2001 21:30:05 +0100	[thread overview]
Message-ID: <20010410213005.D25123@parcelfarce.linux.theplanet.co.uk> (raw)

Could those who're having problems with pread/pwrite try the following patch?

Index: fs/read_write.c
===================================================================
RCS file: /home/cvs/parisc/linux/fs/read_write.c,v
retrieving revision 1.6
diff -u -p -r1.6 read_write.c
--- fs/read_write.c	2000/11/10 21:43:50	1.6
+++ fs/read_write.c	2001/04/10 20:21:01
@@ -315,8 +315,8 @@ bad_file:
    lseek back to original location.  They fail just like lseek does on
    non-seekable files.  */
 
-asmlinkage ssize_t sys_pread(unsigned int fd, char * buf,
-			     size_t count, loff_t pos)
+static inline
+ssize_t do_pread(unsigned int fd, char * buf, size_t count, loff_t pos)
 {
 	ssize_t ret;
 	struct file * file;
@@ -346,8 +346,8 @@ bad_file:
 	return ret;
 }
 
-asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf,
-			      size_t count, loff_t pos)
+static inline
+ssize_t do_pwrite(unsigned int fd, const char * buf, size_t count, loff_t pos)
 {
 	ssize_t ret;
 	struct file * file;
@@ -377,3 +377,35 @@ out:
 bad_file:
 	return ret;
 }
+
+#if BITS_PER_LONG == 32
+#ifdef __BIG_ENDIAN
+#define LOFF_T(high, low) unsigned int high, unsigned int low
+#else
+#define LOFF_T(high, low) unsigned int low, unsigned int high
+#endif
+
+asmlinkage
+ssize_t sys_pread(unsigned int fd, char *buf, size_t count, LOFF_T(high, low))
+{
+	return do_pread(fd, buf, count, (loff_t)high << 32 | low);
+}
+
+ssize_t sys_pwrite(unsigned int fd, char *buf, size_t count, LOFF_T(high, low))
+{
+	return do_pwrite(fd, buf, count, (loff_t)high << 32 | low);
+}
+
+
+#else /* BITS_PER_LONG != 32 */
+asmlinkage
+ssize_t sys_pread(unsigned int fd, char *buf, size_t count, loff_t pos)
+{
+	return do_pread(fd, buf, count, pos);
+}
+
+ssize_t sys_pwrite(unsigned int fd, char *buf, size_t count, loff_t pos)
+{
+	return do_pwrite(fd, buf, count, pos);
+}
+#endif

-- 
Revolutions do not require corporate support.

             reply	other threads:[~2001-04-10 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-10 20:30 Matthew Wilcox [this message]
2001-04-11 10:30 ` [parisc-linux] pread/pwrite Richard Hirst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010410213005.D25123@parcelfarce.linux.theplanet.co.uk \
    --to=matthew@wil.cx \
    --cc=parisc-linux@parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox