This patch will make mode_t 16-bits->32-bits, off_t 32-bits->64-bits,
ino_t 32-bits->64-bits, and nlink_t 16-bits->32-bits. As uid_t and
gid_t were already 32-bits we can drop the big_{mode,off,ino,uid,
gid,nlink}_t types from struct stat. This has huge consequences:
. lseek now has to accept a 64-bit argument and returns a 64-bit
result. Therefore we need a new lseek and return proper results
based on the used version (i.e., translate).
. some fcntl functions take and return a struct flock which holds 2
off_t fields. Like lseek, we need to distinguish between old and
new versions.
. getdents uses struct dirent which has among other fields an ino_t
and off_t field. Consequently we need a new getdents system call
and have to translate when we encounter an old call.
. truncate and ftruncate also take off_t arguments and therefore
require a new version.
To add insult to injury VFS itself uses getdents. This has as
consequence that we have 2^3 combinations of version for getdents; old
and new version of libc (new system calls), new and old version of VFS
(when booting an old image), old and new version of an FS. We can
distinguish between these cases as follows; libc will use new system
call numbers that have not yet been in use. When using a new number,
VFS knows libc is new, otherwise it's an old libc. Vice versa, libc
first tries the new number and if that fails due to ENOSYS (unknown
system call number) it knows it's dealing with an old VFS. Finally,
since we now have VFS-FS protocol versioning and by bumping the version
to 1, VFS knows an FS is old when it reports version 0 and an FS knows
VFS is old when VFS reports it's using version 0.
0 = old version, 1 = new version
libc | VFS | FS | approach
----------------------------
0 | 0 | 0 | Nothing to do
----------------------------
0 | 0 | 1 | VFS reports protocol version 0, FS falls back
| to using the old getdents function
----------------------------
0 | 1 | 0 | VFS reports protocol version 1, FS version 0.
| libc requires old getdents so there is nothing
| to do. VFS itself needs new getdents and will
| translate.
----------------------------
0 | 1 | 1 | VFS reports protocol version 1, FS version 1.
| VFS intercepts getdents results and translates
| them on the fly before returning results to libc
----------------------------
1 | 0 | 0 | libc first tries new system call number and
| then fall back to the old number. libc first
| translates the results to the new getdents before
| returning.
----------------------------
1 | 0 | 1 | VFS reports protocol version 0, so FS uses fall
| back. libc translates.
----------------------------
1 | 1 | 0 | VFS reports protocol version 1, FS version 0. VFS
| will intercept all results and translate on the
| fly.
----------------------------
1 | 1 | 1 | Nothing to do.
As VFS can distinguish between old and new system calls of (f)truncate,
lseek, and fcntl, it will translate the arguments and results if
necessary. Likewise libc falls back to using the old calls and
translating the results to the new version if necessary.
Change-Id: Id5bc819e6ef90f317dbddb21020e0a65028225ce
63 lines
2.0 KiB
C
63 lines
2.0 KiB
C
|
|
#define GETDENTS_BUFSIZ 261
|
|
|
|
#define ISO9660_STANDARD_ID "CD001" /* Standard code for ISO9660 filesystems */
|
|
|
|
#define NR_DIR_RECORDS 256 /* Number of dir records to use at the same
|
|
* time. */
|
|
#define NR_ATTR_RECS 256 /* Number of extended attributes that is
|
|
* possible to use at the same time */
|
|
/* #define NR_ID_INODES 1024 */ /* The ISO9660 doesn't save the inode numbers.
|
|
* There is a table that assign to every inode
|
|
* a particular id. This number defines the
|
|
* maximum number of ids the filesystem can
|
|
* handle */
|
|
|
|
#define NO_ADDRESS (-1) /* Error constants */
|
|
#define NO_FREE_INODES (-1)
|
|
|
|
#define PATH_PENULTIMATE 001 /* parse_path stops at last but one name */
|
|
#define PATH_NONSYMBOLIC 004 /* parse_path scans final name if symbolic */
|
|
|
|
#define DIR_ENTRY_SIZE sizeof (struct direct)
|
|
#define NR_DIR_ENTRIES(b) ((b)/DIR_ENTRY_SIZE)
|
|
|
|
/* Below there are constant of the ISO9660 fs */
|
|
|
|
#define ISO9660_SUPER_BLOCK_POSITION (32768)
|
|
#define ISO9660_MIN_BLOCK_SIZE 2048
|
|
|
|
/* SIZES FIELDS ISO9660 STRUCTURES */
|
|
#define ISO9660_SIZE_STANDARD_ID 5
|
|
#define ISO9660_SIZE_BOOT_SYS_ID 32
|
|
#define ISO9660_SIZE_BOOT_ID 32
|
|
|
|
#define ISO9660_SIZE_SYS_ID 32
|
|
#define ISO9660_SIZE_VOLUME_ID 32
|
|
#define ISO9660_SIZE_VOLUME_SET_ID 128
|
|
#define ISO9660_SIZE_PUBLISHER_ID 128
|
|
#define ISO9660_SIZE_DATA_PREP_ID 128
|
|
#define ISO9660_SIZE_APPL_ID 128
|
|
#define ISO9660_SIZE_COPYRIGHT_FILE_ID 37
|
|
#define ISO9660_SIZE_ABSTRACT_FILE_ID 37
|
|
#define ISO9660_SIZE_BIBL_FILE_ID 37
|
|
|
|
#define ISO9660_SIZE_VOL_CRE_DATE 17
|
|
#define ISO9660_SIZE_VOL_MOD_DATE 17
|
|
#define ISO9660_SIZE_VOL_EXP_DATE 17
|
|
#define ISO9660_SIZE_VOL_EFF_DATE 17
|
|
|
|
#define ISO9660_SIZE_ESCAPE_SQC 32
|
|
#define ISO9660_SIZE_PART_ID 32
|
|
|
|
#define ISO9660_SIZE_SYSTEM_USE 64
|
|
|
|
/* maximum size of length of name file used in dir records */
|
|
#define ISO9660_MAX_FILE_ID_LEN 32
|
|
|
|
#define END_OF_FILE (-104) /* eof detected */
|
|
|
|
/* Miscellaneous constants */
|
|
#define SYS_UID ((uid_t) 0) /* uid_t for processes PM and INIT */
|
|
#define SYS_GID ((gid_t) 0) /* gid_t for processes PM and INIT */
|