Skip to contentSkip to conversation

initramfs buffer spec -- second draft

DISCUSSION Alexander Viro 3 participants 4 messages Jan 13, 2002 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · H. Peter Anvin

Field name Field size Meaning
c_magic 6 bytes The string "070701" or "070702"
c_ino 8 bytes File inode number
c_mode 8 bytes File mode and permissions
c_uid 8 bytes File uid
c_gid 8 bytes File gid

c_nlink	      8 bytes		 Number of links
c_mtime	      8 bytes		 Modification time
c_filesize    8 bytes		 Size of data field
Quoted 6 lines

c_maj 8 bytes Major part of file device number
c_min 8 bytes Minor part of file device number
c_rmaj 8 bytes Major part of device node reference
c_rmin 8 bytes Minor part of device node reference
c_namesize 8 bytes Length of filename, including final \0
c_chksum 8 bytes CRC of data field if c_magic is 070702

+ or "00000000" if it's 070701. Kernel
+ is not expected to verify it in any case.

Quoted 2 lines

The c_mode field matches the contents of st_mode returned by stat(2) on Linux, and encodes the file type and file permissions.

- The c_filesize should be zero for any non-regular file.
+ The c_filesize can be non-zero only for regular files and symlinks.
+ For symlinks data and c_filesize match the results of readlink(2).
+ Having more than one link to a symlink is illegal.

#2 lore raw

Review

Quoted 4 lines · Alexander Viro
Quoted 1 line
(quoted diff) +2 -0
+				or "00000000" if it's 070701.  Kernel
+				is not expected to verify it in any case.

Check.

Quoted 6 lines

- The c_filesize should be zero for any non-regular file.
+ The c_filesize can be non-zero only for regular files and symlinks.
+ For symlinks data and c_filesize match the results of readlink(2).
+ Having more than one link to a symlink is illegal.

Why can't you have more than one link to a symlink?

-hpa

#3 lore raw
Quoted 7 lines · H. Peter Anvin
Quoted 5 lines

- The c_filesize should be zero for any non-regular file.
+ The c_filesize can be non-zero only for regular files and symlinks.
+ For symlinks data and c_filesize match the results of readlink(2).
+ Having more than one link to a symlink is illegal.

Why can't you have more than one link to a symlink?

Basically, you'll have no decent way to preserve that when you unpack.

In our case we _can_ do that; in general there is no portable way to create such links (semantics of link(2) wrt following links differs even between Linux versions, let alone various Unices).

cpio(1) includes the symlink body with each instance and doesn't even bother trying to link(2) them when unpacking.

#4 lore raw
In reply to Alexander Viro

Review

Quoted 6 lines · Alexander Viro
Quoted 1 line · H. Peter Anvin

c_chksum 8 bytes CRC of data field if c_magic is 070702

(quoted diff) +2 -0
+				or "00000000" if it's 070701.  Kernel
+				is not expected to verify it in any case.

Why is the kernel not expected to check the data integrity? Usually end to end data integrity is important. And a check on the data integrity and tells us that either the bootloader or the hardware is messed up can save hours of debugging?

Eric