Está en la página 1de 3

File Systems and Logical Volumes

A file is a one-dimensional array of bytes that can contain ASCII or binary information. AIX files can contain data, shell scripts, and programs. File names are also used to represent abstract objects such as sockets or device drivers. Files are represented internally by index nodes (i-nodes). Within the journaled file system (JFS), an inode is a structure that contains all access, timestamp, ownership, and data location information for each file. An i-node is 128-bytes in JFS and 512-bytes in the enhanced journaled file system (JFS2). Pointers within the i-node structure designate the real disk address of the data blocks associated with the file. An i-node is identified by an offset number (i-number) and has no file name information. The connection of i-numbers and file names is called a link. File names exist only in directories. Directories are a unique type of file that give hierarchical structure to the file system. Directories contain directory entries. Each directory entry contains a file name and an inumber. JFS and JFS2 are supported by this operating system. The file system links the file and directory data to the structure used by storage and retrieval mechanisms. This chapter contains the following topics about file systems: File Types Working With JFS Directories Working with JFS2 Directories Working with JFS i-nodes Working with JFS2 i-nodes Allocating JFS File Space Allocating JFS2 File Space JFS File System Layout JFS2 File System Layout Writing Programs That Access Large Files Linking for Programmers Using File Descriptors Creating and Removing Files Working with File I/O File Status File Accessibility JFS File System Layout Creating New File System Types This chapter also contains information about programming considerations concerning Logical Volume Manager (LVM). See Logical Volume Programming. File Types A file is a one-dimensional array of bytes with at least one hard link (file name). Files can contain ASCII or binary information. Files contain data, shell scripts, or programs. File names are also used to represent abstract objects, such as sockets, pipes, and device drivers. For a list of subroutines used to control files, see Working with Files. The kernel does not distinguish record boundaries in regular files, so programs can establish their own boundary markers. For example, many programs use line-feed characters to mark the end of lines. Working with Files contains a list of the subroutines used to control files. Files are represented in the journaled file system (JFS and JFS2) by disk index nodes (i-node). Information about the file (such as ownership, access modes, access time, data addresses, and modification time) is stored in the i-node. For more information about the internal structure of files, see Working with JFS i-nodes or Working with JFS2 i-nodes. The journaled file system supports the following file types:

File Types Supported By Journaled File System Type of Macro Name Description File Used in mode.h A sequence of bytes with one or more names. Regular files can contain Regular S_ISREG ASCII or binary data. These files can be randomly accessed (read from or written to) from any byte in the file. Contains directory entries (file name and i-number pairs). Directory formats are determined by the file system. Processes read directories as they do Directory S_ISDIR ordinary files, but the kernel reserves the right to write to a directory. Special sets of subroutines control directory entries. Block S_ISBLK Associates a structured device driver with a file name. Special Character S_ISCHR Associates an unstructured device driver with a file name. Special Designates an interprocess communication (IPC) channel. The mkfifo Pipes S_ISFIFO subroutine creates named pipes. The pipe subroutine creates unnamed pipes. Symbolic A file that contains either an absolute or relative path name to another file S_ISLNK Links name. An IPC mechanism that allows applications to exchange data. The socket Sockets S_ISSOCK subroutine creates sockets, and the bind subroutine allows sockets to be named.
The maximum size of a regular file in a JFS file system enabled for large files is slightly less than 64 gigabytes (68589453312). In other file systems that are enabled for large files and in other JFS file system types, all files not listed as regular in the previous table have a maximum file size of 2 gigabytes minus 1 (2147483647). The maximum size of a file in JFS2 is limited by the size of the file system itself. The architectural limit on the size of a JFS2 file system is 252 bytes, or 4 petabytes. In AIX 5.2, the maximum JFS2 file size supported by the 32-bit kernel is 240 - 4096 bytes, or just under 1 terabyte. The maximum file size supported by the 64-bit kernel is 244 - 4096 bytes, or just less than 16 terabytes. The maximum length of a file name is 255 characters, and the maximum length of a path name is 1023 bytes. Working with Files The operating system provides many subroutines that manipulate files. For brief descriptions of the most common file-control subroutines, see the following: Creating Files Manipulating Files (Programming) Creating Files The following subroutines are used when creating files: creat Creates a new, empty, regular file link Creates an additional name (directory entry) for an existing file mkdir Creates a directory mkfifo Creates a named pipe mknod Creates a file that defines a device open Creates a new, empty file if the O_CREAT flag is set pipe Creates an IPC socket Creates a socket Manipulating Files (Programming) The following subroutines can be used to manipulate files: access Determines the accessibility of a file. chmod Changes the access modes of a file. chown Changes ownership of a file. close Closes open file descriptors (including sockets). fclear Creates space in a file. fcntl, dup, or dup2 Control open file descriptors. fsync Writes changes in a file to permanent storage. Controls functions associated with open file descriptors, ioctl including special files, sockets, and generic device

lockf or flock lseek or llseek open

read rename rmdir stat truncate write

support, such as the termio general terminal interface. Control open file descriptors. Move the I/O pointer position in an open file. Returns a file descriptor used by other subroutines to refer to the opened file. The open operation takes a regular file name and a permission mode that indicates whether the file is to be read from, written to, or both. Gets data from an open file if the appropriate permissions (O_RDONLY or O_RDWR) were set by the open subroutine. Changes the name of a file. Removes directories from the file system. Reports the status of a file, including the owner and access modes. Changes the length of a file. Puts data into an open file if the appropriate permissions (O_WRONLY or O_RDWR) were set by the open subroutine.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

También podría gustarte