From 972ab74f1a783acaf79516a98d8aec4533097fc4 Mon Sep 17 00:00:00 2001
From: patacongo
Date: Sun, 16 Nov 2008 14:55:34 +0000
Subject: [PATCH] Add to losetup example
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1254 42af7a65-404d-4744-a932-0658087f49c3
---
Documentation/NuttShell.html | 12 +++++++++++-
examples/nsh/README.txt | 7 +++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index 3db6178674..c5c5c921be 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -954,7 +954,10 @@ losetup [-o ] [-r] <dev-path> <file-path>
Synopsis.
Setup the loop device at <dev-path> to access the file at <file-path> as a block device.
- Example:
+ In the following example a 256Kb file is created (dd
) and losetup
is
+ used to make the file accessible as a block device.
+ A FAT file system is created (mkfatfs
) and mounted (mount
).
+ Files can then be managed on the loop-mounted file.
nsh> dd if=/dev/zero of=/tmp/image bs=512 count=512
nsh> ls -l /tmp
@@ -970,6 +973,13 @@ nsh> ls -l /mnt
ls -l /mnt
/mnt:
drw-rw-rw- 0 example/
+nsh> echo "This is a test" >/mnt/example/atest.txt
+nsh> ls -l /mnt/example
+/mnt/example:
+ -rw-rw-rw- 16 ATEST.TXT
+nsh> cat /mnt/example/atest.txt
+This is a test
+nsh>
diff --git a/examples/nsh/README.txt b/examples/nsh/README.txt
index 840fe73fd9..8bdd14eb50 100644
--- a/examples/nsh/README.txt
+++ b/examples/nsh/README.txt
@@ -357,6 +357,13 @@ o losetup [-d ] | [[-o ] [-r] ]
ls -l /mnt
/mnt:
drw-rw-rw- 0 example/
+ nsh> echo "This is a test" >/mnt/example/atest.txt
+ nsh> ls -l /mnt/example
+ /mnt/example:
+ -rw-rw-rw- 16 ATEST.TXT
+ nsh> cat /mnt/example/atest.txt
+ This is a test
+ nsh>
o ls [-lRs]