On Sun, Jan 17, 2010 at 04:47:12PM -0800, Tim Kientzle wrote:
> On Fri, Jan 15, 2010 at 08:06:54PM -0800, Carl Miller wrote:
> >cramfs takes a shortcut with device nodes, and assigns them all inode 1.
> 
> I presume it also assigns nlinks == 1?

That would appear to be the case.  Here's the tail end of an strace of the
cpio in my example running....

14087 lstat("dev/loop0", {st_dev=makedev(7, 0), st_ino=1, st_mode=S_IFBLK|0644, 
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=4, 
st_rdev=makedev(7, 0), st_atime=0, st_mtime=0, st_ctime=0}) = 0
14087 write(3, 
"dev/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
14087 lstat("dev/loop1", {st_dev=makedev(7, 0), st_ino=1, st_mode=S_IFBLK|0644, 
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=4, 
st_rdev=makedev(7, 1), st_atime=0, st_mtime=0, st_ctime=0}) = 0
14087 write(3, "dev/loop0/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
512) = 512
14087 lstat("dev/loop2", {st_dev=makedev(7, 0), st_ino=1, st_mode=S_IFBLK|0644, 
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=4, 
st_rdev=makedev(7, 2), st_atime=0, st_mtime=0, st_ctime=0}) = 0
14087 write(3, "dev/loop1/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
512) = 512
14087 lstat("dev/loop3", {st_dev=makedev(7, 0), st_ino=1, st_mode=S_IFBLK|0644, 
st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=4, 
st_rdev=makedev(7, 3), st_atime=0, st_mtime=0, st_ctime=0}) = 0
14087 write(3, "dev/loop2/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
512) = 512
14087 read(0, "", 4096)                 = 0
14087 write(3, "dev/loop3/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
512) = 512
14087 write(3, 
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 
512
14087 write(3, 
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 
512
14087 close(3)                          = 0
14087 exit_group(0)                     = ?


> >When using cpio to copy files out of a cramfs image, cpio turns the second
> >and all subsequent copied device nodes into hard links to the first copied
> >out device node, based on them all having the same st_dev and st_ino.
> 
> Another possible solution:  When checking for hard links
> during copy-out, do not generate hardlink entries if
> nlinks < 2.

Good thought.  Maybe I'll try that first.  Thanks, Tim!


                          ------Carl



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to