diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2008-07-03 16:24:06 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-07-03 16:24:06 -0400 |
commit | e86322f611eef95aafaf726fd3965e5b211f1985 (patch) | |
tree | 28547e26df4fc6ae671dc8cc6912a53717e4db08 /fs/libfs.c | |
parent | b001a1b6aa960949a24c2cdc28257dfcc9428d74 (diff) | |
parent | 8948896c9e098c6fd31a6a698a598a7cbd7fa40e (diff) |
Merge branch 'for-bfields' of git://linux-nfs.org/~tomtucker/xprt-switch-2.6 into for-2.6.27
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index b004dfadd891..892d41cb3382 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -528,6 +528,23 @@ ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos, | |||
528 | return count; | 528 | return count; |
529 | } | 529 | } |
530 | 530 | ||
531 | ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | ||
532 | const void *from, size_t available) | ||
533 | { | ||
534 | loff_t pos = *ppos; | ||
535 | |||
536 | if (pos < 0) | ||
537 | return -EINVAL; | ||
538 | if (pos >= available) | ||
539 | return 0; | ||
540 | if (count > available - pos) | ||
541 | count = available - pos; | ||
542 | memcpy(to, from + pos, count); | ||
543 | *ppos = pos + count; | ||
544 | |||
545 | return count; | ||
546 | } | ||
547 | |||
531 | /* | 548 | /* |
532 | * Transaction based IO. | 549 | * Transaction based IO. |
533 | * The file expects a single write which triggers the transaction, and then | 550 | * The file expects a single write which triggers the transaction, and then |
@@ -800,6 +817,7 @@ EXPORT_SYMBOL(simple_statfs); | |||
800 | EXPORT_SYMBOL(simple_sync_file); | 817 | EXPORT_SYMBOL(simple_sync_file); |
801 | EXPORT_SYMBOL(simple_unlink); | 818 | EXPORT_SYMBOL(simple_unlink); |
802 | EXPORT_SYMBOL(simple_read_from_buffer); | 819 | EXPORT_SYMBOL(simple_read_from_buffer); |
820 | EXPORT_SYMBOL(memory_read_from_buffer); | ||
803 | EXPORT_SYMBOL(simple_transaction_get); | 821 | EXPORT_SYMBOL(simple_transaction_get); |
804 | EXPORT_SYMBOL(simple_transaction_read); | 822 | EXPORT_SYMBOL(simple_transaction_read); |
805 | EXPORT_SYMBOL(simple_transaction_release); | 823 | EXPORT_SYMBOL(simple_transaction_release); |